Renamed env to something more explicit VIRUSMAILS_DELETE_DELAY

This commit is contained in:
Thomas VIAL 2016-10-08 18:52:18 +02:00
parent 2f490b4396
commit 81577a30f2
No known key found for this signature in database
GPG Key ID: 0394CEE552FAFEFC
5 changed files with 8 additions and 8 deletions

View File

@ -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 sed -i -r 's/#(@| \\%)bypass/\1bypass/g' /etc/amavis/conf.d/15-content_filter_mode
RUN adduser clamav amavis && adduser amavis clamav 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 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 # Configure Fail2ban
COPY target/fail2ban/jail.conf /etc/fail2ban/jail.conf COPY target/fail2ban/jail.conf /etc/fail2ban/jail.conf

View File

@ -23,7 +23,7 @@ run:
-e SA_TAG=1.0 \ -e SA_TAG=1.0 \
-e SA_TAG2=2.0 \ -e SA_TAG2=2.0 \
-e SA_KILL=3.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 SASL_PASSWD="external-domain.com username:password" \
-e ENABLE_MANAGESIEVE=1 \ -e ENABLE_MANAGESIEVE=1 \
-e PERMIT_DOCKER=host\ -e PERMIT_DOCKER=host\

View File

@ -157,7 +157,7 @@ Set different options for mynetworks option (can be overwrite in postfix-main.cf
- host => Add docker host (ipv4 only) - host => Add docker host (ipv4 only)
- network => Add all docker containers (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 Set how many days a virusmail will stay on the server before being deleted
- **empty** => 7 days - **empty** => 7 days

View File

@ -9,7 +9,7 @@ die () {
# Default variables # 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 # Users

View File

@ -547,14 +547,14 @@
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
} }
@test "checking amavis: AMAVIS_WIPE_VIRUSMAILS override works as expected" { @test "checking amavis: VIRUSMAILS_DELETE_DELAY 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' 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 ] [ "$status" -eq 0 ]
} }
@test "checking amavis: old virusmail is wipped by cron" { @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' 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 ] [ "$status" -eq 0 ]
run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-be-deleted' run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-be-deleted'
[ "$status" -eq 1 ] [ "$status" -eq 1 ]
@ -562,7 +562,7 @@
@test "checking amavis: recent virusmail is not wipped by cron" { @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' 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 ] [ "$status" -eq 0 ]
run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-not-be-deleted' run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-not-be-deleted'
[ "$status" -eq 0 ] [ "$status" -eq 0 ]