From 81577a30f24571fd87a6ae29e39d52eeecb66351 Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Sat, 8 Oct 2016 18:52:18 +0200 Subject: [PATCH] Renamed env to something more explicit VIRUSMAILS_DELETE_DELAY --- Dockerfile | 2 +- Makefile | 2 +- README.md | 2 +- target/start-mailserver.sh | 2 +- test/tests.bats | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ea94741..98f220d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,7 +62,7 @@ RUN sed -i -r 's/^(CRON)=0/\1=1/g' /etc/default/spamassassin RUN sed -i -r 's/#(@| \\%)bypass/\1bypass/g' /etc/amavis/conf.d/15-content_filter_mode RUN adduser clamav amavis && adduser amavis clamav RUN useradd -u 5000 -d /home/docker -s /bin/bash -p $(echo docker | openssl passwd -1 -stdin) docker -RUN (echo "0 4 * * * find /var/lib/amavis/virusmails/ -type f -mtime +\$AMAVIS_WIPE_VIRUSMAILS -delete" ; crontab -l) | crontab - +RUN (echo "0 4 * * * find /var/lib/amavis/virusmails/ -type f -mtime +\$VIRUSMAILS_DELETE_DELAY -delete" ; crontab -l) | crontab - # Configure Fail2ban COPY target/fail2ban/jail.conf /etc/fail2ban/jail.conf diff --git a/Makefile b/Makefile index acae8667..18545b96 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ run: -e SA_TAG=1.0 \ -e SA_TAG2=2.0 \ -e SA_KILL=3.0 \ - -e AMAVIS_WIPE_VIRUSMAILS=7 \ + -e VIRUSMAILS_DELETE_DELAY=7 \ -e SASL_PASSWD="external-domain.com username:password" \ -e ENABLE_MANAGESIEVE=1 \ -e PERMIT_DOCKER=host\ diff --git a/README.md b/README.md index e83799f2..71ae5f8e 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ Set different options for mynetworks option (can be overwrite in postfix-main.cf - host => Add docker host (ipv4 only) - network => Add all docker containers (ipv4 only) -##### AMAVIS_WIPE_VIRUSMAILS +##### VIRUSMAILS_DELETE_DELAY Set how many days a virusmail will stay on the server before being deleted - **empty** => 7 days diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 149f7945..968ad9af 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -9,7 +9,7 @@ die () { # Default variables # -echo "export AMAVIS_WIPE_VIRUSMAILS=${AMAVIS_WIPE_VIRUSMAILS:="7"}" >> /root/.bashrc +echo "export VIRUSMAILS_DELETE_DELAY=${VIRUSMAILS_DELETE_DELAY:="7"}" >> /root/.bashrc # # Users diff --git a/test/tests.bats b/test/tests.bats index c963c3bd..d3b79d74 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -547,14 +547,14 @@ [ "$status" -eq 0 ] } -@test "checking amavis: AMAVIS_WIPE_VIRUSMAILS override works as expected" { - run docker run -ti --rm -e AMAVIS_WIPE_VIRUSMAILS=2 `docker inspect --format '{{ .Config.Image }}' mail` /bin/bash -c 'echo $AMAVIS_WIPE_VIRUSMAILS | grep 2' +@test "checking amavis: VIRUSMAILS_DELETE_DELAY override works as expected" { + run docker run -ti --rm -e VIRUSMAILS_DELETE_DELAY=2 `docker inspect --format '{{ .Config.Image }}' mail` /bin/bash -c 'echo $VIRUSMAILS_DELETE_DELAY | grep 2' [ "$status" -eq 0 ] } @test "checking amavis: old virusmail is wipped by cron" { docker exec mail bash -c 'touch -d "`date --date=2000-01-01`" /var/lib/amavis/virusmails/should-be-deleted' - run docker exec -ti mail bash -c 'find /var/lib/amavis/virusmails/ -type f -mtime +$AMAVIS_WIPE_VIRUSMAILS -delete' + run docker exec -ti mail bash -c 'find /var/lib/amavis/virusmails/ -type f -mtime +$VIRUSMAILS_DELETE_DELAY -delete' [ "$status" -eq 0 ] run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-be-deleted' [ "$status" -eq 1 ] @@ -562,7 +562,7 @@ @test "checking amavis: recent virusmail is not wipped by cron" { docker exec mail bash -c 'touch -d "`date`" /var/lib/amavis/virusmails/should-not-be-deleted' - run docker exec -ti mail bash -c 'find /var/lib/amavis/virusmails/ -type f -mtime +$AMAVIS_WIPE_VIRUSMAILS -delete' + run docker exec -ti mail bash -c 'find /var/lib/amavis/virusmails/ -type f -mtime +$VIRUSMAILS_DELETE_DELAY -delete' [ "$status" -eq 0 ] run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-not-be-deleted' [ "$status" -eq 0 ]