From 1acc91d29a4063d9e660f0a57a6fd083218231d2 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 9 Sep 2015 12:13:43 +0200 Subject: havp - add clamd log tab to GUI This is a resubmit of PR #804 --- config/havp/antivirus.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/havp/antivirus.php b/config/havp/antivirus.php index 1c1fc7cc..bfb0c523 100644 --- a/config/havp/antivirus.php +++ b/config/havp/antivirus.php @@ -179,7 +179,8 @@ if ($_POST['clearlog_x'] != '') { $tab_array[] = array(gettext("General page"), true, "antivirus.php"); $tab_array[] = array(gettext("HTTP proxy"), false, "pkg_edit.php?xml=havp.xml"); $tab_array[] = array(gettext("Settings"), false, "pkg_edit.php?xml=havp_avset.xml"); - $tab_array[] = array(gettext("HAVP Log"), false, "havp_log.php"); + $tab_array[] = array(gettext("HAVP Log"), false, "havp_log.php?logtab=havp"); + $tab_array[] = array(gettext("Clamd Log"), false, "havp_log.php?logtab=clamd"); display_top_tabs($tab_array); ?> -- cgit v1.2.3 From 37f335b21cb25b832ad3292614b27b8f1820c7f1 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 9 Sep 2015 12:16:04 +0200 Subject: havp - add clamd log tab to GUI --- config/havp/havp.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/havp/havp.xml b/config/havp/havp.xml index 08ff873f..c99bf8c4 100644 --- a/config/havp/havp.xml +++ b/config/havp/havp.xml @@ -99,7 +99,11 @@ HAVP Log - /havp_log.php + /havp_log.php?logtab=havp + + + Clamd Log + /havp_log.php?logtab=clamd -- cgit v1.2.3 From 8928880ffa15179414ade72be765fe99971ccf7d Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 9 Sep 2015 12:17:36 +0200 Subject: havp - add clamd log tab to GUI --- config/havp/havp_avset.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/havp/havp_avset.xml b/config/havp/havp_avset.xml index 381cf3ba..c6429724 100644 --- a/config/havp/havp_avset.xml +++ b/config/havp/havp_avset.xml @@ -68,7 +68,12 @@ HAVP Log - /havp_log.php + /havp_log.php?logtab=havp + + + + Clamd Log + /havp_log.php?logtab=clamd -- cgit v1.2.3 From 6b087576132e5a22f0bae2efd0ed3cffb99c91cc Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 9 Sep 2015 12:37:32 +0200 Subject: havp - add clamd log tab to GUI --- config/havp/havp_log.php | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/config/havp/havp_log.php b/config/havp/havp_log.php index 56a89928..6011f137 100644 --- a/config/havp/havp_log.php +++ b/config/havp/havp_log.php @@ -31,9 +31,16 @@ require("guiconfig.inc"); require_once("/usr/local/pkg/havp.inc"); $nentries = $config['syslog']['nentries'] ?: "50"; +if ($_GET['logtab'] === 'havp') { + define('HAVP_CLAMDTAB', false); + define('HAVP_LOGFILE', HVDEF_HAVP_ERRORLOG); +} else { + define('HAVP_CLAMDTAB', true); + define('HAVP_LOGFILE', HVDEF_CLAM_LOG); +} if ($_POST['clear']) { - file_put_contents(HVDEF_HAVP_ERRORLOG, ''); + file_put_contents(HAVP_LOGFILE, ''); } function dump_havp_errorlog($logfile, $tail) { @@ -44,22 +51,32 @@ function dump_havp_errorlog($logfile, $tail) { if (is_dir($logfile)) { $logarr = array("$logfile is a directory."); } elseif (file_exists($logfile) && filesize($logfile) == 0) { - $logarr = array("Log file is empty."); + $logarr = array(" -> Log file is empty."); } else { exec("/bin/cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); } foreach ($logarr as $logent) { + if (HAVP_CLAMDTAB) { + $logent = explode(" -> ", $logent); + $entry_date_time = htmlspecialchars($logent[0]); + $entry_text = htmlspecialchars($logent[1]); + } else { $logent = preg_split("/\s+/", $logent, 3); - echo "\n"; - $entry_date_time = htmlspecialchars($logent[0] . " " . $logent[1]); + $entry_date_time = htmlspecialchars($logent[0] . " " . $logent[1]); $entry_text = htmlspecialchars($logent[2]); - echo "{$entry_date_time}\n"; - echo "{$entry_text}\n"; - echo "\n"; + } + echo "\n"; + echo "{$entry_date_time}\n"; + echo "{$entry_text}\n"; + echo "\n"; } } -$pgtitle = "Antivirus: HAVP log"; +if ($_GET['logtab'] === 'havp') { + $pgtitle = "Antivirus: HAVP log"; +} else { + $pgtitle = "Antivirus: Clamd log"; +} include("head.inc"); ?> @@ -73,7 +90,8 @@ include("head.inc"); $tab_array[] = array(gettext("General Page"), false, "antivirus.php"); $tab_array[] = array(gettext("HTTP Proxy"), false, "pkg_edit.php?xml=havp.xml"); $tab_array[] = array(gettext("Settings"), false, "pkg_edit.php?xml=havp_avset.xml"); - $tab_array[] = array(gettext("HAVP Log"), true, "havp_log.php"); + $tab_array[] = array(gettext("HAVP Log"), !HAVP_CLAMDTAB, "havp_log.php?logtab=havp"); + $tab_array[] = array(gettext("Clamd Log"), HAVP_CLAMDTAB, "havp_log.php?logtab=clamd"); display_top_tabs($tab_array); ?> @@ -82,12 +100,12 @@ include("head.inc"); + - + -- cgit v1.2.3 From 147ce57e45367a9d3b727c10800cc033334a1109 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 9 Sep 2015 12:38:20 +0200 Subject: Bump havp package version --- pkg_config.10.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 4202a284..cb87e2a1 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -1201,7 +1201,7 @@ security/clamav CLAMAVUSER=havp;CLAMAVGROUP=havp - 1.06 + 1.07 BETA 2.2 https://packages.pfsense.org/packages/config/havp/havp.xml -- cgit v1.2.3
-

-
+ " />