Remove opendkim cruft
This commit is contained in:
parent
a92c1d181b
commit
03cadf78de
@ -1,40 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo 'Running opendkim boot script'
|
||||
|
||||
POSTFIX_MAIN_CF=/etc/postfix/main.cf
|
||||
|
||||
env_dump=$(printenv)
|
||||
|
||||
OPENDKIM_CONFIG_HEADER="# OpenDKIM - dockermail - start"
|
||||
OPENDKIM_CONFIG_FOOTER="# OpenDKIM - dockermail - end"
|
||||
|
||||
function remove_opendkim () {
|
||||
if grep -q "$OPENDKIM_CONFIG_HEADER" "$POSTFIX_MAIN_CF"; then
|
||||
sed "/$OPENDKIM_CONFIG_HEADER/,/$OPENDKIM_CONFIG_FOOTER/d" "$POSTFIX_MAIN_CF" -i
|
||||
fi
|
||||
}
|
||||
|
||||
function add_opendkim () {
|
||||
if ! grep -q "$OPENDKIM_CONFIG_HEADER" "$POSTFIX_MAIN_CF"; then
|
||||
echo "$OPENDKIM_CONFIG_HEADER" >> "$POSTFIX_MAIN_CF"
|
||||
echo "milter_default_action = accept" >> "$POSTFIX_MAIN_CF"
|
||||
echo "milter_protocol = 2" >> "$POSTFIX_MAIN_CF"
|
||||
echo "smtpd_milters = inet:opendkim:8891" >> "$POSTFIX_MAIN_CF"
|
||||
echo "non_smtpd_milters = inet:opendkim:8891" >> "$POSTFIX_MAIN_CF"
|
||||
echo "$OPENDKIM_CONFIG_FOOTER" >> "$POSTFIX_MAIN_CF"
|
||||
else
|
||||
echo "Warning: $POSTFIX_MAIN_CF already contains OpenDKIM configuration, skipping"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $env_dump =~ ^(.+OPEN_DKIM)= ]] ; then
|
||||
if [ ! -z "${BASH_REMATCH[1]}" ]; then
|
||||
echo "OPEN_DKIM env set, enabling email signing"
|
||||
add_opendkim
|
||||
fi
|
||||
else
|
||||
echo "Cant find OPEN_DKIM env, signing will be disabled"
|
||||
remove_opendkim
|
||||
fi
|
||||
|
||||
echo 'Finished opendkim boot script'
|
Loading…
Reference in New Issue
Block a user