diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 4f7a02cf4df60d9a1b783a5ec28864b4be35a625..8c99d4ad00730bfb65ea68b7f3c84ccc93e5219a 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -3791,7 +3791,7 @@ class apache2_plugin { // add the user to the chroot $jailkit_chroot_userhome = $this->_get_home_dir($this->website['system_user']); - if(!is_dir($this->website['document_root'].'/etc')) mkdir($this->website['document_root'].'/etc'); + if(!is_dir($this->website['document_root'].'/etc')) $app->system->mkdir($this->website['document_root'].'/etc', 0755, true); if(!is_file($this->website['document_root'].'/etc/passwd')) $app->system->exec_safe('touch ?', $this->website['document_root'].'/etc/passwd'); // IMPORTANT! @@ -3800,9 +3800,11 @@ class apache2_plugin { // and the user has FULL ACCESS to the root of the server! $app->system->create_jailkit_user($this->website['system_user'], $this->website['document_root'], $jailkit_chroot_userhome); - $app->system->mkdir($this->website['document_root'].$jailkit_chroot_userhome, 0755, true); - $app->system->chown($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_user']); - $app->system->chgrp($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_group']); + if(!is_dir($this->website['document_root'].$jailkit_chroot_userhome)) { + $app->system->mkdir($this->website['document_root'].$jailkit_chroot_userhome, 0750, true); + $app->system->chown($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_user']); + $app->system->chgrp($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_group']); + } $app->log("Added created jailkit user home in : ".$this->website['document_root'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG); } diff --git a/server/plugins-available/cron_jailkit_plugin.inc.php b/server/plugins-available/cron_jailkit_plugin.inc.php index 576c363ae285efa02432570c18e97e072331456c..b8fa291f671c3ca06cdbd199bfa389250a843cfc 100644 --- a/server/plugins-available/cron_jailkit_plugin.inc.php +++ b/server/plugins-available/cron_jailkit_plugin.inc.php @@ -323,7 +323,7 @@ class cron_jailkit_plugin { // add the user to the chroot $jailkit_chroot_userhome = $this->_get_home_dir($this->parent_domain['system_user']); - if(!is_dir($this->parent_domain['document_root'].'/etc')) mkdir($this->parent_domain['document_root'].'/etc'); + if(!is_dir($this->parent_domain['document_root'].'/etc')) $app->system->mkdir($this->parent_domain['document_root'].'/etc', 0755, true); if(!is_file($this->parent_domain['document_root'].'/etc/passwd')) $app->system->exec_safe('touch ?', $this->parent_domain['document_root'].'/etc/passwd'); // IMPORTANT! @@ -332,9 +332,11 @@ class cron_jailkit_plugin { // and the user has FULL ACCESS to the root of the server! $app->system->create_jailkit_user($this->parent_domain['system_user'], $this->parent_domain['document_root'], $jailkit_chroot_userhome); - $app->system->mkdir($this->parent_domain['document_root'].$jailkit_chroot_userhome, 0755, true); - $app->system->chown($this->parent_domain['document_root'].$jailkit_chroot_userhome, $this->parent_domain['system_user']); - $app->system->chgrp($this->parent_domain['document_root'].$jailkit_chroot_userhome, $this->parent_domain['system_group']); + if(!is_dir($this->parent_domain['document_root'].$jailkit_chroot_userhome)) { + $app->system->mkdir($this->parent_domain['document_root'].$jailkit_chroot_userhome, 0750, true); + $app->system->chown($this->parent_domain['document_root'].$jailkit_chroot_userhome, $this->parent_domain['system_user']); + $app->system->chgrp($this->parent_domain['document_root'].$jailkit_chroot_userhome, $this->parent_domain['system_group']); + } } diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index cb991bcce403cf787efebfbb3455a0bcacc02183..4ee9b18a5d88e3d78e8d582cfb9d4f800e0f5910 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -3576,7 +3576,7 @@ class nginx_plugin { // add the user to the chroot $jailkit_chroot_userhome = $this->_get_home_dir($this->website['system_user']); - if(!is_dir($this->website['document_root'].'/etc')) mkdir($this->website['document_root'].'/etc'); + if(!is_dir($this->website['document_root'].'/etc')) $app->system->mkdir($this->website['document_root'].'/etc', 0755, true); if(!is_file($this->website['document_root'].'/etc/passwd')) $app->system->exec_safe('touch ?', $this->website['document_root'].'/etc/passwd'); // IMPORTANT! @@ -3585,10 +3585,11 @@ class nginx_plugin { // and the user has FULL ACCESS to the root of the server! $app->system->create_jailkit_user($this->website['system_user'], $this->website['document_root'], $jailkit_chroot_userhome); - $app->system->mkdir($this->website['document_root'].$jailkit_chroot_userhome, 0755, true); - $app->system->chown($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_user']); - $app->system->chgrp($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_group']); - + if(!is_dir($this->website['document_root'].$jailkit_chroot_userhome)) { + $app->system->mkdir($this->website['document_root'].$jailkit_chroot_userhome, 0750, true); + $app->system->chown($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_user']); + $app->system->chgrp($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_group']); + } $app->log("Added created jailkit user home in : ".$this->website['document_root'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG); } diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 57665abeeb80ca33ece6a68bc91f9334de7cb09e..9fe6337cd3fca8f0361efb2a0f2435e78ec8828c 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -398,7 +398,7 @@ class shelluser_jailkit_plugin { } $jailkit_chroot_puserhome = $this->_get_home_dir($this->data['new']['puser']); - if(!is_dir($this->data['new']['dir'].'/etc')) mkdir($this->data['new']['dir'].'/etc', 0755); + if(!is_dir($this->data['new']['dir'].'/etc')) $app->system->mkdir($this->data['new']['dir'].'/etc', 0755, true); if(!is_file($this->data['new']['dir'].'/etc/passwd')) touch($this->data['new']['dir'].'/etc/passwd', 0755); // IMPORTANT! @@ -417,7 +417,7 @@ class shelluser_jailkit_plugin { if(is_dir($this->data['old']['dir'].$jailkit_chroot_userhome_old)) { $app->system->rename($this->data['old']['dir'].$jailkit_chroot_userhome_old,$this->data['new']['dir'].$jailkit_chroot_userhome); } else { - mkdir($this->data['new']['dir'].$jailkit_chroot_userhome, 0750, true); + $app->system->mkdir($this->data['new']['dir'].$jailkit_chroot_userhome, 0750, true); } } $app->system->chown($this->data['new']['dir'].$jailkit_chroot_userhome, $this->data['new']['username']);