From 7fe2f21df44dfaed05627baff9af914d9f4c14e3 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Wed, 15 Jun 2022 19:11:10 +1200 Subject: [PATCH] fix: Amavis should reload config for `/etc/postfix/vhost` updates (#2616) * fix: Reload `amavisd-new` when vhost config is updated Amavis was not aware of new domains in `/etc/postfix/vhost` as it did not refresh it's sources upon change detection. --- target/scripts/check-for-changes.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target/scripts/check-for-changes.sh b/target/scripts/check-for-changes.sh index d28438cb..d86f44dd 100755 --- a/target/scripts/check-for-changes.sh +++ b/target/scripts/check-for-changes.sh @@ -59,6 +59,8 @@ function _check_for_changes # While some config changes may be properly applied by Postfix or Dovecot # via their 'reload' commands; some may require restarting?: _log_with_date 'debug' 'Restarting services due to detected changes' + + [[ ${ENABLE_AMAVIS} -eq 1 ]] && _reload_amavis supervisorctl restart postfix [[ ${SMTP_ONLY} -ne 1 ]] && supervisorctl restart dovecot @@ -86,6 +88,16 @@ function _get_changed_files grep -Fxvf "${CHKSUM_CURRENT}" "${CHKSUM_NEW}" | sed -r 's/^\S+[[:space:]]+//' } +function _reload_amavis +{ + if [[ ${CHANGED} =~ ${DMS_DIR}/postfix-accounts.cf ]] || [[ ${CHANGED} =~ ${DMS_DIR}/postfix-virtual.cf ]] + then + # /etc/postfix/vhost was updated, amavis must refresh it's config by + # reading this file again in case of new domains, otherwise they will be ignored. + amavisd-new reload + fi +} + # Also note that changes are performed in place and are not atomic # We should fix that and write to temporary files, stop, swap and start function _postfix_dovecot_changes