Skip to content

Commit 8d7409c

Browse files
committed
create /var/run inside jail
1 parent ee79725 commit 8d7409c

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

server/lib/classes/system.inc.php

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,14 +2324,24 @@ public function create_jailkit_chroot($home_dir, $app_sections = array(), $optio
23242324
$cmd = 'jk_init' . $program_args;
23252325
$this->exec_safe($cmd, $home_dir);
23262326

2327-
// Create the temp directory
2327+
// Create the tmp and /var/run directories
23282328
if(!is_dir($home_dir . '/tmp')) {
23292329
$this->mkdirpath($home_dir . '/tmp', 0770);
23302330
} else {
23312331
$this->chmod($home_dir . '/tmp', 0770, true);
23322332
}
2333+
if(!is_dir($home_dir . '/var/run')) {
2334+
$this->mkdirpath($home_dir . '/var/run', 0755);
2335+
} else {
2336+
$this->chmod($home_dir . '/var/run', 0755, true);
2337+
}
2338+
if(!is_dir($home_dir . '/var/tmp')) {
2339+
$this->mkdirpath($home_dir . '/var/tmp', 0770);
2340+
} else {
2341+
$this->chmod($home_dir . '/var/tmp', 0770, true);
2342+
}
23332343

2334-
// Fix permissions of the root firectory
2344+
// Fix permissions of the root directory
23352345
$this->chmod($home_dir . '/bin', 0755, true); // was chmod g-w $CHROOT_HOMEDIR/bin
23362346

23372347
return true;
@@ -2540,12 +2550,28 @@ public function update_jailkit_chroot($home_dir, $sections = array(), $programs
25402550
$this->create_jailkit_programs($home_dir, $programs, $opts);
25412551
}
25422552

2543-
// Create the temp directory
2553+
// Create the tmp and /var/run directories
25442554
if(!is_dir($home_dir . '/tmp')) {
25452555
$this->mkdirpath($home_dir . '/tmp', 0770);
25462556
} else {
25472557
$this->chmod($home_dir . '/tmp', 0770, true);
25482558
}
2559+
if(!is_dir($home_dir . '/var/run')) {
2560+
$this->mkdirpath($home_dir . '/var/run', 0755);
2561+
} else {
2562+
$this->chmod($home_dir . '/var/run', 0755, true);
2563+
}
2564+
if(!is_dir($home_dir . '/var/tmp')) {
2565+
$this->mkdirpath($home_dir . '/var/tmp', 0770);
2566+
} else {
2567+
$this->chmod($home_dir . '/var/tmp', 0770, true);
2568+
}
2569+
2570+
// TODO: Set /usr/bin/php symlink to php version of the website.
2571+
//
2572+
// Currently server_php does not have a field for the cli path;
2573+
// we can guess/determing according to OS-specific conventions or add that field.
2574+
// Then symlink /usr/bin/php (or correct OS-specific path) to that location.
25492575

25502576
// search for any hardlinked files which are now missing
25512577
if (!(in_array('hardlink', $opts) || in_array('allow_hardlink', $options))) {

0 commit comments

Comments
 (0)