From 1f96ba04e3cd3a796d9780f5334e7f5aa1db1237 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 4 Jan 2019 09:57:19 +0100 Subject: [PATCH] security/clamav: fix symlink permission mismatch, cleanups; closes #569 FreeBSD sets 0755 as permission so let's just follow to avoid potential mismatches in the future. --- security/clamav/Makefile | 1 + .../opnsense/scripts/OPNsense/ClamAV/setup.sh | 27 ++++++++++++------- .../conf/actions.d/actions_clamav.conf | 20 ++++++++++---- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/security/clamav/Makefile b/security/clamav/Makefile index 5c8bd80c6..08f34fcf4 100644 --- a/security/clamav/Makefile +++ b/security/clamav/Makefile @@ -1,5 +1,6 @@ PLUGIN_NAME= clamav PLUGIN_VERSION= 1.5 +PLUGIN_REVISION= 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/scripts/OPNsense/ClamAV/setup.sh b/security/clamav/src/opnsense/scripts/OPNsense/ClamAV/setup.sh index e8c24bb19..91b8d0fed 100755 --- a/security/clamav/src/opnsense/scripts/OPNsense/ClamAV/setup.sh +++ b/security/clamav/src/opnsense/scripts/OPNsense/ClamAV/setup.sh @@ -1,13 +1,22 @@ #!/bin/sh -mkdir -p /var/run/clamav -chown -R clamav:clamav /var/run/clamav -chmod 750 /var/run/clamav +USER=clamav +GROUP=clamav +PERMS=0755 +DIRS=" +/var/db/clamav +/var/run/clamav +/var/log/clamav +" -mkdir -p /var/db/clamav -chown -R clamav:clamav /var/db/clamav -chmod 750 /var/db/clamav +for DIR in ${DIRS}; do + if [ -L ${DIR} ]; then + DIRS="${DIRS} $(realpath ${DIR})" + fi +done -mkdir -p /var/log/clamav -chown -R clamav:clamav /var/log/clamav -chmod 750 /var/log/clamav +for DIR in ${DIRS}; do + mkdir -p ${DIR} + chown -R ${USER}:${GROUP} ${DIR} + chmod ${PERMS} ${DIR} +done 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 09135f29e..f1d5d96a1 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 @@ -1,29 +1,39 @@ [start] -command:/usr/local/opnsense/scripts/OPNsense/ClamAV/setup.sh;/usr/local/etc/rc.d/clamav-freshclam start;/usr/local/etc/rc.d/clamav-clamd start +command: + /usr/local/opnsense/scripts/OPNsense/ClamAV/setup.sh; + /usr/local/etc/rc.d/clamav-freshclam start; + /usr/local/etc/rc.d/clamav-clamd start parameters: type:script message:starting ClamAV [stop] -command:/usr/local/etc/rc.d/clamav-freshclam stop;/usr/local/etc/rc.d/clamav-clamd stop; exit 0 +command: + /usr/local/etc/rc.d/clamav-freshclam stop; + /usr/local/etc/rc.d/clamav-clamd stop parameters: type:script message:stopping ClamAV [restart] -command:/usr/local/opnsense/scripts/OPNsense/ClamAV/setup.sh;/usr/local/etc/rc.d/clamav-freshclam restart;/usr/local/etc/rc.d/clamav-clamd restart +command: + /usr/local/opnsense/scripts/OPNsense/ClamAV/setup.sh; + /usr/local/etc/rc.d/clamav-freshclam restart; + /usr/local/etc/rc.d/clamav-clamd restart parameters: type:script message:restarting ClamAV [status] -command:/usr/local/etc/rc.d/clamav-freshclam status;/usr/local/etc/rc.d/clamav-clamd status;exit 0 +command: /usr/local/etc/rc.d/clamav-clamd status; exit 0 parameters: type:script_output message:request ClamAV status [freshclam] -command:/usr/local/opnsense/scripts/OPNsense/ClamAV/freshclam.sh +command: + /usr/local/opnsense/scripts/OPNsense/ClamAV/setup.sh; + /usr/local/opnsense/scripts/OPNsense/ClamAV/freshclam.sh parameters:%s type:script_output message:Check or install signatures