From 9edea9976bd605071e0694a90d704266c0b7e0f9 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Thu, 14 Aug 2014 11:30:03 -0400
Subject: [PATCH] - 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.
---
interface/lib/classes/auth.inc.php | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php
index 706dd04..70c1722 100644
--- a/interface/lib/classes/auth.inc.php
+++ b/interface/lib/classes/auth.inc.php
@@ -44,13 +44,21 @@
return false;
}
}
+
+ public function is_superadmin() {
+ if($_SESSION['s']['user']['typ'] == 'admin' && $_SESSION['s']['user']['userid'] == 1) {
+ return true;
+ } else {
+ return false;
+ }
+ }
public function has_clients($userid) {
global $app, $conf;
$userid = $app->functions->intval($userid);
$client = $app->db->queryOneRecord("SELECT client.limit_client FROM sys_user, client WHERE sys_user.userid = $userid AND sys_user.client_id = client.client_id");
- if($client['limit_client'] > 0) {
+ if($client['limit_client'] != 0) {
return true;
} else {
return false;
@@ -83,6 +91,7 @@
global $app;
$userid = $app->functions->intval($userid);
+ if(!preg_match('/^[a-zA-Z0-9\-\_]{1,64}$/',$limitname)) $app->error('Invalid limit name '.$limitname);
// simple query cache
if($this->client_limits===null)
@@ -120,12 +129,29 @@
public function check_module_permissions($module) {
// Check if the current user has the permissions to access this module
- if(!stristr($_SESSION["s"]["user"]["modules"], $module)) {
+ $user_modules = explode(',',$_SESSION["s"]["user"]["modules"]);
+ if(!in_array($module,$user_modules)) {
// echo "LOGIN_REDIRECT:/index.php";
header("Location: /index.php");
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+/';
--
Gitblit v1.9.1