2021-08-22 13:21:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
do_pre_regen() {
|
|
|
|
pending_dir=$1
|
|
|
|
|
|
|
|
# Patch postfix conf
|
|
|
|
postfix_main_cf="${pending_dir}/../postfix/etc/postfix/main.cf"
|
|
|
|
|
|
|
|
# FIXME : check this file actually exists to not crash when only running this
|
|
|
|
# hook alone
|
2022-07-15 22:51:40 +02:00
|
|
|
sed -i 's@virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf@virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf, hash:/var/lib/mailman3/data/postfix_lmtp@' $postfix_main_cf
|
2021-08-22 13:21:25 +02:00
|
|
|
cat << EOT >> $postfix_main_cf
|
|
|
|
unknown_local_recipient_reject_code = 550
|
|
|
|
owner_request_special = no
|
|
|
|
|
|
|
|
transport_maps =
|
|
|
|
hash:/var/lib/mailman3/data/postfix_lmtp
|
|
|
|
local_recipient_maps =
|
|
|
|
hash:/var/lib/mailman3/data/postfix_lmtp
|
|
|
|
relay_domains =
|
|
|
|
hash:/var/lib/mailman3/data/postfix_domains
|
|
|
|
EOT
|
|
|
|
}
|
|
|
|
|
|
|
|
do_post_regen() {
|
|
|
|
|
|
|
|
regen_conf_files=$1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
FORCE=${2:-0}
|
|
|
|
DRY_RUN=${3:-0}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
pre)
|
|
|
|
do_pre_regen $4
|
|
|
|
;;
|
|
|
|
post)
|
|
|
|
do_post_regen $4
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "hook called with unknown argument \`$1'" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|