From 3a4834ee6dd098b1527fef43211fbf41b48c9f46 Mon Sep 17 00:00:00 2001 From: vogelor <vogelor@ispconfig3> Date: Mon, 26 Jan 2009 14:06:59 -0500 Subject: [PATCH] Fixed problem with suexec, cgi and openbasedir --- server/plugins-available/shelluser_jailkit_plugin.inc.php | 82 +++++++++++++++++++++++++---------------- 1 files changed, 50 insertions(+), 32 deletions(-) diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index db98da9..10217a4 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -70,22 +70,30 @@ function insert($event_name,$data) { global $app, $conf; - /** - * Setup Jailkit Chroot System If Enabled - */ - if ($data['new']['chroot'] == "jailkit") - { - // load the server configuration options - $app->uses("getconf"); - $this->data = $data; - $this->app = $app; - $this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit'); - - $this->_setup_jailkit_chroot(); - $this->_add_jailkit_user(); - } + $app->uses('system'); - $app->log("Jalikit Plugin -> insert username:".$data['new']['username'],LOGLEVEL_DEBUG); + if($app->system->is_user($data['new']['username'])) { + + /** + * Setup Jailkit Chroot System If Enabled + */ + if ($data['new']['chroot'] == "jailkit") + { + // load the server configuration options + $app->uses("getconf"); + $this->data = $data; + $this->app = $app; + $this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit'); + + $this->_setup_jailkit_chroot(); + $this->_add_jailkit_user(); + } + + $app->log("Jailkit Plugin -> insert username:".$data['new']['username'],LOGLEVEL_DEBUG); + + } else { + $app->log("Jailkit Plugin -> insert username:".$data['new']['username']." skipped, the user does not exist.",LOGLEVEL_WARN); + } } @@ -93,22 +101,30 @@ function update($event_name,$data) { global $app, $conf; - /** - * Setup Jailkit Chroot System If Enabled - */ - if ($data['new']['chroot'] == "jailkit") - { - // load the server configuration options - $app->uses("getconf"); - $this->data = $data; - $this->app = $app; - $this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit'); - - $this->_setup_jailkit_chroot(); - $this->_add_jailkit_user(); - } + $app->uses('system'); - $app->log("Jalikit Plugin -> update username:".$data['new']['username'],LOGLEVEL_DEBUG); + if($app->system->is_user($data['new']['username'])) { + + /** + * Setup Jailkit Chroot System If Enabled + */ + if ($data['new']['chroot'] == "jailkit") + { + // load the server configuration options + $app->uses("getconf"); + $this->data = $data; + $this->app = $app; + $this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit'); + + $this->_setup_jailkit_chroot(); + $this->_add_jailkit_user(); + } + + $app->log("Jailkit Plugin -> update username:".$data['new']['username'],LOGLEVEL_DEBUG); + + } else { + $app->log("Jailkit Plugin -> update username:".$data['new']['username']." skipped, the user does not exist.",LOGLEVEL_WARN); + } } @@ -118,6 +134,8 @@ */ function delete($event_name,$data) { global $app, $conf; + + $app->uses('system'); if ($data['old']['chroot'] == "jailkit") { @@ -130,10 +148,10 @@ //exec('rm -rf '.$data['old']['dir'].$jailkit_chroot_userhome); - $app->log("Jalikit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome,LOGLEVEL_DEBUG); + $app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome,LOGLEVEL_DEBUG); } - $app->log("Jalikit Plugin -> delete username:".$data['old']['username'],LOGLEVEL_DEBUG); + $app->log("Jailkit Plugin -> delete username:".$data['old']['username'],LOGLEVEL_DEBUG); } -- Gitblit v1.9.1