Till Brehm
2014-08-14 9edea9976bd605071e0694a90d704266c0b7e0f9
- Added warning in the interface when a path for a shelluser is set that is outside of the website docroot.
- Added security settings feature to allow the root user of a server to control most aspects of whet the admin user of the controlpanel is allowed to do in system settings. This is especially useful for managed severs where the ispconfig admin user and the root user of the server are different persons.
1 files added
66 files modified
318 ■■■■■ changed files
interface/lib/classes/auth.inc.php 18 ●●●●● patch | view | raw | blame | history
interface/lib/classes/getconf.inc.php 9 ●●●●● patch | view | raw | blame | history
interface/lib/classes/validate_systemuser.inc.php 56 ●●●●● patch | view | raw | blame | history
interface/lib/lang/ar.lng 2 ●●●●● patch | view | raw | blame | history
interface/lib/lang/bg.lng 2 ●●●●● patch | view | raw | blame | history
interface/lib/lang/br.lng 2 ●●●●● patch | view | raw | blame | history
interface/lib/lang/cz.lng 2 ●●●●● patch | view | raw | blame | history
interface/lib/lang/de.lng 2 ●●●●● patch | view | raw | blame | history
interface/lib/lang/el.lng 2 ●●●●● patch | view | raw | blame | history
interface/lib/lang/en.lng 6 ●●●● patch | view | raw | blame | history
interface/lib/lang/es.lng 2 ●●●●● patch | view | raw | blame | history
interface/lib/lang/fi.lng 2 ●●●●● patch | view | raw | blame | history
interface/lib/lang/fr.lng 2 ●●●●● patch | view | raw | blame | history
interface/lib/lang/hr.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/hu.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/id.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/it.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/ja.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/nl.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/pl.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/pt.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/ro.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/ru.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/se.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/sk.lng 4 ●●● patch | view | raw | blame | history
interface/lib/lang/tr.lng 4 ●●● patch | view | raw | blame | history
interface/web/admin/firewall_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/firewall_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/groups_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/groups_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/iptables_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/iptables_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/iptables_list.php 2 ●●●●● patch | view | raw | blame | history
interface/web/admin/language_add.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/language_complete.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/language_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/language_export.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/language_import.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/remote_action_osupdate.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/remote_user_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/remote_user_edit.php 3 ●●●●● patch | view | raw | blame | history
interface/web/admin/server_config_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/server_config_edit.php 2 ●●●●● patch | view | raw | blame | history
interface/web/admin/server_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/server_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/server_ip_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/server_ip_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/server_php_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/server_php_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/software_package_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/software_package_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/software_package_install.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/software_repo_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/software_repo_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/software_update_list.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/system_config_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/tpl_default.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/users_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/users_edit.php 13 ●●●●● patch | view | raw | blame | history
interface/web/remote/index.php 6 ●●●● patch | view | raw | blame | history
interface/web/sites/form/shell_user.tform.php 4 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_shell_user.lng 1 ●●●● patch | view | raw | blame | history
interface/web/tools/user_settings.php 4 ●●●● patch | view | raw | blame | history
security/security_settings.ini 25 ●●●●● patch | view | raw | blame | history
server/lib/classes/getconf.inc.php 9 ●●●●● patch | view | raw | blame | history
server/plugins-available/shelluser_base_plugin.inc.php 30 ●●●● patch | view | raw | blame | history
server/plugins-available/shelluser_jailkit_plugin.inc.php 31 ●●●● patch | view | raw | blame | history
interface/lib/classes/auth.inc.php
@@ -46,7 +46,7 @@
    }
    
    public function is_superadmin() {
        if($_SESSION['s']['user']['typ'] == 'admin' && $_SESSION['s']['user']['userid'] === 1) {
        if($_SESSION['s']['user']['typ'] == 'admin' && $_SESSION['s']['user']['userid'] == 1) {
            return true;
        } else {
            return false;
@@ -136,6 +136,22 @@
            exit;
        }
    }
    public function check_security_permissions($permission) {
        global $app;
        $app->uses('getconf');
        $security_config = $app->getconf->get_security_config('permissions');
        $security_check = false;
        if($security_config[$permission] == 'yes') $security_check = true;
        if($security_config[$permission] == 'superadmin' && $app->auth->is_superadmin()) $security_check = true;
        if($security_check !== true) {
            $app->error($app->lng('security_check1_txt').' '.$permission.' '.$app->lng('security_check2_txt'));
        }
    }
    public function get_random_password($length = 8) {
        $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
interface/lib/classes/getconf.inc.php
@@ -54,6 +54,15 @@
        }
        return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
    }
    public function get_security_config($section = '') {
        global $app;
        $app->uses('ini_parser');
        $security_config = $app->ini_parser->parse_ini_string(file_get_contents('/usr/local/ispconfig/security/security_settings.ini'));
        return ($section == '') ? $security_config : $security_config[$section];
    }
}
interface/lib/classes/validate_systemuser.inc.php
@@ -58,7 +58,63 @@
        }
    }
    /*
        Validator function to check if a given dir is ok.
    */
    function shelluser_dir($field_name, $field_value, $validator) {
        global $app;
        if($app->tform->primary_id == 0) {
            $errmsg = $validator['errmsg'];
            if(isset($app->tform->wordbook[$errmsg])) {
                return $app->tform->wordbook[$errmsg]."<br>\r\n";
            } else {
                return $errmsg."<br>\r\n";
            }
        }
        $shell_data = $app->db->queryOneRecord("SELECT parent_domain_id FROM shell_user WHERE shell_user_id = '".$app->db->quote($app->tform->primary_id)."'");
        if(!is_array($shell_data) || $shell_data["parent_domain_id"] < 1) {
            $errmsg = $validator['errmsg'];
            if(isset($app->tform->wordbook[$errmsg])) {
                return $app->tform->wordbook[$errmsg]."<br>\r\n";
            } else {
                return $errmsg."<br>\r\n";
            }
        }
        $domain_data = $app->db->queryOneRecord("SELECT domain_id, document_root FROM web_domain WHERE domain_id = '".$app->db->quote($shell_data["parent_domain_id"])."'");
        if(!is_array($domain_data) || $domain_data["domain_id"] < 1) {
            $errmsg = $validator['errmsg'];
            if(isset($app->tform->wordbook[$errmsg])) {
                return $app->tform->wordbook[$errmsg]."<br>\r\n";
            } else {
                return $errmsg."<br>\r\n";
            }
        }
        $doc_root = $domain_data["document_root"];
        $is_ok = false;
        if($doc_root == $field_value) $is_ok = true;
        $doc_root .= "/";
        if(substr($field_value, 0, strlen($doc_root)) == $doc_root) $is_ok = true;
        if(stristr($field_value, '..') or stristr($field_value, './') or stristr($field_value, '/.')) $is_ok = false;
        //* Final check if docroot path of website is >= 5 chars
        if(strlen($doc_root) < 5) $is_ok = false;
        if($is_ok == false) {
            $errmsg = $validator['errmsg'];
            if(isset($app->tform->wordbook[$errmsg])) {
                return $app->tform->wordbook[$errmsg]."<br>\r\n";
            } else {
                return $errmsg."<br>\r\n";
            }
        }
    }
}
interface/lib/lang/ar.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/bg.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/br.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/cz.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Velmi silná';
$wb['weak_password_txt'] = 'Zvolené heslo neodpovídá požadavkům zásad pro tvorbu hesel. Heslo musí být alespoň {chars} znaků dlouhé a mající sílu \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'Zvolené heslo neodpovídá požadavkům zásad pro tvorbu hesel. Heslo musí být alespoň {chars} znaků dlouhé.';
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/de.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Sehr stark';
$wb['weak_password_txt'] = 'Das gewählte Passwort erfüllt die Sicherheitsanforderungen nicht. Es muss mindestens {chars} Zeichen lang sein und die Stärke \\"{strength}\\" besitzen.';
$wb['weak_password_length_txt'] = 'Das gewählte Passwort erfüllt die Sicherheitsanforderungen nicht. Es muss mindestens {chars} Zeichen lang sein.';
$wb['security_check1_txt'] = 'Sicherheitsüberprüfung für:';
$wb['security_check2_txt'] = 'fehlgeschlagen.';
?>
interface/lib/lang/el.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/en.lng
@@ -131,7 +131,6 @@
$wb['datalog_status_i_web_folder_user'] = 'Create folder protection user';
$wb['datalog_status_u_web_folder_user'] = 'Update folder protection user';
$wb['datalog_status_d_web_folder_user'] = 'Delete folder protection user';
$wb['login_as_txt'] = 'Log in as';
$wb["no_domain_perm"] = 'You have no permission for this domain.';
$wb["no_destination_perm"] = 'You have no permission for this destination.';
@@ -149,5 +148,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of "{strength}".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/es.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/fi.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/fr.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/hr.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/hu.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/id.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/it.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/ja.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/nl.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/pl.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/pt.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/ro.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/ru.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/se.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Väldigt starkt';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \"{strength}\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/sk.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/lib/lang/tr.lng
@@ -147,4 +147,6 @@
$wb['strength_5'] = 'Very Strong';
$wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of \\"{strength}\\".';
$wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.';
?>
$wb['security_check1_txt'] = 'Check for security permission:';
$wb['security_check2_txt'] = 'failed.';
?>
interface/web/admin/firewall_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_firewall_config');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
interface/web/admin/firewall_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_firewall_config');
// Loading classes
$app->uses('tpl,tform,tform_actions');
interface/web/admin/groups_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_cpuser_group');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
interface/web/admin/groups_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_cpuser_group');
// Loading classes
$app->uses('tpl,tform,tform_actions');
interface/web/admin/iptables_del.php
@@ -1,4 +1,5 @@
<?php
die('unused');
/*
Copyright (c) 2011, Andrew "lathama" Latham, Till Brehm, projektfarm Gmbh
All rights reserved.
interface/web/admin/iptables_edit.php
@@ -1,4 +1,5 @@
<?php
die('unused');
/*
Copyright (c) 2011, Andrew "lathama" Latham, Till Brehm, projektfarm Gmbh
All rights reserved.
interface/web/admin/iptables_list.php
@@ -1,4 +1,6 @@
<?php
die('unused');
/*
Copyright (c) 2011, Andrew "lathama" Latham, Till Brehm, projektfarm Gmbh
All rights reserved.
interface/web/admin/language_add.php
@@ -32,6 +32,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_langedit');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
interface/web/admin/language_complete.php
@@ -32,6 +32,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_langedit');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
//* This is only allowed for administrators
interface/web/admin/language_edit.php
@@ -32,6 +32,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_langedit');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
interface/web/admin/language_export.php
@@ -32,6 +32,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_langedit');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
interface/web/admin/language_import.php
@@ -112,6 +112,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_langedit');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
interface/web/admin/remote_action_osupdate.php
@@ -32,6 +32,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_osupdate');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
interface/web/admin/remote_user_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_remote_users');
$app->uses('tpl,tform');
$app->load('tform_actions');
interface/web/admin/remote_user_edit.php
@@ -13,6 +13,9 @@
    die;
}
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_remote_users');
// Disable this function in demo mode
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
interface/web/admin/server_config_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_config');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses("tform_actions");
interface/web/admin/server_config_edit.php
@@ -43,6 +43,8 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_config');
// Loading classes
$app->uses('tpl,tform,tform_actions');
interface/web/admin/server_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_services');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses("tform_actions");
interface/web/admin/server_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_services');
// Loading classes
$app->uses('tpl,tform,tform_actions');
interface/web/admin/server_ip_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_ip');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
interface/web/admin/server_ip_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_ip');
// Loading classes
$app->uses('tpl,tform,tform_actions');
interface/web/admin/server_php_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_php');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
interface/web/admin/server_php_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_php');
// Loading classes
$app->uses('tpl,tform,tform_actions');
interface/web/admin/software_package_del.php
@@ -33,6 +33,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_software_packages');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$software_update_inst_id = $app->functions->intval($_GET['software_update_inst_id']);
interface/web/admin/software_package_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_software_packages');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
// Loading classes
interface/web/admin/software_package_install.php
@@ -33,6 +33,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_software_packages');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
interface/web/admin/software_repo_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_software_repo');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses("tform_actions");
interface/web/admin/software_repo_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_software_repo');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
// Loading classes
interface/web/admin/software_update_list.php
@@ -33,6 +33,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_software_packages');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
interface/web/admin/system_config_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_system_config');
// Loading classes
$app->uses('tpl,tform,tform_actions');
interface/web/admin/tpl_default.php
@@ -1,4 +1,5 @@
<?php
die('unused');
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
interface/web/admin/users_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_del_cpuser');
if($conf['demo_mode'] == true && $_REQUEST['id'] <= 3) $app->error('This function is disabled in demo mode.');
$app->uses("tform_actions");
interface/web/admin/users_edit.php
@@ -52,16 +52,29 @@
    function onBeforeInsert() {
        global $app, $conf;
        //* Security settings check
        if(isset($this->dataRecord['typ']) && $this->dataRecord['typ'][0] == 'admin') {
            $app->auth->check_security_permissions('admin_allow_new_admin');
        }
        if(!in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
            $app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
        }
    }
    function onBeforeUpdate() {
        global $app, $conf;
        if($conf['demo_mode'] == true && $_REQUEST['id'] <= 3) $app->error('This function is disabled in demo mode.');
        //* Security settings check
        if(isset($this->dataRecord['typ']) && $this->dataRecord['typ'][0] == 'admin') {
            $app->auth->check_security_permissions('admin_allow_new_admin');
        }
        if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
            $app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
interface/web/remote/index.php
@@ -6,7 +6,11 @@
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->load('remoting');
$app->load('remoting,getconf');
$security_config = $app->getconf->get_security_config('permissions');
if($security_config['remote_api_allowed'] != 'yes') die('Remote API is disabled in security settings.');
$server = new SoapServer(null, array('uri' => $_SERVER['REQUEST_URI']));
$server->setClass('remoting');
interface/web/sites/form/shell_user.tform.php
@@ -237,6 +237,10 @@
                                        1 => array (     'type' => 'REGEX',
                                                            'regex' => '/^\/[a-zA-Z0-9\ \.\-\_\/]{10,128}$/',
                                                            'errmsg'=> 'directory_error_regex'),
                                        2 => array (    'type'  => 'CUSTOM',
                                                        'class' => 'validate_systemuser',
                                                        'function' => 'shelluser_dir',
                                                        'errmsg' => 'directory_error_notinweb'),
                ),
                'default' => '',
                'value'  => '',
interface/web/sites/lib/lang/en_shell_user.lng
@@ -32,4 +32,5 @@
$wb['directory_error_regex'] = 'Invalid directory';
$wb['shell_error_regex'] = 'Invalid shell';
$wb['invalid_username_txt'] = 'Invalid Username';
$wb['directory_error_notinweb'] = 'The directory has to be inside the web root.';
?>
interface/web/tools/user_settings.php
@@ -44,6 +44,10 @@
//* Check permissions for module
$app->auth->check_module_permissions('tools');
if($_SESSION['s']['user']['typ'] == 'admin') {
    $app->auth->check_security_permissions('admin_allow_new_admin');
}
// Loading classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
security/security_settings.ini
New file
@@ -0,0 +1,25 @@
[permissions]
allow_shell_user=yes
admin_allow_server_config=superadmin
admin_allow_server_services=superadmin
admin_allow_server_ip=superadmin
admin_allow_remote_users=superadmin
admin_allow_system_config=superadmin
admin_allow_server_php=superadmin
admin_allow_langedit=superadmin
admin_allow_new_admin=superadmin
admin_allow_del_cpuser=superadmin
admin_allow_cpuser_group=superadmin
admin_allow_firewall_config=superadmin
admin_allow_osupdate=superadmin
admin_allow_software_packages=superadmin
admin_allow_software_repo=superadmin
remote_api_allowed=yes
[systemcheck]
security_admin_email=root@localhost
warn_new_admin=yes
warn_passwd_change=no
warn_shadow_change=no
check_groups_in_passwd=yes
check_ispconfig_md5=yes
server/lib/classes/getconf.inc.php
@@ -59,6 +59,15 @@
        }
        return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
    }
    public function get_security_config($section = '') {
        global $app;
        $app->uses('ini_parser');
        $security_config = $app->ini_parser->parse_ini_string(file_get_contents('/usr/local/ispconfig/security/security_settings.ini'));
        return ($section == '') ? $security_config : $security_config[$section];
    }
}
server/plugins-available/shelluser_base_plugin.inc.php
@@ -58,19 +58,25 @@
        /*
        Register for the events
        */
        $app->plugins->registerEvent('shell_user_insert', $this->plugin_name, 'insert');
        $app->plugins->registerEvent('shell_user_update', $this->plugin_name, 'update');
        $app->plugins->registerEvent('shell_user_delete', $this->plugin_name, 'delete');
    }
    function insert($event_name, $data) {
        global $app, $conf;
        $app->uses('system');
        $app->uses('system,getconf');
        $security_config = $app->getconf->get_security_config('permissions');
        if($security_config['allow_shell_user'] != 'yes') {
            $app->log('Shell user plugin disabled by security settings.',LOGLEVEL_WARN);
            return false;
        }
        //* Check if the resulting path is inside the docroot
        $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
@@ -144,7 +150,13 @@
    function update($event_name, $data) {
        global $app, $conf;
        $app->uses('system');
        $app->uses('system,getconf');
        $security_config = $app->getconf->get_security_config('permissions');
        if($security_config['allow_shell_user'] != 'yes') {
            $app->log('Shell user plugin disabled by security settings.',LOGLEVEL_WARN);
            return false;
        }
        //* Check if the resulting path is inside the docroot
        $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
@@ -223,7 +235,13 @@
    function delete($event_name, $data) {
        global $app, $conf;
        $app->uses('system');
        $app->uses('system,getconf');
        $security_config = $app->getconf->get_security_config('permissions');
        if($security_config['allow_shell_user'] != 'yes') {
            $app->log('Shell user plugin disabled by security settings.',LOGLEVEL_WARN);
            return false;
        }
        if($app->system->is_user($data['old']['username'])) {
            // Get the UID of the user
server/plugins-available/shelluser_jailkit_plugin.inc.php
@@ -59,11 +59,11 @@
        /*
        Register for the events
        */
        $app->plugins->registerEvent('shell_user_insert', $this->plugin_name, 'insert');
        $app->plugins->registerEvent('shell_user_update', $this->plugin_name, 'update');
        $app->plugins->registerEvent('shell_user_delete', $this->plugin_name, 'delete');
    }
@@ -71,7 +71,15 @@
    function insert($event_name, $data) {
        global $app, $conf;
        $app->uses('system');
        $app->uses('system,getconf');
        $security_config = $app->getconf->get_security_config('permissions');
        if($security_config['allow_shell_user'] != 'yes') {
            $app->log('Shell user plugin disabled by security settings.',LOGLEVEL_WARN);
            return false;
        }
        $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$data['new']['parent_domain_id']);
        if(!$app->system->is_allowed_user($data['new']['username'], false, false)
@@ -143,7 +151,14 @@
    function update($event_name, $data) {
        global $app, $conf;
        $app->uses('system');
        $app->uses('system,getconf');
        $security_config = $app->getconf->get_security_config('permissions');
        if($security_config['allow_shell_user'] != 'yes') {
            $app->log('Shell user plugin disabled by security settings.',LOGLEVEL_WARN);
            return false;
        }
        $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$data['new']['parent_domain_id']);
        if(!$app->system->is_allowed_user($data['new']['username'], false, false)
@@ -209,7 +224,13 @@
    function delete($event_name, $data) {
        global $app, $conf;
        $app->uses('system');
        $app->uses('system,getconf');
        $security_config = $app->getconf->get_security_config('permissions');
        if($security_config['allow_shell_user'] != 'yes') {
            $app->log('Shell user plugin disabled by security settings.',LOGLEVEL_WARN);
            return false;
        }
        $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$data['old']['parent_domain_id']);