diff --git a/src/Model/model.php b/src/Model/model.php index e637980a..47e6e17d 100644 --- a/src/Model/model.php +++ b/src/Model/model.php @@ -280,7 +280,8 @@ function __construct() ), 'GetModuleStatus' => array( - 'argv' => array(), + // Trailing comma to avoid syntax error + 'argv' => array(BOOL,), 'desc' => _('Get module status'), ), @@ -2770,7 +2771,7 @@ function GetServiceStatus($get_info= 0, $start= '10min', $interval_changed= 0) $model= new $Models[$name](); // Do not cache module status individually here, we accumulate and cache them all in status.json below - $module_status= $model->_getModuleStatus($DashboardIntervals2Seconds[$start], FALSE); + $module_status= $model->_getModuleStatus($DashboardIntervals2Seconds[$start], 1, 0); if ($module_status !== FALSE) { $status[$name]= $module_status; } @@ -2814,19 +2815,19 @@ function getCachedContents($filename, &$contents) return FALSE; } - function GetModuleStatus() + function GetModuleStatus($generate_status) { global $StatusCheckInterval; - return Output(json_encode($this->_getModuleStatus($StatusCheckInterval))); + return Output(json_encode($this->_getModuleStatus($StatusCheckInterval, $generate_status))); } - function _getModuleStatus($start, $do_cache= TRUE) + function _getModuleStatus($start, $generate_status, $do_cache= 1) { $status= array(); - $cache= "{$this->UTMFWDIR}/cache/{$this->CollectdName}_status.json"; + $cache= "{$this->UTMFWDIR}/cache/{$this->Name}_status.json"; - if (!$this->getCachedContents($cache, $status)) { + if ($generate_status || !$this->getCachedContents($cache, $status)) { $runStatus= $this->IsRunning() ? 'R' : 'S'; $status= array( diff --git a/src/Model/snortinline.php b/src/Model/snortinline.php index 106ad660..0c794370 100644 --- a/src/Model/snortinline.php +++ b/src/Model/snortinline.php @@ -87,10 +87,10 @@ function FindPid() */ function IsRunning($proc= '') { - $re= "\/usr\/local\/bin\/snort\s+[^\n]*-Q\s+[^\n]*"; + $re= "/usr/local/bin/snort\s+[^\n]*-Q\s+[^\n]*"; $output= $this->RunShellCommand('/bin/ps arwwx -U_snort'); - if (preg_match("/$re/m", $output)) { + if (preg_match("|$re|m", $output)) { return TRUE; } return FALSE; diff --git a/src/View/clamav/info.php b/src/View/clamav/info.php index ff86a973..e2cc7497 100644 --- a/src/View/clamav/info.php +++ b/src/View/clamav/info.php @@ -20,17 +20,17 @@ require_once('clamd.php'); $Clamd= $View; -$Clamd->ProcessStartStopRequests(); +$generate_clamd_status= $Clamd->ProcessStartStopRequests(); require_once('freshclam.php'); $Freshclam= $View; -$Freshclam->ProcessStartStopRequests(); +$generate_freshclam_status= $Freshclam->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$Clamd->PrintStatusForm(); -$Freshclam->PrintStatusForm(); +$Clamd->PrintStatusForm($generate_clamd_status); +$Freshclam->PrintStatusForm($generate_freshclam_status); PrintHelpWindow(_HELPWINDOW('UTMFW uses ClamAV for all virus scanning purposes. Freshclam checks and updates ClamAV virus database periodically. By default, the database is updated every hour. You may not be able to stop or restart freshclam instance once it starts the update process; wait for a minute and try again.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/dante/info.php b/src/View/dante/info.php index 223edcd2..2ba460e4 100644 --- a/src/View/dante/info.php +++ b/src/View/dante/info.php @@ -20,12 +20,12 @@ require_once('include.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(PRINT_COUNT); +$View->PrintStatusForm($generate_status, PRINT_COUNT); PrintHelpWindow(_HELPWINDOW('SOCKS proxy is used by clients which support SOCKS protocol, such as file sharing applications. If you do not plan on providing support for SOCKS-enabled applications, you can stop this proxy. Some client applications fail to use the SOCKS proxy fully, even if they are configured correctly. Check the packet filter logs for blocked packets.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/dhcpd/dhcpd.php b/src/View/dhcpd/dhcpd.php index d666166d..b52c734f 100644 --- a/src/View/dhcpd/dhcpd.php +++ b/src/View/dhcpd/dhcpd.php @@ -22,12 +22,12 @@ * Info, arp output, and list of leases. */ -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); ?> ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status, PRINT_COUNT); PrintHelpWindow(_HELPWINDOW('The DNS forwarder sends all queries to the name servers in /etc/resolv.conf.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/e2guardian/info.php b/src/View/e2guardian/info.php index 3bdf52aa..66617c47 100644 --- a/src/View/e2guardian/info.php +++ b/src/View/e2guardian/info.php @@ -20,12 +20,12 @@ require_once('e2guardian.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); PrintHelpWindow(_HELPWINDOW('The web filter runs multithreaded. The maximum number of web filter threads can be adjusted on the configuration pages. diff --git a/src/View/ftp-proxy/info.php b/src/View/ftp-proxy/info.php index 3867c383..b7127de0 100644 --- a/src/View/ftp-proxy/info.php +++ b/src/View/ftp-proxy/info.php @@ -20,12 +20,12 @@ require_once('include.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); PrintHelpWindow(_HELPWINDOW('Internal clients connect to FTP servers on the external network via this FTP proxy. Since FTP protocol makes use of ports other than the ftp ports, allowing requests to ftp ports only is not enough. You need to run an FTP proxy.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/httpd/info.php b/src/View/httpd/info.php index be1f2207..f9386ecf 100644 --- a/src/View/httpd/info.php +++ b/src/View/httpd/info.php @@ -20,12 +20,12 @@ require_once('httpd.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(PRINT_COUNT); +$View->PrintStatusForm($generate_status, PRINT_COUNT); PrintHelpWindow(_HELPWINDOW('This web administration interface is served by OpenBSD/httpd. If you stop the web server, you will lose your connection to this web interface. You can restart it on the command line.')); require_once($VIEW_PATH.'/footer.php'); ?> diff --git a/src/View/imspector/info.php b/src/View/imspector/info.php index 320f0723..9bf94616 100644 --- a/src/View/imspector/info.php +++ b/src/View/imspector/info.php @@ -20,12 +20,12 @@ require_once('imspector.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); PrintHelpWindow(_HELPWINDOW('IMSpector supports MSN, ICQ/AIM, Yahoo, and IRC protocols. IM Proxy can log all messages exchanged in text conversations.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/lib/view.php b/src/View/lib/view.php index 33a23c0b..38537e0c 100644 --- a/src/View/lib/view.php +++ b/src/View/lib/view.php @@ -271,30 +271,39 @@ function Start() */ function ProcessStartStopRequests() { + $generate_status= 0; + if (filter_has_var(INPUT_POST, 'Model')) { if (filter_input(INPUT_POST, 'Model') == $this->Model) { if (filter_has_var(INPUT_POST, 'Start')) { $this->Restart(); + $generate_status= 1; } else if (filter_has_var(INPUT_POST, 'Stop')) { $this->Stop(); + $generate_status= 1; } } } $this->Controller($Output, 'GetStatus'); + + return $generate_status; } /** * Displays module status, software version, Restart/Stop buttons, and process table. * + * @param boolean $generate_status Force generate module status, do not use cached status, necessary after process start/stop * @param boolean $printcount Whether to print number of running processes too * @param boolean $showbuttons Show Start/Stop buttons + * @param boolean $printprocs Whether to print the process table + * @param boolean $showrestartbutton Show Restart button, for System Info page */ - function PrintStatusForm($printcount= FALSE, $showbuttons= TRUE, $printprocs= TRUE, $showrestartbutton= FALSE) + function PrintStatusForm($generate_status= 0, $printcount= FALSE, $showbuttons= TRUE, $printprocs= TRUE, $showrestartbutton= FALSE) { global $IMG_PATH, $ADMIN, $Status2Images, $StatusTitles; - $this->Controller($output, 'GetModuleStatus'); + $this->Controller($output, 'GetModuleStatus', $generate_status); $status= json_decode($output[0], TRUE); diff --git a/src/View/locale/en_EN/LC_MESSAGES/utmfw.po b/src/View/locale/en_EN/LC_MESSAGES/utmfw.po index 964df63b..ef94b6da 100644 --- a/src/View/locale/en_EN/LC_MESSAGES/utmfw.po +++ b/src/View/locale/en_EN/LC_MESSAGES/utmfw.po @@ -7228,6 +7228,9 @@ msgstr "" msgid "You should select at least one interface to start IDS for" msgstr "" +msgid "You should select at least one interface to stop IDS for" +msgstr "" + msgid "" "You should take into account that there may be computers with static IP " "addresses or using BOOTP protocol, and choose a range accordingly." diff --git a/src/View/locale/en_EN/LC_MESSAGES/utmfw_NOTICE.po b/src/View/locale/en_EN/LC_MESSAGES/utmfw_NOTICE.po index 80cbb24b..f3ba54f4 100644 --- a/src/View/locale/en_EN/LC_MESSAGES/utmfw_NOTICE.po +++ b/src/View/locale/en_EN/LC_MESSAGES/utmfw_NOTICE.po @@ -207,6 +207,9 @@ msgstr "" msgid "You should select at least one interface to start IDS for" msgstr "" +msgid "You should select at least one interface to stop IDS for" +msgstr "" + msgid "delete" msgstr "" diff --git a/src/View/locale/tr_TR/LC_MESSAGES/utmfw.po b/src/View/locale/tr_TR/LC_MESSAGES/utmfw.po index 7d2bde2b..2f42db64 100644 --- a/src/View/locale/tr_TR/LC_MESSAGES/utmfw.po +++ b/src/View/locale/tr_TR/LC_MESSAGES/utmfw.po @@ -8524,6 +8524,9 @@ msgstr "Süreci başlatmak için en az bir conf dosyası seçmelisiniz" msgid "You should select at least one interface to start IDS for" msgstr "STS'yi başlatmak için en az bir ağ arayüzü seçmelisiniz" +msgid "You should select at least one interface to stop IDS for" +msgstr "STS'yi durdurmak için en az bir ağ arayüzü seçmelisiniz" + msgid "" "You should take into account that there may be computers with static IP " "addresses or using BOOTP protocol, and choose a range accordingly." diff --git a/src/View/locale/tr_TR/LC_MESSAGES/utmfw_NOTICE.po b/src/View/locale/tr_TR/LC_MESSAGES/utmfw_NOTICE.po index a9b1bd21..e5c4e5cf 100644 --- a/src/View/locale/tr_TR/LC_MESSAGES/utmfw_NOTICE.po +++ b/src/View/locale/tr_TR/LC_MESSAGES/utmfw_NOTICE.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: UTMFW 6.9\n" "Report-Msgid-Bugs-To: sonertari@gmail.com\n" "POT-Creation-Date: 2009-11-11 16:21+0200\n" -"PO-Revision-Date: 2021-08-07 18:04+0300\n" +"PO-Revision-Date: 2021-08-12 17:05+0300\n" "Last-Translator: Soner Tari \n" "Language: tr\n" "Language-Team: Turkish <>\n" @@ -231,6 +231,9 @@ msgstr "Süreci başlatmak için en az bir conf dosyası seçmelisiniz" msgid "You should select at least one interface to start IDS for" msgstr "STS'yi başlatmak için en az bir ağ arayüzü seçmelisiniz" +msgid "You should select at least one interface to stop IDS for" +msgstr "STS'yi durdurmak için en az bir ağ arayüzü seçmelisiniz" + msgid "delete" msgstr "silmek" diff --git a/src/View/monitoring/info.php b/src/View/monitoring/info.php index 651894ed..c972d010 100644 --- a/src/View/monitoring/info.php +++ b/src/View/monitoring/info.php @@ -21,28 +21,28 @@ require_once('include.php'); $View->Model= 'symon'; -$View->ProcessStartStopRequests(); +$generate_symon_status= $View->ProcessStartStopRequests(); $View->Model= 'symux'; -$View->ProcessStartStopRequests(); +$generate_symux_status= $View->ProcessStartStopRequests(); $View->Model= 'pmacct'; -$View->ProcessStartStopRequests(); +$generate_pmacct_status= $View->ProcessStartStopRequests(); $View->Model= 'collectd'; -$View->ProcessStartStopRequests(); +$generate_collectd_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); $View->Model= 'symon'; -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_symon_status); $View->Model= 'symux'; $View->Caption= 'Symux'; -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_symux_status); $View->Model= 'pmacct'; $View->Caption= 'Pmacct'; -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_pmacct_status); $View->Model= 'collectd'; $View->Caption= 'Collectd'; -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_collectd_status); PrintHelpWindow(_HELPWINDOW('Graphs on this web user interface are generated by these monitoring processes. Settings of these software are handled by automatic configuration.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/openssh/info.php b/src/View/openssh/info.php index 89791b33..7d3649f1 100644 --- a/src/View/openssh/info.php +++ b/src/View/openssh/info.php @@ -20,12 +20,12 @@ require_once('include.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); PrintHelpWindow(_HELPWINDOW('OpenSSH is the de-facto standard secure shell. If you stop OpenSSH, you cannot establish shell connections to the system remotely.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/openvpn/info.php b/src/View/openvpn/info.php index 605d3000..9bf173e3 100644 --- a/src/View/openvpn/info.php +++ b/src/View/openvpn/info.php @@ -49,11 +49,14 @@ function PrintConfStartStopForm() } } +$generate_status= 0; + if (filter_has_var(INPUT_POST, 'Start')) { if (filter_has_var(INPUT_POST, 'ConfFiles')) { foreach ($_POST['ConfFiles'] as $file) { $View->Controller($Output, 'RestartInstance', $file); } + $generate_status= 1; } else { PrintHelpWindow(_NOTICE('FAILED').': '._NOTICE('You should select at least one conf file to start the process'), 'auto', 'ERROR'); @@ -69,6 +72,7 @@ function PrintConfStartStopForm() // Snort inline IPS $View->Stop(); } + $generate_status= 1; } $View->Controller($Output, 'GetStatus'); @@ -76,7 +80,7 @@ function PrintConfStartStopForm() $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(FALSE, FALSE); +$View->PrintStatusForm($generate_status, FALSE, FALSE); PrintConfStartStopForm(); PrintHelpWindow(_HELPWINDOW('OpenVPN is a virtual private networking solution based on OpenSSL. You should create different configuration for servers and clients, and start OpenVPN accordingly.')); diff --git a/src/View/p3scan/info.php b/src/View/p3scan/info.php index a5e41c66..36d7dfb2 100644 --- a/src/View/p3scan/info.php +++ b/src/View/p3scan/info.php @@ -20,12 +20,12 @@ require_once('include.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); PrintHelpWindow(_HELPWINDOW('POP3 proxy is used to scan incoming e-mails for viruses and spam. Make sure virus and spam scanners are running before starting this proxy.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/pf/info.pf.php b/src/View/pf/info.pf.php index c2bda722..660f81ec 100644 --- a/src/View/pf/info.pf.php +++ b/src/View/pf/info.pf.php @@ -20,7 +20,7 @@ require_once('pf.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $View->Controller($Output, 'GetPfInfo'); $PfInfo= implode("\n", $Output); @@ -34,7 +34,7 @@ $Reload= TRUE; require_once($VIEW_PATH . '/header.php'); -$View->PrintStatusForm(FALSE, TRUE, FALSE); +$View->PrintStatusForm($generate_status, FALSE, TRUE, FALSE); ?> diff --git a/src/View/smtp-gated/info.php b/src/View/smtp-gated/info.php index 58dd842d..ee11e9ad 100644 --- a/src/View/smtp-gated/info.php +++ b/src/View/smtp-gated/info.php @@ -20,12 +20,12 @@ require_once('include.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); PrintHelpWindow(_HELPWINDOW('SMTP proxy is used to scan outgoing e-mails for viruses and spam. Make sure virus and spam scanners are running before starting this proxy.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/snort/info.php b/src/View/snort/info.php index 4a3f458c..31d1df9b 100644 --- a/src/View/snort/info.php +++ b/src/View/snort/info.php @@ -20,6 +20,8 @@ require_once('snort.php'); +$generate_snort_status= 0; + if (filter_has_var(INPUT_POST, 'Model')) { if (filter_input(INPUT_POST, 'Model') == $View->Model) { if (filter_has_var(INPUT_POST, 'Start')) { @@ -28,6 +30,7 @@ $View->Controller($Output, 'StopInstance', $If); $View->Controller($Output, 'StartInstance', $If); } + $generate_snort_status= 1; } else { PrintHelpWindow(_NOTICE('FAILED').': '._NOTICE('You should select at least one interface to start IDS for'), 'auto', 'ERROR'); @@ -38,9 +41,10 @@ foreach ($_POST['Interfaces'] as $If) { $View->Controller($Output, 'StopInstance', $If); } + $generate_snort_status= 1; } else { - $View->Stop(); + PrintHelpWindow(_NOTICE('FAILED').': '._NOTICE('You should select at least one interface to stop IDS for'), 'auto', 'ERROR'); } } } @@ -49,19 +53,19 @@ $View->Controller($Output, 'GetStatus'); $View->Model= 'snortinline'; -$View->ProcessStartStopRequests(); +$generate_snortinline_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); $View->Model= 'snort'; $View->Caption= _('Intrusion Detection'); -$View->PrintStatusForm(FALSE, FALSE); +$View->PrintStatusForm($generate_snort_status, FALSE, FALSE); $View->PrintInterfaceSelectForm(); $View->Model= 'snortinline'; $View->Caption= _TITLE('Inline Intrusion Prevention'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_snortinline_status); PrintHelpWindow(_HELPWINDOW('You can run multiple Intrusion Detection processes, one for each network interface. The IDS listens to such interfaces in promiscuous mode. diff --git a/src/View/snortips/info.php b/src/View/snortips/info.php index 76896e01..d2f0d315 100644 --- a/src/View/snortips/info.php +++ b/src/View/snortips/info.php @@ -20,7 +20,7 @@ require_once('include.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); if (count($_POST)) { if (filter_has_var(INPUT_POST, 'UnblockAll')) { @@ -37,7 +37,7 @@ $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); ?>
diff --git a/src/View/spamassassin/info.php b/src/View/spamassassin/info.php index 5f7f08c6..a787dd30 100644 --- a/src/View/spamassassin/info.php +++ b/src/View/spamassassin/info.php @@ -20,12 +20,12 @@ require_once('include.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); PrintHelpWindow(_HELPWINDOW('SpamAssassin is a bayesian content scanner and is used in scanning incoming POP3 and outgoing SMTP e-mails for spam content. If SpamAssassin identifies an e-mail as spam, it marks the subject line with a warning message and provides a list of reasons in the body of the e-mail.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/spamd/info.php b/src/View/spamd/info.php index d6edcf4d..0dccaa69 100644 --- a/src/View/spamd/info.php +++ b/src/View/spamd/info.php @@ -20,12 +20,12 @@ include('include.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); PrintHelpWindow(_HELPWINDOW('OpenBSD/spamd is a spam deferral daemon, a fake sendmail-like daemon which rejects false mail. You can run spamd if there is a mail server in the internal network. Thanks to OpenBSD/spamd, you can not only prevent unwanted e-mails but also torture spammers.')); require_once($VIEW_PATH.'/footer.php'); diff --git a/src/View/sslproxy/info.php b/src/View/sslproxy/info.php index 327f73d4..e4c1ee5f 100644 --- a/src/View/sslproxy/info.php +++ b/src/View/sslproxy/info.php @@ -20,12 +20,12 @@ require_once('sslproxy.php'); -$View->ProcessStartStopRequests(); +$generate_status= $View->ProcessStartStopRequests(); $Reload= TRUE; require_once($VIEW_PATH.'/header.php'); -$View->PrintStatusForm(); +$View->PrintStatusForm($generate_status); ?> PrintStatusForm(FALSE, TRUE, FALSE, TRUE); + $View->PrintStatusForm(0, FALSE, TRUE, FALSE, TRUE); ?>