mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
parent
69d3bac45e
commit
805506fbea
|
@ -74,7 +74,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 +\$VIRUSMAILS_DELETE_DELAY -delete" ; crontab -l) | crontab -
|
||||
RUN (echo "0 4 * * * /usr/local/bin/virus-wiper" ; crontab -l) | crontab -
|
||||
|
||||
# Configure Fail2ban
|
||||
COPY target/fail2ban/jail.conf /etc/fail2ban/jail.conf
|
||||
|
|
4
target/bin/virus-wiper
Normal file
4
target/bin/virus-wiper
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Wipping virus older than $VIRUSMAILS_DELETE_DELAY days"
|
||||
find /var/lib/amavis/virusmails/ -type f -mtime +$VIRUSMAILS_DELETE_DELAY -delete
|
|
@ -567,7 +567,7 @@ load 'test_helper/bats-assert/load'
|
|||
}
|
||||
|
||||
@test "checking amavis: virusmail wiper cron exists" {
|
||||
run docker exec mail bash -c "crontab -l | grep '/var/lib/amavis/virusmails/'"
|
||||
run docker exec mail bash -c "crontab -l | grep '/usr/local/bin/virus-wiper'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
|
@ -578,7 +578,7 @@ load 'test_helper/bats-assert/load'
|
|||
|
||||
@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 +$VIRUSMAILS_DELETE_DELAY -delete'
|
||||
run docker exec -ti mail bash -c '/usr/local/bin/virus-wiper'
|
||||
assert_success
|
||||
run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-be-deleted'
|
||||
assert_failure
|
||||
|
@ -586,7 +586,7 @@ load 'test_helper/bats-assert/load'
|
|||
|
||||
@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 +$VIRUSMAILS_DELETE_DELAY -delete'
|
||||
run docker exec -ti mail bash -c '/usr/local/bin/virus-wiper'
|
||||
assert_success
|
||||
run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-not-be-deleted'
|
||||
assert_success
|
||||
|
|
Loading…
Reference in a new issue