diff --git a/security/clamav/Makefile b/security/clamav/Makefile
index 912d997de..16e48923d 100644
--- a/security/clamav/Makefile
+++ b/security/clamav/Makefile
@@ -1,5 +1,5 @@
PLUGIN_NAME= clamav
-PLUGIN_VERSION= 0.1
+PLUGIN_VERSION= 0.2
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 26b3b6f7a..998599092 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
@@ -43,16 +43,21 @@ class ServiceController extends ApiControllerBase
{
/**
* load the initial signatures
+ * @param string $command test or go fetch
* @return array
*/
public function freshclamAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
- $response = $backend->configdRun("clamav freshclam");
- return array("response" => $response);
+ $command = 'clamav freshclam';
+ if ($this->request->hasPost('action')) {
+ $command .= ' go';
+ }
+ $response = trim($backend->configdRun($command));
+ return array('status' => $response);
} else {
- return array("response" => array());
+ return array('status' => 'error');
}
}
/**
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 4ecff2277..5b5aeb2f9 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
@@ -26,12 +26,12 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#}
-
-
-
-
{{ lang._('No signature database found, please download before starting. Download will take several minutes, come back in a few moments until this message is gone. If you have memory file system enabled where /var is mounted into RAM you have to download this file with every reboot.')}}
-
-
+
+
+
+
{{ lang._('No signature database found, please download before use. The download will take several minutes and this message will disappear when it has been completed. If you have memory file system enabled where /var is mounted into RAM you have to download this file with every reboot.')}}
+
+
@@ -45,40 +45,58 @@ POSSIBILITY OF SUCH DAMAGE.
diff --git a/security/clamav/src/opnsense/scripts/OPNsense/ClamAV/freshclam.sh b/security/clamav/src/opnsense/scripts/OPNsense/ClamAV/freshclam.sh
new file mode 100755
index 000000000..e54851c70
--- /dev/null
+++ b/security/clamav/src/opnsense/scripts/OPNsense/ClamAV/freshclam.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# Copyright (c) 2017 Franco Fichtner
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+PIDFILE="/var/run/clamav/freshclam-init.pid"
+DBFILE="/var/db/clamav/main.cvd"
+COMMAND="${1}"
+
+if [ -f ${DBFILE} ]; then
+ echo "done"
+elif pgrep -qF ${PIDFILE} 2> /dev/null; then
+ echo "running"
+elif [ -z "${COMMAND}" ]; then
+ echo "missing"
+else
+ daemon -f -p ${PIDFILE} freshclam --quiet
+ echo "starting"
+fi
+
+exit 0
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 17070abaf..8e185dfe3 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
@@ -29,7 +29,7 @@ type:script_output
message:request ClamAV status
[freshclam]
-command:/usr/sbin/daemon -f -p /var/run/clamav/freshclam-init.pid freshclam --quiet
-parameters:
-type:script
-message:downloading signatures
+command:/usr/local/opnsense/scripts/OPNsense/ClamAV/freshclam.sh
+parameters:%s
+type:script_output
+message:Check or install signatures