install_opendmarc.sh: forgot changing also master.cf.
This commit is contained in:
@@ -876,87 +876,6 @@ EOF
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
|
||||
|
||||
# - Prevent Postfix from setting the DMARC Header twice (one befor
|
||||
# - and one after processing amavis
|
||||
# -
|
||||
# - To disable milter processing after amavis, add to your master.cf in
|
||||
# - the after-amavis section:
|
||||
# - 127.0.0.1:10025 inet n - - - - smtpd
|
||||
# - [...]
|
||||
# - -o smtpd_milters=
|
||||
# -
|
||||
# - If you want to run the milter after amavis, set in main.cf
|
||||
# - smtpd_milters=
|
||||
# - to an empty string and add the smtpd_milters configuration to master.cf
|
||||
# - (after-section amavis) instead:
|
||||
# - -o smtpd_milters=local:/opendmarc/opendmarc.sock
|
||||
# -
|
||||
echononl " Backup file '/etc/postfix/master.cf'.."
|
||||
cp -a /etc/postfix/master.cf /etc/postfix/master.cf.${backup_date} 2> $log_file
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
fi
|
||||
|
||||
echononl " Adjust /etc/postfix/master.cf. Set DMARC after sending throuh AmaVIS.."
|
||||
_found=false
|
||||
_changed=false
|
||||
tmp_master_file="/tmp/postfix_master.cf"
|
||||
> $tmp_master_file
|
||||
while IFS='' read -r _line || [[ -n $_line ]] ; do
|
||||
|
||||
if $_found && ! echo "$_line" | grep -i -q -E "^\s*-o" 2> /dev/null ; then
|
||||
echo " -o smtpd_milters=local:/opendmarc/opendmarc.sock" >> "$tmp_master_file"
|
||||
_changed=true
|
||||
_found=false
|
||||
fi
|
||||
|
||||
if $_found && echo "$_line" | grep -i -q -E "^\s*-o\s+smtpd_milters=\s*" ; then
|
||||
_found=false
|
||||
if ! echo "$_line" | grep -i -q -E "^\s*-o\s+smtpd_milters=\s*local:/opendmarc/opendmarc.sock\s*$" ; then
|
||||
echo " -o smtpd_milters=local:/opendmarc/opendmarc.sock" >> "$tmp_master_file"
|
||||
_changed=true
|
||||
continue
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if echo "$_line" | grep -i -q -E "^\s*(localhost|127.0.0.1):10025\s+inet\s+" 2> /dev/null ; then
|
||||
_found=true
|
||||
fi
|
||||
|
||||
echo "$_line" >> "$tmp_master_file"
|
||||
|
||||
done < "/etc/postfix/master.cf"
|
||||
|
||||
if $_changed ; then
|
||||
cp $tmp_master_file /etc/postfix/master.cf 2> $log_file
|
||||
postfix_needs_restart=true
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
fi
|
||||
else
|
||||
echo_skipped
|
||||
info "Postfix (master.cf) was not changed - seems already be configured right."
|
||||
echononl " Delete previosly saved file '/etc/postfix/master.cf'.."
|
||||
rm /etc/postfix/master.cf.$backup_date 2> $log_file
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
fi
|
||||
fi
|
||||
rm -f $tmp_master_file
|
||||
|
||||
echo ""
|
||||
|
||||
echononl " Enable OpenDMARC Service"
|
||||
|
||||
Reference in New Issue
Block a user