From 4b9329a0f204c190f9cae6c072c9827d05d269e6 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 08 Jun 2012 08:06:41 -0400
Subject: [PATCH] Implemented: FS#2112 - Set u / i attributes on system web folders This option can be enabled under System > Server config and is named "Web folder protection".
---
server/plugins-available/shelluser_jailkit_plugin.inc.php | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php
index 671ae62..6ffe8e8 100755
--- a/server/plugins-available/shelluser_jailkit_plugin.inc.php
+++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php
@@ -71,6 +71,7 @@
global $app, $conf;
$app->uses('system');
+ $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['new']['parent_domain_id']);
if($app->system->is_user($data['new']['username'])) {
@@ -79,6 +80,8 @@
*/
if ($data['new']['chroot'] == "jailkit")
{
+ $app->system->web_folder_protection($web['document_root'],false);
+
// load the server configuration options
$app->uses("getconf");
$this->data = $data;
@@ -98,6 +101,7 @@
exec($command);
$this->_update_website_security_level();
+ $app->system->web_folder_protection($web['document_root'],true);
}
$app->log("Jailkit Plugin -> insert username:".$data['new']['username'],LOGLEVEL_DEBUG);
@@ -113,6 +117,7 @@
global $app, $conf;
$app->uses('system');
+ $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['new']['parent_domain_id']);
if($app->system->is_user($data['new']['username'])) {
@@ -121,6 +126,8 @@
*/
if ($data['new']['chroot'] == "jailkit")
{
+ $app->system->web_folder_protection($web['document_root'],false);
+
// load the server configuration options
$app->uses("getconf");
$this->data = $data;
@@ -136,6 +143,8 @@
$this->_setup_ssh_rsa();
$this->_update_website_security_level();
+
+ $app->system->web_folder_protection($web['document_root'],true);
}
$app->log("Jailkit Plugin -> update username:".$data['new']['username'],LOGLEVEL_DEBUG);
@@ -155,6 +164,8 @@
$app->uses('system');
+ $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['old']['parent_domain_id']);
+
if ($data['old']['chroot'] == "jailkit")
{
$app->uses("getconf");
@@ -165,6 +176,8 @@
//commented out proved to be dangerous on config errors
//exec('rm -rf '.$data['old']['dir'].$jailkit_chroot_userhome);
+ $app->system->web_folder_protection($web['document_root'],false);
+
if(@is_dir($data['old']['dir'].$jailkit_chroot_userhome)) {
$command = 'userdel -f';
$command .= ' '.escapeshellcmd($data['old']['username']);
@@ -172,6 +185,8 @@
$app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome,LOGLEVEL_DEBUG);
}
+ $app->system->web_folder_protection($web['document_root'],true);
+
}
$app->log("Jailkit Plugin -> delete username:".$data['old']['username'],LOGLEVEL_DEBUG);
--
Gitblit v1.9.1