Skip to content

Commit 94d2cf4

Browse files
committed
- Make sure ISPConfig doesn't overwrite the system's motd file when creating a chrooted cron job.
1 parent aea3377 commit 94d2cf4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

server/plugins-available/cron_jailkit_plugin.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function _setup_jailkit_chroot()
236236
$tpl->setVar('home_dir',$this->_get_home_dir(""));
237237

238238
$bashrc = escapeshellcmd($this->parent_domain['document_root']).'/etc/bash.bashrc';
239-
if(@is_file($bashrc)) unlink($bashrc);
239+
if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
240240

241241
file_put_contents($bashrc,$tpl->grab());
242242
unset($tpl);
@@ -249,7 +249,7 @@ function _setup_jailkit_chroot()
249249
$tpl->setVar('domain',$this->parent_domain['domain']);
250250

251251
$motd = escapeshellcmd($this->parent_domain['document_root']).'/var/run/motd';
252-
if(@is_file($motd)) unlink($motd);
252+
if(@is_file($motd) || @is_link($motd)) unlink($motd);
253253

254254
file_put_contents($motd,$tpl->grab());
255255

server/plugins-available/shelluser_jailkit_plugin.inc.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,20 @@ function _setup_jailkit_chroot()
227227
$tpl->setVar('home_dir',$this->_get_home_dir(""));
228228

229229
$bashrc = escapeshellcmd($this->data['new']['dir']).'/etc/bash.bashrc';
230-
if(@is_file($bashrc)) unlink($bashrc);
230+
if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
231231

232232
file_put_contents($bashrc,$tpl->grab());
233233
unset($tpl);
234234

235-
$this->app->log("Added bashrc scrpt : ".$bashrc,LOGLEVEL_DEBUG);
235+
$this->app->log("Added bashrc script : ".$bashrc,LOGLEVEL_DEBUG);
236236

237237
$tpl = new tpl();
238238
$tpl->newTemplate("motd.master");
239239

240240
$tpl->setVar('domain',$web['domain']);
241241

242242
$motd = escapeshellcmd($this->data['new']['dir']).'/var/run/motd';
243-
if(@is_file($motd)) unlink($motd);
243+
if(@is_file($motd) || @is_link($motd)) unlink($motd);
244244

245245
file_put_contents($motd,$tpl->grab());
246246

0 commit comments

Comments
 (0)