From e04a3aed6a8df79219ee3e098b02a3f78deaa0cd Mon Sep 17 00:00:00 2001 From: andryyy Date: Sat, 27 Oct 2018 13:25:05 +0200 Subject: [PATCH] [ClamAV] Do not try to modify cross-mounted file, copy whitelist from conf to lib directory --- data/Dockerfiles/clamd/bootstrap.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/data/Dockerfiles/clamd/bootstrap.sh b/data/Dockerfiles/clamd/bootstrap.sh index ba1cee85..e12f2bc6 100755 --- a/data/Dockerfiles/clamd/bootstrap.sh +++ b/data/Dockerfiles/clamd/bootstrap.sh @@ -6,15 +6,23 @@ if [[ "${SKIP_CLAMD}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then exit 0 fi -# Create log pipes +# Prepare log pipes mkdir -p /var/log/clamav touch /var/log/clamav/clamd.log /var/log/clamav/freshclam.log chown -R clamav:clamav /var/log/clamav/ chown root:tty /dev/console chmod g+rw /dev/console -# Prepare -[[ ! -f /var/lib/clamav/whitelist.ign2 ]] && touch /var/lib/clamav/whitelist.ign2 +# Prepare whitelist +if [[ -s /etc/clamav/whitelist.ign2 ]]; then + cp /etc/clamav/whitelist.ign2 /var/lib/clamav/whitelist.ign2 + chown clamav:clamav /var/lib/clamav/whitelist.ign2 +fi +if [[ ! -f /var/lib/clamav/whitelist.ign2 ]]; then + echo "Example-Signature.Ignore-1" > /var/lib/clamav/whitelist.ign2 +fi +chown clamav:clamav /var/lib/clamav/whitelist.ign2 + dos2unix /var/lib/clamav/whitelist.ign2 sed -i '/^\s*$/d' /var/lib/clamav/whitelist.ign2