Skip to content

Commit d08971e

Browse files
committed
Removed _setup_php_jailkit from cronjob_jailkit, as it is not mandatory for the user that runs the webspace to have an all set-up profile directory.
1 parent eea5b6a commit d08971e

File tree

1 file changed

+0
-85
lines changed

1 file changed

+0
-85
lines changed

server/plugins-available/cron_jailkit_plugin.inc.php

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ function insert($event_name, $data) {
137137

138138
$this->_add_jailkit_user();
139139

140-
$this->_setup_php_jailkit();
141-
142140
$command = 'usermod -U ? 2>/dev/null';
143141
$app->system->exec_safe($command, $parent_domain["system_user"]);
144142

@@ -221,8 +219,6 @@ function update($event_name, $data) {
221219

222220
$this->_add_jailkit_user();
223221

224-
//$this->_setup_php_jailkit();
225-
226222
$this->_update_website_security_level();
227223

228224
$app->system->web_folder_protection($parent_domain['document_root'], true);
@@ -392,87 +388,6 @@ function _update_website_security_level() {
392388
}
393389
}
394390

395-
function _setup_php_jailkit() {
396-
global $app;
397-
398-
// Create .bashrc file
399-
$app->load('tpl');
400-
401-
$tpl = new tpl();
402-
403-
$os_type = $app->system->get_os_type();
404-
if (isset($os_type['type'])) {
405-
$used_os_type = $os_type['type'];
406-
} else {
407-
$used_os_type = 'unknown';
408-
}
409-
410-
if($used_os_type == "debian" || $used_os_type == "ubuntu") {
411-
$tpl->newTemplate("bashrc_user_deb.master");
412-
} elseif($used_os_type == "redhat") {
413-
$tpl->newTemplate("bashrc_user_redhat.master");
414-
} else {
415-
$tpl->newTemplate("bashrc_user_generic.master");
416-
}
417-
418-
// Predefine some template vars
419-
$tpl->setVar('jailkit_chroot', 'y');
420-
$tpl->setVar('domain', $this->parent_domain['domain']);
421-
$tpl->setVar('home_dir', $this->_get_home_dir(""));
422-
$tpl->setVar('use_php_path', false);
423-
424-
425-
if(($this->parent_domain['server_php_id'] > 0) && !empty($this->parent_domain['php_cli_binary'])) {
426-
$php_bin_dir = dirname($this->parent_domain['php_cli_binary']);
427-
$alternatives_php = $this->parent_domain['document_root'] . '/etc/alternatives/php';
428-
429-
if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) {
430-
$tpl->setVar('use_php_path', false);
431-
} else {
432-
$tpl->setVar('use_php_path', true);
433-
$tpl->setVar('php_bin_dir', $php_bin_dir);
434-
}
435-
436-
if(!file_exists($this->parent_domain['document_root'] . '/' . $this->parent_domain['php_cli_binary'])) {
437-
$app->log("The PHP cli binary " . $this->parent_domain['php_cli_binary'] . " is not available in the jail of the web " . $this->parent_domain['domain'] . " / cronjob_id: " . $this->data['new']['id'] . ". Check your Jailkit setup!", LOGLEVEL_DEBUG);
438-
$tpl->setVar('use_php_path', false);
439-
440-
if(!empty($app->system->get_newest_php_bin($this->parent_domain['document_root'] . $php_bin_dir))) {
441-
$fallback_php = $app->system->get_newest_php_bin($this->parent_domain['document_root'] . $php_bin_dir);
442-
$fallback_php_bin = str_replace($this->parent_domain['document_root'], '', $fallback_php);
443-
444-
if(!empty($fallback_php) && file_exists($fallback_php_bin)) {
445-
if(is_link($alternatives_php) || is_file($alternatives_php) || !file_exists($alternatives_php)) {
446-
unlink($alternatives_php);
447-
symlink($fallback_php_bin, $alternatives_php);
448-
$app->log("Found " . $fallback_php_bin . " as a fallback for alternatives/php in the jail of ". $this->parent_domain['domain'], LOGLEVEL_DEBUG);
449-
}
450-
}
451-
}
452-
} else {
453-
if($used_os_type == "debian" || $used_os_type == "ubuntu") {
454-
if(is_link($alternatives_php) || is_file($alternatives_php) || !file_exists($alternatives_php))
455-
{
456-
unlink($alternatives_php);
457-
symlink($this->parent_domain['php_cli_binary'], $alternatives_php);
458-
} else {
459-
symlink($this->parent_domain['php_cli_binary'], $alternatives_php);
460-
}
461-
}
462-
}
463-
}
464-
465-
$bashrc = $this->parent_domain['document_root'] . '/home/' .$this->parent_domain['system_user'] . '/.bashrc';
466-
467-
if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
468-
file_put_contents($bashrc, $tpl->grab());
469-
$app->log("Added bashrc script: " . $bashrc, LOGLEVEL_DEBUG);
470-
471-
unset($tpl);
472-
473-
}
474-
475-
476391
private function _delete_jailkit_if_unused($parent_domain_id) {
477392
global $app, $conf;
478393

0 commit comments

Comments
 (0)