mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-16 04:14:52 +02:00
scripts: add wrapper to update Postfix configuration safely (#3484)
The new function can 1. update/append 2. update/prepend 3. initialize if non-existent options in `/etc/postfix/main.cf` in a safe and secure manner. When the container is improperly restarted, the option is not applied twice. --- Co-authored-by: Casper <casperklein@users.noreply.github.com> Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
parent
758fd9c913
commit
cf9eb8278a
6 changed files with 55 additions and 16 deletions
|
@ -30,12 +30,7 @@ function _handle_postfix_regexp_config() {
|
|||
_log 'trace' "Adding regexp alias file postfix-regexp.cf"
|
||||
|
||||
cp -f /tmp/docker-mailserver/postfix-regexp.cf /etc/postfix/regexp
|
||||
|
||||
if ! grep 'virtual_alias_maps.*pcre:/etc/postfix/regexp' /etc/postfix/main.cf; then
|
||||
sed -i -E \
|
||||
's|virtual_alias_maps(.*)|virtual_alias_maps\1 pcre:/etc/postfix/regexp|g' \
|
||||
/etc/postfix/main.cf
|
||||
fi
|
||||
_add_to_or_update_postfix_main 'virtual_alias_maps' 'pcre:/etc/postfix/regexp'
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue