From e1ceb050e19c7574bca146a8da7047ee4ff456b5 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Sun, 10 Jul 2016 05:02:35 -0400
Subject: [PATCH] Merge branch 'stable-3.1'
---
server/plugins-available/shelluser_jailkit_plugin.inc.php | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php
index 4c400c7..16dbcc7 100755
--- a/server/plugins-available/shelluser_jailkit_plugin.inc.php
+++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php
@@ -245,13 +245,17 @@
//exec('rm -rf '.$data['old']['dir'].$jailkit_chroot_userhome);
$app->system->web_folder_protection($web['document_root'], false);
+
+ $userid = intval($app->system->getuid($data['old']['username']));
+ $command = 'killall -u '.escapeshellcmd($data['old']['username']).' ; ';
+ $command .= 'userdel -f '.escapeshellcmd($data['old']['username']).' &> /dev/null';
+ exec($command);
+
+ // Remove the jailed user from passwd and shadow file inside the jail
+ $app->system->removeLine($data['old']['dir'].'/etc/passwd', $data['old']['username']);
+ $app->system->removeLine($data['old']['dir'].'/etc/shadow', $data['old']['username']);
if(@is_dir($data['old']['dir'].$jailkit_chroot_userhome)) {
- $userid = intval($app->system->getuid($data['old']['username']));
- $command = 'killall -u '.escapeshellcmd($data['old']['username']).' ; userdel -f';
- $command .= ' '.escapeshellcmd($data['old']['username']).' &> /dev/null';
- exec($command);
-
$this->_delete_homedir($data['old']['dir'].$jailkit_chroot_userhome,$userid,$data['old']['parent_domain_id']);
$app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
@@ -386,7 +390,10 @@
}
}*/
- $app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
+ $shell = '/usr/sbin/jk_chrootsh';
+ if($this->data['new']['active'] != 'y') $shell = '/bin/false';
+
+ $app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, $shell);
$app->system->usermod($this->data['new']['puser'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
$this->app->log("Added jailkit user to chroot with command: ".$command, LOGLEVEL_DEBUG);
--
Gitblit v1.9.1