Преглед изворни кода

Editing crontab service is now in read-only mode.

Ssh should be used from now on to change this service
Robert Zollner пре 5 година
родитељ
комит
d4d9c84662
3 измењених фајлова са 2 додато и 54 уклоњено
  1. 0 2
      bin/v-change-sys-service-config
  2. 1 26
      web/edit/server/cron/index.php
  3. 1 26
      web/edit/server/crond/index.php

+ 0 - 2
bin/v-change-sys-service-config

@@ -68,8 +68,6 @@ case $service in
     spamd)          dst=$($BIN/v-list-sys-spamd-config plain);;
     spamd)          dst=$($BIN/v-list-sys-spamd-config plain);;
     spamassassin)   dst=$($BIN/v-list-sys-spamd-config plain);;
     spamassassin)   dst=$($BIN/v-list-sys-spamd-config plain);;
     clamd)          dst=$($BIN/v-list-sys-clamd-config plain);;
     clamd)          dst=$($BIN/v-list-sys-clamd-config plain);;
-    cron)           dst='/etc/crontab';;
-    crond)          dst='/etc/crontab';;
     fail2ban)       dst='/etc/fail2ban/jail.local';;
     fail2ban)       dst='/etc/fail2ban/jail.local';;
     ssh)            dst='/etc/ssh/sshd_config';;
     ssh)            dst='/etc/ssh/sshd_config';;
     *)              check_result $E_NOTEXIST "service $service doesn't exist"
     *)              check_result $E_NOTEXIST "service $service doesn't exist"

+ 1 - 26
web/edit/server/cron/index.php

@@ -14,33 +14,8 @@ if ($_SESSION['user'] != 'admin') {
 // Check POST request
 // Check POST request
 if (!empty($_POST['save'])) {
 if (!empty($_POST['save'])) {
 
 
-    // Check token
-    if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
-        header('location: /login/');
-        exit();
-    }
-
-    // Set restart flag
-    $v_restart = 'yes';
-    if (empty($_POST['v_restart'])) $v_restart = 'no';
-
-    // Update config
-    if (!empty($_POST['v_config'])) {
-        exec ('mktemp', $mktemp_output, $return_var);
-        $new_conf = $mktemp_output[0];
-        $fp = fopen($new_conf, 'w');
-        fwrite($fp, str_replace("\r\n", "\n",  $_POST['v_config']));
-        fclose($fp);
-        exec (HESTIA_CMD."v-change-sys-service-config ".$new_conf." cron ".$v_restart, $output, $return_var);
-        check_return_code($return_var,$output);
-        unset($output);
-        unlink($new_conf);
-    }
-
     // Set success message
     // Set success message
-    if (empty($_SESSION['error_msg'])) {
-        $_SESSION['ok_msg'] = __('Changes has been saved.');
-    }
+    $_SESSION['ok_msg'] = __('Info (Read-only mode): Crontab can be edited only trough ssh');
 
 
 }
 }
 
 

+ 1 - 26
web/edit/server/crond/index.php

@@ -14,33 +14,8 @@ if ($_SESSION['user'] != 'admin') {
 // Check POST request
 // Check POST request
 if (!empty($_POST['save'])) {
 if (!empty($_POST['save'])) {
 
 
-    // Check token
-    if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
-        header('location: /login/');
-        exit();
-    }
-
-    // Set restart flag
-    $v_restart = 'yes';
-    if (empty($_POST['v_restart'])) $v_restart = 'no';
-
-    // Update config
-    if (!empty($_POST['v_config'])) {
-        exec ('mktemp', $mktemp_output, $return_var);
-        $new_conf = $mktemp_output[0];
-        $fp = fopen($new_conf, 'w');
-        fwrite($fp, str_replace("\r\n", "\n",  $_POST['v_config']));
-        fclose($fp);
-        exec (HESTIA_CMD."v-change-sys-service-config ".$new_conf." crond ".$v_restart, $output, $return_var);
-        check_return_code($return_var,$output);
-        unset($output);
-        unlink($new_conf);
-    }
-
     // Set success message
     // Set success message
-    if (empty($_SESSION['error_msg'])) {
-        $_SESSION['ok_msg'] = __('Changes has been saved.');
-    }
+    $_SESSION['ok_msg'] = __('Info (Read-only mode): Crontab can be edited only trough ssh');
 
 
 }
 }