From ed11592ce79b444677a1d605480b9984d0280ca4 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 17 Oct 2017 08:11:34 +0200 Subject: [PATCH] security/clamav: merge version 1.1 from master --- security/clamav/Makefile | 2 +- .../OPNsense/ClamAV/Api/ServiceController.php | 33 +++++++++++++++++++ .../OPNsense/ClamAV/GeneralController.php | 1 + .../OPNsense/ClamAV/forms/version.xml | 27 +++++++++++++++ .../app/views/OPNsense/ClamAV/general.volt | 26 ++++++++++++++- .../conf/actions.d/actions_clamav.conf | 6 ++++ .../templates/OPNsense/ClamAV/clamav_clamd | 1 + 7 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/forms/version.xml diff --git a/security/clamav/Makefile b/security/clamav/Makefile index acebf07b1..161d68673 100644 --- a/security/clamav/Makefile +++ b/security/clamav/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= clamav -PLUGIN_VERSION= 1.0 +PLUGIN_VERSION= 1.1 PLUGIN_COMMENT= Antivirus engine for detecting malicious threats PLUGIN_DEPENDS= clamav PLUGIN_MAINTAINER= m.muenz@gmail.com diff --git a/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/Api/ServiceController.php b/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/Api/ServiceController.php index 6d3c648b0..d6879f97e 100644 --- a/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/Api/ServiceController.php +++ b/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/Api/ServiceController.php @@ -163,4 +163,37 @@ class ServiceController extends ApiControllerBase return array("status" => "failed"); } } + + /** + * get ClamAV and signature versions + */ + public function versionAction() + { + $infos = array( + "clamav" => array("search" => "Version: "), + "main" => array("search" => "main.cvd: "), + "daily" => array("search" => "daily.cld: "), + "bytecode" => array("search" => "bytecode.cld: "), + "signatures" => array("search" => "Total number of signatures: ") + ); + $backend = new Backend(); + $result = array(); + $response = $backend->configdRun("clamav version"); + if ($response != null) { + foreach (explode("\n", $response) as $str) { + foreach ($infos as $key => $info) { + if (strpos($str, $info["search"]) !== false) { + $version = substr($str, strlen($info["search"])); + if (isset($version)) { + $result[$key] = $version; + } + } + } + } + return array("version" => $result); + } + else { + return array(); + } + } } diff --git a/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/GeneralController.php b/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/GeneralController.php index d78528fb4..6e2eb9c0b 100644 --- a/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/GeneralController.php +++ b/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/GeneralController.php @@ -34,6 +34,7 @@ class GeneralController extends \OPNsense\Base\IndexController { $this->view->title = gettext("ClamAV Settings"); $this->view->generalForm = $this->getForm("general"); + $this->view->versionForm = $this->getForm("version"); $this->view->pick('OPNsense/ClamAV/general'); } } diff --git a/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/forms/version.xml b/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/forms/version.xml new file mode 100644 index 000000000..65df363ba --- /dev/null +++ b/security/clamav/src/opnsense/mvc/app/controllers/OPNsense/ClamAV/forms/version.xml @@ -0,0 +1,27 @@ +
+ + version.clamav + + info + + + version.main + + info + + + version.daily + + info + + + version.bytecode + + info + + + version.signatures + + info + +
\ No newline at end of file diff --git a/security/clamav/src/opnsense/mvc/app/views/OPNsense/ClamAV/general.volt b/security/clamav/src/opnsense/mvc/app/views/OPNsense/ClamAV/general.volt index 5b5aeb2f9..e574f1fe9 100644 --- a/security/clamav/src/opnsense/mvc/app/views/OPNsense/ClamAV/general.volt +++ b/security/clamav/src/opnsense/mvc/app/views/OPNsense/ClamAV/general.volt @@ -29,9 +29,14 @@ POSSIBILITY OF SUCH DAMAGE. + +
@@ -42,6 +47,11 @@ POSSIBILITY OF SUCH DAMAGE.
+
+
+ {{ partial("layout_partials/base_form",['fields':versionForm,'id':'frm_version'])}} +
+
diff --git a/security/clamav/src/opnsense/service/conf/actions.d/actions_clamav.conf b/security/clamav/src/opnsense/service/conf/actions.d/actions_clamav.conf index 8e185dfe3..63a6808e0 100644 --- a/security/clamav/src/opnsense/service/conf/actions.d/actions_clamav.conf +++ b/security/clamav/src/opnsense/service/conf/actions.d/actions_clamav.conf @@ -33,3 +33,9 @@ command:/usr/local/opnsense/scripts/OPNsense/ClamAV/freshclam.sh parameters:%s type:script_output message:Check or install signatures + +[version] +command:/usr/local/bin/clamconf | grep "Version:\|main.cvd: version\|.cld: version\|Total number of signatures:" +parameters: +type:script_output +message:Get ClamAV and signature versions diff --git a/security/clamav/src/opnsense/service/templates/OPNsense/ClamAV/clamav_clamd b/security/clamav/src/opnsense/service/templates/OPNsense/ClamAV/clamav_clamd index f80cf3395..3c103ab53 100644 --- a/security/clamav/src/opnsense/service/templates/OPNsense/ClamAV/clamav_clamd +++ b/security/clamav/src/opnsense/service/templates/OPNsense/ClamAV/clamav_clamd @@ -4,3 +4,4 @@ clamav_clamd_enable="YES" {% else %} clamav_clamd_enable="NO" {% endif %} +clamav_clamd_var_mfs="/var/db/clamav"