diff --git a/INSTALL_DEBIAN.txt b/INSTALL_DEBIAN.txt index 7ab2798d5fd546611ef53f27c938e66bff0a722b..243566bb1aac8a349cba0038b16274ce2798a272 100644 --- a/INSTALL_DEBIAN.txt +++ b/INSTALL_DEBIAN.txt @@ -34,6 +34,14 @@ a2enmod rewrite apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool +Edit the file /etc/default/pure-ftpd-common + +vi /etc/default/pure-ftpd-common + +and change the start mode from inetd to standalone. Then execute: + +/etc/init.d/openbsd-inetd restart + 5) Install mydns diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index b5f0617cca89ae88a125b231c01fa95bdf022f2b..65a150f9da37669b3904313e5a47dbf1a0c17ef8 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -522,7 +522,7 @@ class installer_base { exec("chmod 600 $config_dir/$configfile"); exec("chown root:root $config_dir/$configfile"); // **enable chrooting - exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone'); + //exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone'); exec('echo "yes" > '.$config_dir.'/conf/ChrootEveryone'); } diff --git a/interface/web/admin/lib/lang/en_server_ip.lng b/interface/web/admin/lib/lang/en_server_ip.lng index c14566e3cd4c5f1ae1566b923be14a05b6404b35..a0d88dc182cf73b4744530f92a7a3d941b864bde 100644 --- a/interface/web/admin/lib/lang/en_server_ip.lng +++ b/interface/web/admin/lib/lang/en_server_ip.lng @@ -1,7 +1,7 @@ dataRecord["password"] != '') { + if(isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') { $password = addslashes($this->dataRecord["password"]); $client_id = $this->id; $sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id"; diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php index d87e2f9d9a6adbfa4780799624b69e160dbfa758..14aeab1ed9f44d8994d616fe73c9364b444745d6 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -526,6 +526,20 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), + 'limit_shell_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_shell_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), 'default_dnsserver' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', diff --git a/interface/web/client/lib/lang/en_client.lng b/interface/web/client/lib/lang/en_client.lng index 435a2908d2381285692dacde44cd0d902f376727..fbc1fbf77741b62605ff203225bf5c84462360e8 100644 --- a/interface/web/client/lib/lang/en_client.lng +++ b/interface/web/client/lib/lang/en_client.lng @@ -53,6 +53,6 @@ $wb["limit_ftp_user_txt"] = 'Max. number of FTP users'; $wb["default_dnsserver_txt"] = 'Default DNS Server'; $wb["limit_dns_zone_txt"] = 'Max. number of DNS zones'; $wb["limit_dns_record_txt"] = 'Max. number DNS records'; - +$wb["limit_shell_user_txt"] = 'Max. number of Shell users'; ?> \ No newline at end of file diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm index e33d0b323367f844cabf9a36fc62099c344e7b65..f130d8951fd66538bba97403e8e74d4596c234c1 100644 --- a/interface/web/client/templates/client_edit_limits.htm +++ b/interface/web/client/templates/client_edit_limits.htm @@ -90,6 +90,10 @@ {tmpl_var name='limit_ftp_user_txt'}: + + {tmpl_var name='limit_shell_user_txt'}: + +

DNS

diff --git a/interface/web/sites/form/shell_user.tform.php b/interface/web/sites/form/shell_user.tform.php new file mode 100644 index 0000000000000000000000000000000000000000..7ddc28157cb291a90c4cbe3c865065996849001c --- /dev/null +++ b/interface/web/sites/form/shell_user.tform.php @@ -0,0 +1,191 @@ + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +$form["tabs"]['shell'] = array ( + 'title' => "Shell User", + 'width' => 100, + 'template' => "templates/shell_user_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'server_id' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), + 'parent_domain_id' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain", + 'keyfield'=> 'domain_id', + 'valuefield'=> 'domain' + ), + 'value' => '' + ), + 'username' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'username_error_empty'), + 1 => array ( 'type' => 'UNIQUE', + 'errmsg'=> 'username_error_unique'), + 2 => array ( 'type' => 'REGEX', + 'regex' => '/^[\w\.\-]{1,64}$/', + 'errmsg'=> 'username_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'password' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'PASSWORD', + 'encryption' => 'CRYPT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'quota_size' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'quota_size_error_empty'), + ), + 'default' => '-1', + 'value' => '', + 'width' => '7', + 'maxlength' => '7' + ), + 'active' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n',1 => 'y') + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + +if($_SESSION["s"]["user"]["typ"] == 'admin') { + +$form["tabs"]['advanced'] = array ( + 'title' => "Options", + 'width' => 100, + 'template' => "templates/shell_user_advanced.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'uid' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'uid_error_empty'), + ), + 'default' => '0', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'gid' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'uid_error_empty'), + ), + 'default' => '0', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'shell' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '/bin/bash', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'dir' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'directory_error_empty'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + +} + + +?> \ No newline at end of file diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php index 2c704b67c8c07938a2a3858c78ba56dba33ad926..61f549c8e938daef98d39aeb576da896ade907d0 100644 --- a/interface/web/sites/ftp_user_edit.php +++ b/interface/web/sites/ftp_user_edit.php @@ -63,7 +63,7 @@ class page_action extends tform_actions { $client_group_id = $_SESSION["s"]["user"]["default_group"]; $client = $app->db->queryOneRecord("SELECT limit_ftp_user FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); - // Check if the user may add another maildomain. + // Check if the user may add another ftp user. if($client["limit_ftp_user"] >= 0) { $tmp = $app->db->queryOneRecord("SELECT count(ftp_user_id) as number FROM ftp_user WHERE sys_groupid = $client_group_id"); if($tmp["number"] >= $client["limit_ftp_user"]) { diff --git a/interface/web/sites/lib/lang/en_shell_user.lng b/interface/web/sites/lib/lang/en_shell_user.lng new file mode 100644 index 0000000000000000000000000000000000000000..88004b67c495d6d3fe32c4659e528341c996b468 --- /dev/null +++ b/interface/web/sites/lib/lang/en_shell_user.lng @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/interface/web/sites/lib/lang/en_shell_user_list.lng b/interface/web/sites/lib/lang/en_shell_user_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..45f60ff8712e8d2ad239dddd6604b313cf0af832 --- /dev/null +++ b/interface/web/sites/lib/lang/en_shell_user_list.lng @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php index 8be6e6ef683f6c44120ee0f3c48e1883b37f3eb4..c863e6035ce74b93ac928648058647fd42fc8dcc 100644 --- a/interface/web/sites/lib/module.conf.php +++ b/interface/web/sites/lib/module.conf.php @@ -28,7 +28,7 @@ $module["nav"][] = array( 'title' => 'Websites', 'open' => 1, 'items' => $items); -// aufräumen +// clean up unset($items); /* @@ -44,7 +44,23 @@ $module["nav"][] = array( 'title' => 'FTP', 'open' => 1, 'items' => $items); -// aufräumen +// clean up +unset($items); + +/* + FTP User menu +*/ + +$items[] = array( 'title' => "Shell-User", + 'target' => 'content', + 'link' => 'sites/shell_user_list.php'); + + +$module["nav"][] = array( 'title' => 'Shell', + 'open' => 1, + 'items' => $items); + +// clean up unset($items); diff --git a/interface/web/sites/list/shell_user.list.php b/interface/web/sites/list/shell_user.list.php new file mode 100644 index 0000000000000000000000000000000000000000..6e22077ef4fee37e8e336a5a1fb61e39ddc00b6f --- /dev/null +++ b/interface/web/sites/list/shell_user.list.php @@ -0,0 +1,99 @@ + "active", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => array('y' => "Yes",'n' => "No")); + + +$liste["item"][] = array( 'field' => "server_id", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "parent_domain_id", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain", + 'keyfield'=> 'domain_id', + 'valuefield'=> 'domain' + ), + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "username", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + + +?> \ No newline at end of file diff --git a/interface/web/sites/shell_user_del.php b/interface/web/sites/shell_user_del.php new file mode 100644 index 0000000000000000000000000000000000000000..c834408ecf98e8b8cb85c44d8339bf08ab2989e7 --- /dev/null +++ b/interface/web/sites/shell_user_del.php @@ -0,0 +1,54 @@ +uses("tform_actions"); +$app->tform_actions->onDelete(); + +?> \ No newline at end of file diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php new file mode 100644 index 0000000000000000000000000000000000000000..be7ded6a30615690e47728f8f2ef099ba7f3e066 --- /dev/null +++ b/interface/web/sites/shell_user_edit.php @@ -0,0 +1,103 @@ +uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onShowNew() { + global $app, $conf; + + // we will check only users, not admins + if($_SESSION["s"]["user"]["typ"] == 'user') { + + // Get the limits of the client + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT limit_ftp_user FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + // Check if the user may add another shell user. + if($client["limit_shell_user"] >= 0) { + $tmp = $app->db->queryOneRecord("SELECT count(shell_user_id) as number FROM shell_user WHERE sys_groupid = $client_group_id"); + if($tmp["number"] >= $client["limit_shell_user"]) { + $app->error($app->tform->wordbook["limit_shell_user_txt"]); + } + } + } + + parent::onShowNew(); + } + + function onAfterInsert() { + global $app, $conf; + + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"])); + $server_id = $web["server_id"]; + $dir = $web["document_root"]; + $uid = $web["system_user"]; + $gid = $web["system_group"]; + + $sql = "UPDATE shell_user SET server_id = $server_id, dir = '$dir', uid = '$uid', gid = '$gid' WHERE shell_user_id = ".$this->id; + $app->db->query($sql); + + } + + function onAfterUpdate() { + global $app, $conf; + + + } + +} + +$page = new page_action; +$page->onLoad(); + +?> \ No newline at end of file diff --git a/interface/web/sites/shell_user_list.php b/interface/web/sites/shell_user_list.php new file mode 100644 index 0000000000000000000000000000000000000000..3909b84237e54e10ba7551c1218b3b10be6f9e45 --- /dev/null +++ b/interface/web/sites/shell_user_list.php @@ -0,0 +1,58 @@ +uses('listform_actions'); + +// Limit the results to alias domains +//$app->listform_actions->SQLExtWhere = "type = 'subdomain'"; + +$app->listform_actions->onLoad(); + + +?> \ No newline at end of file diff --git a/interface/web/sites/templates/shell_user_advanced.htm b/interface/web/sites/templates/shell_user_advanced.htm new file mode 100644 index 0000000000000000000000000000000000000000..3ae6d4fa6d2697828782c16ea15c29c71eb354a3 --- /dev/null +++ b/interface/web/sites/templates/shell_user_advanced.htm @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
{tmpl_var name='uid_txt'}:
{tmpl_var name='gid_txt'}:
{tmpl_var name='shell_txt'}:
{tmpl_var name='dir_txt'}:
  
 
  +
+
+ \ No newline at end of file diff --git a/interface/web/sites/templates/shell_user_edit.htm b/interface/web/sites/templates/shell_user_edit.htm new file mode 100644 index 0000000000000000000000000000000000000000..16d2d9712326849d4f126331285483745003fe92 --- /dev/null +++ b/interface/web/sites/templates/shell_user_edit.htm @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{tmpl_var name='server_id_txt'}: + +
{tmpl_var name='parent_domain_id_txt'}: + +
{tmpl_var name='username_txt'}:
{tmpl_var name='password_txt'}:
{tmpl_var name='quota_size_txt'}:
{tmpl_var name='active_txt'}:{tmpl_var name='active'}
  
 
  +
+
+ \ No newline at end of file diff --git a/interface/web/sites/templates/shell_user_list.htm b/interface/web/sites/templates/shell_user_list.htm new file mode 100644 index 0000000000000000000000000000000000000000..69a8b9f74fd42023c7042931355bc350aa1c9647 --- /dev/null +++ b/interface/web/sites/templates/shell_user_list.htm @@ -0,0 +1,31 @@ +

+


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
{tmpl_var name="active"}{tmpl_var name="server_id"}{tmpl_var name="parent_domain_id"}{tmpl_var name="username"}[{tmpl_var name='delete_txt'}]
\ No newline at end of file diff --git a/server/plugins-enabled/apache2_plugin.inc.php b/server/plugins-enabled/apache2_plugin.inc.php index a068fe593076256e508fe39b72a67e8919bccc35..dc8dc38a93bf1d9381b40b0093098c778cd8cbed 100644 --- a/server/plugins-enabled/apache2_plugin.inc.php +++ b/server/plugins-enabled/apache2_plugin.inc.php @@ -49,6 +49,10 @@ class apache2_plugin { $app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update'); $app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete'); + $app->plugins->registerEvent('server_ip_insert',$this->plugin_name,'server_ip'); + $app->plugins->registerEvent('server_ip_update',$this->plugin_name,'server_ip'); + $app->plugins->registerEvent('server_ip_delete',$this->plugin_name,'server_ip'); + } function insert($event_name,$data) { @@ -104,7 +108,7 @@ class apache2_plugin { // Copy the error pages $error_page_path = escapeshellcmd($data["new"]["web_document_root"])."/web/error/"; - exec("copy /usr/local/ispconfig/server/conf/error/".escapeshellcmd($conf["language"])."/* ".$error_page_path); + exec("cp /usr/local/ispconfig/server/conf/error/".substr(escapeshellcmd($conf["language"]),0,2)."/* ".$error_page_path); // Create group and user, if not exist $app->uses("system"); @@ -225,6 +229,16 @@ class apache2_plugin { } + //* This function is called when a IP on the server is inserted, updated or deleted + function server_ip($event_name,$data) { + global $app, $conf; + + // Here we write the name virtualhost directives + // NameVirtualHost IP:80 + // NameVirtualHost IP:443 + + } + } // end class