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.
This commit is contained in:
Brennan Kinney 2022-06-15 19:11:10 +12:00 committed by GitHub
parent ea8e293dcc
commit 7fe2f21df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -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