From dae3b41faee2777046b0b612e2bd8b28caf0f189 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 19 Jul 2012 04:07:53 -0400
Subject: [PATCH] Fixed a warning in cron log on non web servers.
---
server/plugins-available/shelluser_jailkit_plugin.inc.php | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php
index 86e92f6..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,12 +176,16 @@
//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']);
exec($command);
$app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome,LOGLEVEL_DEBUG);
}
+
+ $app->system->web_folder_protection($web['document_root'],true);
}
@@ -376,9 +391,9 @@
if(is_file('/root/.ssh/authorized_keys')) file_put_contents($sshkeys, file_get_contents('/root/.ssh/authorized_keys'));
// Remove duplicate keys
- $existing_keys = file($sshkeys);
+ $existing_keys = @file($sshkeys);
$new_keys = explode("\n", $userkey);
- $final_keys_arr = array_merge($existing_keys, $new_keys);
+ $final_keys_arr = @array_merge($existing_keys, $new_keys);
$new_final_keys_arr = array();
if(is_array($final_keys_arr) && !empty($final_keys_arr)){
foreach($final_keys_arr as $key => $val){
--
Gitblit v1.9.1