Skip to content

Commit d4d9c84

Browse files
committed
Editing crontab service is now in read-only mode.
Ssh should be used from now on to change this service
1 parent ef7c623 commit d4d9c84

File tree

3 files changed

+2
-54
lines changed

3 files changed

+2
-54
lines changed

bin/v-change-sys-service-config

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ case $service in
6868
spamd) dst=$($BIN/v-list-sys-spamd-config plain);;
6969
spamassassin) dst=$($BIN/v-list-sys-spamd-config plain);;
7070
clamd) dst=$($BIN/v-list-sys-clamd-config plain);;
71-
cron) dst='/etc/crontab';;
72-
crond) dst='/etc/crontab';;
7371
fail2ban) dst='/etc/fail2ban/jail.local';;
7472
ssh) dst='/etc/ssh/sshd_config';;
7573
*) check_result $E_NOTEXIST "service $service doesn't exist"

web/edit/server/cron/index.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,8 @@
1414
// Check POST request
1515
if (!empty($_POST['save'])) {
1616

17-
// Check token
18-
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
19-
header('location: /login/');
20-
exit();
21-
}
22-
23-
// Set restart flag
24-
$v_restart = 'yes';
25-
if (empty($_POST['v_restart'])) $v_restart = 'no';
26-
27-
// Update config
28-
if (!empty($_POST['v_config'])) {
29-
exec ('mktemp', $mktemp_output, $return_var);
30-
$new_conf = $mktemp_output[0];
31-
$fp = fopen($new_conf, 'w');
32-
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_config']));
33-
fclose($fp);
34-
exec (HESTIA_CMD."v-change-sys-service-config ".$new_conf." cron ".$v_restart, $output, $return_var);
35-
check_return_code($return_var,$output);
36-
unset($output);
37-
unlink($new_conf);
38-
}
39-
4017
// Set success message
41-
if (empty($_SESSION['error_msg'])) {
42-
$_SESSION['ok_msg'] = __('Changes has been saved.');
43-
}
18+
$_SESSION['ok_msg'] = __('Info (Read-only mode): Crontab can be edited only trough ssh');
4419

4520
}
4621

web/edit/server/crond/index.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,8 @@
1414
// Check POST request
1515
if (!empty($_POST['save'])) {
1616

17-
// Check token
18-
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
19-
header('location: /login/');
20-
exit();
21-
}
22-
23-
// Set restart flag
24-
$v_restart = 'yes';
25-
if (empty($_POST['v_restart'])) $v_restart = 'no';
26-
27-
// Update config
28-
if (!empty($_POST['v_config'])) {
29-
exec ('mktemp', $mktemp_output, $return_var);
30-
$new_conf = $mktemp_output[0];
31-
$fp = fopen($new_conf, 'w');
32-
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_config']));
33-
fclose($fp);
34-
exec (HESTIA_CMD."v-change-sys-service-config ".$new_conf." crond ".$v_restart, $output, $return_var);
35-
check_return_code($return_var,$output);
36-
unset($output);
37-
unlink($new_conf);
38-
}
39-
4017
// Set success message
41-
if (empty($_SESSION['error_msg'])) {
42-
$_SESSION['ok_msg'] = __('Changes has been saved.');
43-
}
18+
$_SESSION['ok_msg'] = __('Info (Read-only mode): Crontab can be edited only trough ssh');
4419

4520
}
4621

0 commit comments

Comments
 (0)