Disable logrotate and cron job for updating clamav if clamav is disabled (fixes #660) (#667)

This commit is contained in:
Daniel Panteleit 2017-07-23 21:31:41 +02:00 committed by Thomas VIAL
parent b92e2c52c5
commit 60afbe1d16
3 changed files with 11 additions and 3 deletions

View File

@ -66,8 +66,7 @@ RUN apt-get update -q --fix-missing && \
update-locale && \
rm -f /etc/cron.weekly/fstrim
# Enables Clamav
RUN (echo "0 0,6,12,18 * * * /usr/bin/freshclam --quiet" ; crontab -l) | crontab - && \
RUN echo "0 0,6,12,18 * * * /usr/bin/freshclam --quiet" > /etc/cron.d/freshclam && \
chmod 644 /etc/clamav/freshclam.conf && \
freshclam

View File

@ -129,6 +129,9 @@ function register_functions() {
_register_fix_function "_fix_var_mail_permissions"
_register_fix_function "_fix_var_amavis_permissions"
if [ "$ENABLE_CLAMAV" = 0 ]; then
_register_fix_function "_fix_cleanup_clamav"
fi
################### << fix funcs
@ -1050,6 +1053,12 @@ function _fix_var_amavis_permissions() {
fi
}
function _fix_cleanup_clamav() {
notify 'task' 'Cleaning up disabled Clamav'
rm -f /etc/logrotate.d/clamav-*
rm -f /etc/cron.d/freshclam
}
##########################################################################
# << Fix Stack
##########################################################################

View File

@ -716,7 +716,7 @@ load 'test_helper/bats-assert/load'
#
@test "checking system: freshclam cron is enabled" {
run docker exec mail bash -c "crontab -l | grep '/usr/bin/freshclam'"
run docker exec mail bash -c "grep '/usr/bin/freshclam' -r /etc/cron.d"
assert_success
}