install_opendmarc.sh: adjust konfiguration.
This commit is contained in:
@@ -24,8 +24,8 @@ opendmarc_socket_dir="${postfix_spool_dir}/opendmarc"
|
|||||||
opendmarc_socket_file="${opendmarc_socket_dir}/opendmarc.sock"
|
opendmarc_socket_file="${opendmarc_socket_dir}/opendmarc.sock"
|
||||||
|
|
||||||
config_file_name_value_parameters="
|
config_file_name_value_parameters="
|
||||||
AuthservID|$(hostname -f)
|
AuthservID|HOSTNAME
|
||||||
TrustedAuthservIDs|$(hostname -f)
|
TrustedAuthservIDs|HOSTNAME
|
||||||
PidFile|/run/opendmarc/opendmarc.pid
|
PidFile|/run/opendmarc/opendmarc.pid
|
||||||
RejectFailures|true
|
RejectFailures|true
|
||||||
Syslog|true
|
Syslog|true
|
||||||
@@ -37,11 +37,13 @@ config_file_name_value_parameters="
|
|||||||
UMask|002
|
UMask|002
|
||||||
FailureReports|false
|
FailureReports|false
|
||||||
AutoRestart|true
|
AutoRestart|true
|
||||||
HistoryFile|/run/opendmarc/opendmarc.dat
|
HistoryFile|/run/opendmarc/opendmarc.dat
|
||||||
SPFIgnoreResults|false
|
SPFIgnoreResults|false
|
||||||
SPFSelfValidate|true
|
SPFSelfValidate|true
|
||||||
Socket|${opendmarc_socket_file}
|
Socket|${opendmarc_socket_file}
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
declare -a config_file_name_value_parameter_arr=()
|
declare -a config_file_name_value_parameter_arr=()
|
||||||
for _conf in $config_file_name_value_parameters ; do
|
for _conf in $config_file_name_value_parameters ; do
|
||||||
config_file_name_value_parameter_arr+=("$_conf")
|
config_file_name_value_parameter_arr+=("$_conf")
|
||||||
@@ -193,14 +195,39 @@ echononl " Add 'IgnoreHosts' with default value to the opendmarc.conf file.."
|
|||||||
if ! $(grep -q -E "^IgnoreHosts\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
if ! $(grep -q -E "^IgnoreHosts\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
||||||
cat << EOF >> ${opendmarc_conf_file}
|
cat << EOF >> ${opendmarc_conf_file}
|
||||||
|
|
||||||
|
## IgnoreHosts (string)
|
||||||
|
##
|
||||||
## Specifies the path to a file that contains a list of hostnames, IP addresses,
|
## Specifies the path to a file that contains a list of hostnames, IP addresses,
|
||||||
## and/or CIDR expressions identifying hosts whose SMTP connections are to be
|
## and/or CIDR expressions identifying hosts whose SMTP connections are to be
|
||||||
## ignored by the filter. If not specified, defaults to "127.0.0.1" only.
|
## ignored by the filter. If not specified, defaults to "127.0.0.1" only.
|
||||||
#
|
#
|
||||||
IgnoreHosts 127.0.0.1
|
IgnoreHosts /etc/opendmarc/ignore.hosts
|
||||||
|
EOF
|
||||||
|
if [[ $? -eq 0 ]] ; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
error "$(cat $log_file)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
|
||||||
# Optional - auch nach Absender-Domain ignorieren:
|
|
||||||
IgnoreMailFrom ${opendmarc_base_dir}/ignore.mailfrom
|
# - Add 'IgnoreMailFrom' with default value to the original opendmarc.conf file
|
||||||
|
#
|
||||||
|
echononl " Add 'IgnoreMailFrom' with default value to the opendmarc.conf file.."
|
||||||
|
if ! $(grep -q -E "^IgnoreMailFrom\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
||||||
|
cat << EOF >> ${opendmarc_conf_file}
|
||||||
|
|
||||||
|
## IgnoreMailFrom (string)
|
||||||
|
##
|
||||||
|
## Gives a list of domain names whose mail (based on the From: domain)
|
||||||
|
## is to be ignored by the filter. The list should be comma-separated.
|
||||||
|
## Matching against this list is case-insensitive. The default is an
|
||||||
|
## empty list, meaning no mail is ignored.
|
||||||
|
#
|
||||||
|
IgnoreMailFrom /etc/opendmarc/ignore.mailfrom
|
||||||
EOF
|
EOF
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
echo_ok
|
echo_ok
|
||||||
@@ -220,10 +247,12 @@ echononl " Add '${_param}' with default value to the opendmarc.conf file.."
|
|||||||
if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
||||||
cat << EOF >> ${opendmarc_conf_file}
|
cat << EOF >> ${opendmarc_conf_file}
|
||||||
|
|
||||||
|
## IgnoreAuthenticatedClients (Boolean)
|
||||||
|
##
|
||||||
## If set, causes mail from authenticated clients (i.e., those that used
|
## If set, causes mail from authenticated clients (i.e., those that used
|
||||||
## SMTP AUTH) to be ignored by the filter. The default is "false".
|
## SMTP AUTH) to be ignored by the filter. The default is "false".
|
||||||
#
|
#
|
||||||
IgnoreAuthenticatedClients false
|
IgnoreAuthenticatedClients true
|
||||||
EOF
|
EOF
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
echo_ok
|
echo_ok
|
||||||
@@ -250,30 +279,7 @@ if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
|||||||
# will be used. Matching against this list is case-insensitive. The default is to use the
|
# will be used. Matching against this list is case-insensitive. The default is to use the
|
||||||
# value of AuthservID.
|
# value of AuthservID.
|
||||||
#
|
#
|
||||||
TrustedAuthservIDs OpenDMARC
|
TrustedAuthservIDs HOSTNAME
|
||||||
EOF
|
|
||||||
if [[ $? -eq 0 ]] ; then
|
|
||||||
echo_ok
|
|
||||||
else
|
|
||||||
echo_failed
|
|
||||||
error "$(cat $log_file)"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo_skipped
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# - Add 'RequiredHeaders' with default value to the original opendmarc.conf file
|
|
||||||
#
|
|
||||||
_param="IgnoreAuthenticatedClients"
|
|
||||||
echononl " Add '${_param}' with default value to the opendmarc.conf file.."
|
|
||||||
if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
|
||||||
cat << EOF >> ${opendmarc_conf_file}
|
|
||||||
|
|
||||||
## If set, causes mail from authenticated clients (i.e., those that used
|
|
||||||
## SMTP AUTH) to be ignored by the filter. The default is "false".
|
|
||||||
#
|
|
||||||
IgnoreAuthenticatedClients false
|
|
||||||
EOF
|
EOF
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
echo_ok
|
echo_ok
|
||||||
@@ -293,6 +299,8 @@ echononl " Add '${_param}' with default value to the opendmarc.conf file.."
|
|||||||
if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
||||||
cat << EOF >> ${opendmarc_conf_file}
|
cat << EOF >> ${opendmarc_conf_file}
|
||||||
|
|
||||||
|
## RequiredHeaders (Boolean)
|
||||||
|
##
|
||||||
## If set, the filter will ensure the header of the message conforms to the basic
|
## If set, the filter will ensure the header of the message conforms to the basic
|
||||||
## header field count restrictions laid out in RFC5322, Section 3.6. Messages
|
## header field count restrictions laid out in RFC5322, Section 3.6. Messages
|
||||||
## failing this test are rejected without further processing. A From: field from
|
## failing this test are rejected without further processing. A From: field from
|
||||||
@@ -318,10 +326,12 @@ echononl " Add '${_param}' with default value to the opendmarc.conf file.."
|
|||||||
if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
||||||
cat << EOF >> ${opendmarc_conf_file}
|
cat << EOF >> ${opendmarc_conf_file}
|
||||||
|
|
||||||
|
## AutoRestart (Boolean)
|
||||||
|
##
|
||||||
## Automatically re-start on failures. Use with caution; if the filter fails
|
## Automatically re-start on failures. Use with caution; if the filter fails
|
||||||
## instantly after it starts, this can cause a tight fork(2) loop.
|
## instantly after it starts, this can cause a tight fork(2) loop.
|
||||||
#
|
#
|
||||||
AutoRestart false
|
AutoRestart true
|
||||||
EOF
|
EOF
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
echo_ok
|
echo_ok
|
||||||
@@ -341,6 +351,8 @@ echononl " Add '${_param}' with default value to the opendmarc.conf file.."
|
|||||||
if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
||||||
cat << EOF >> ${opendmarc_conf_file}
|
cat << EOF >> ${opendmarc_conf_file}
|
||||||
|
|
||||||
|
## HistoryFile (string)
|
||||||
|
##
|
||||||
## If set, specifies the location of a text file to which records are written
|
## If set, specifies the location of a text file to which records are written
|
||||||
## that can be used to generate DMARC aggregate reports. Records are batches of
|
## that can be used to generate DMARC aggregate reports. Records are batches of
|
||||||
## rows containing information about a single received message, and include all
|
## rows containing information about a single received message, and include all
|
||||||
@@ -349,7 +361,7 @@ if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
|||||||
## imported into a relational database from which the aggregate reports can be
|
## imported into a relational database from which the aggregate reports can be
|
||||||
## extracted using opendmarc-importstats(8).
|
## extracted using opendmarc-importstats(8).
|
||||||
#
|
#
|
||||||
HistoryFile /run/opendmarc/opendmarc.dat
|
#HistoryFile /run/opendmarc/opendmarc.dat
|
||||||
EOF
|
EOF
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
echo_ok
|
echo_ok
|
||||||
@@ -398,7 +410,7 @@ if ! $(grep -q -E "^${_param}\s+" ${opendmarc_conf_file} 2> /dev/null) ; then
|
|||||||
## looks for SPF results in headers and always performs the SPF check itself when
|
## looks for SPF results in headers and always performs the SPF check itself when
|
||||||
## this is set. The default is "false".
|
## this is set. The default is "false".
|
||||||
#
|
#
|
||||||
SPFSelfValidate false
|
SPFSelfValidate true
|
||||||
EOF
|
EOF
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
echo_ok
|
echo_ok
|
||||||
@@ -432,15 +444,6 @@ for _val in "${config_file_name_value_parameter_arr[@]}" ; do
|
|||||||
echononl " $opendmarc_conf_file: ${_val_arr[0]} -> ${_val_arr[1]}.."
|
echononl " $opendmarc_conf_file: ${_val_arr[0]} -> ${_val_arr[1]}.."
|
||||||
if $(grep -E -q "^\s*${_val_arr[0]}\s+${_val_arr[1]}\s*$" $opendmarc_conf_file 2> /dev/null) ; then
|
if $(grep -E -q "^\s*${_val_arr[0]}\s+${_val_arr[1]}\s*$" $opendmarc_conf_file 2> /dev/null) ; then
|
||||||
echo_skipped
|
echo_skipped
|
||||||
elif $(grep -E -q "^\s*#\s*${_val_arr[0]}\s+" $opendmarc_conf_file 2> /dev/null); then
|
|
||||||
perl -i -n -p -e "s&^(\s*#\s*${_val_arr[0]}.*)&\1\n${_val_arr[0]} ${_val_arr[1]}&" $opendmarc_conf_file > "$log_file" 2>&1
|
|
||||||
if [[ $? -eq 0 ]] ; then
|
|
||||||
echo_ok
|
|
||||||
opendmarc_needs_restart=true
|
|
||||||
else
|
|
||||||
echo_failed
|
|
||||||
error "$(cat $log_file)"
|
|
||||||
fi
|
|
||||||
elif $(grep -E -q "^\s*${_val_arr[0]}\s+" $opendmarc_conf_file 2> /dev/null) ; then
|
elif $(grep -E -q "^\s*${_val_arr[0]}\s+" $opendmarc_conf_file 2> /dev/null) ; then
|
||||||
perl -i -n -p -e "s#^(\s*${_val_arr[0]}.*)#\#\1\n${_val_arr[0]} ${_val_arr[1]}#" $opendmarc_conf_file > "$log_file" 2>&1
|
perl -i -n -p -e "s#^(\s*${_val_arr[0]}.*)#\#\1\n${_val_arr[0]} ${_val_arr[1]}#" $opendmarc_conf_file > "$log_file" 2>&1
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
@@ -450,11 +453,8 @@ for _val in "${config_file_name_value_parameter_arr[@]}" ; do
|
|||||||
echo_failed
|
echo_failed
|
||||||
error "$(cat $log_file)"
|
error "$(cat $log_file)"
|
||||||
fi
|
fi
|
||||||
else
|
elif $(grep -E -q "^\s*#\s*${_val_arr[0]}\s+" $opendmarc_conf_file 2> /dev/null); then
|
||||||
cat <<EOF >> $opendmarc_conf_file 2> "$log_file"
|
perl -i -n -p -e "s&^(\s*#\s*${_val_arr[0]}.*)&\1\n${_val_arr[0]} ${_val_arr[1]}&" $opendmarc_conf_file > "$log_file" 2>&1
|
||||||
|
|
||||||
${_val_arr[0]} ${_val_arr[1]}
|
|
||||||
EOF
|
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
echo_ok
|
echo_ok
|
||||||
opendmarc_needs_restart=true
|
opendmarc_needs_restart=true
|
||||||
@@ -462,6 +462,100 @@ EOF
|
|||||||
echo_failed
|
echo_failed
|
||||||
error "$(cat $log_file)"
|
error "$(cat $log_file)"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
if [[ "${_val_arr[0]}" == "IgnoreHosts" ]]; then
|
||||||
|
cat <<EOF >> $opendmarc_conf_file 2> "$log_file"
|
||||||
|
|
||||||
|
## IgnoreHosts (string)
|
||||||
|
##
|
||||||
|
## Specifies the path to a file that contains a list of hostnames, IP
|
||||||
|
## addresses, and/or CIDR expressions identifying hosts whose SMTP
|
||||||
|
## connections are to be ignored by the filter. If not specified,
|
||||||
|
## defaults to "127.0.0.1" only.
|
||||||
|
#
|
||||||
|
${_val_arr[0]} ${_val_arr[1]}
|
||||||
|
EOF
|
||||||
|
elif [[ "${_val_arr[0]}" == "IgnoreMailFrom" ]]; then
|
||||||
|
cat <<EOF >> $opendmarc_conf_file 2> "$log_file"
|
||||||
|
|
||||||
|
## IgnoreMailFrom (string)
|
||||||
|
##
|
||||||
|
## Gives a list of domain names whose mail (based on the From: domain)
|
||||||
|
## is to be ignored by the filter. The list should be comma-separated.
|
||||||
|
## Matching against this list is case-insensitive. The default is an
|
||||||
|
## empty list, meaning no mail is ignored.
|
||||||
|
#
|
||||||
|
${_val_arr[0]} ${_val_arr[1]}
|
||||||
|
EOF
|
||||||
|
elif [[ "${_val_arr[0]}" == "IgnoreAuthenticatedClients" ]]; then
|
||||||
|
cat <<EOF >> $opendmarc_conf_file 2> "$log_file"
|
||||||
|
|
||||||
|
## IgnoreAuthenticatedClients (Boolean)
|
||||||
|
##
|
||||||
|
## If set, causes mail from authenticated clients (i.e., those that used
|
||||||
|
## SMTP AUTH) to be ignored by the filter. The default is "false".
|
||||||
|
#
|
||||||
|
${_val_arr[0]} ${_val_arr[1]}
|
||||||
|
EOF
|
||||||
|
elif [[ "${_val_arr[0]}" == "AutoRestart" ]]; then
|
||||||
|
cat <<EOF >> $opendmarc_conf_file 2> "$log_file"
|
||||||
|
## AutoRestart (Boolean)
|
||||||
|
##
|
||||||
|
## Automatically re-start on failures. Use with caution; if the filter
|
||||||
|
## fails instantly after it starts, this can cause a tight fork(2)
|
||||||
|
## loop.
|
||||||
|
#
|
||||||
|
${_val_arr[0]} ${_val_arr[1]}
|
||||||
|
EOF
|
||||||
|
elif [[ "${_val_arr[0]}" == "RequiredHeaders" ]]; then
|
||||||
|
cat <<EOF >> $opendmarc_conf_file 2> "$log_file"
|
||||||
|
|
||||||
|
## RequiredHeaders (Boolean)
|
||||||
|
##
|
||||||
|
## If set, the filter will ensure the header of the message conforms to
|
||||||
|
## the basic header field count restrictions laid out in RFC5322,
|
||||||
|
## Section 3.6. Messages failing this test are rejected without further
|
||||||
|
## processing. A From: field from which no domain name could be
|
||||||
|
## extracted will also be rejected.
|
||||||
|
#
|
||||||
|
${_val_arr[0]} ${_val_arr[1]}
|
||||||
|
EOF
|
||||||
|
elif [[ "${_val_arr[0]}" == "SPFSelfValidate" ]]; then
|
||||||
|
cat <<EOF >> $opendmarc_conf_file 2> "$log_file"
|
||||||
|
## SPFSelfValidate (Boolean)
|
||||||
|
##
|
||||||
|
## Causes the filter to perform a fallback SPF check itself when it can
|
||||||
|
## find no SPF results in the message header. If SPFIgnoreResults is
|
||||||
|
## also set, it never looks for SPF results in headers and always
|
||||||
|
## performs the SPF check itself when this is set. The default is
|
||||||
|
## "false".
|
||||||
|
#
|
||||||
|
${_val_arr[0]} ${_val_arr[1]}
|
||||||
|
EOF
|
||||||
|
elif [[ "${_val_arr[0]}" == "SPFIgnoreResults" ]]; then
|
||||||
|
cat <<EOF >> $opendmarc_conf_file 2> "$log_file"
|
||||||
|
## SPFIgnoreResults (Boolean)
|
||||||
|
##
|
||||||
|
## Causes the filter to ignore any SPF results in the header of the
|
||||||
|
## message. This is useful if you want the filter to perform SPF checks
|
||||||
|
## itself, or because you don't trust the arriving header. The default
|
||||||
|
## is "false".
|
||||||
|
#
|
||||||
|
${_val_arr[0]} ${_val_arr[1]}
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF >> $opendmarc_conf_file 2> "$log_file"
|
||||||
|
|
||||||
|
${_val_arr[0]} ${_val_arr[1]}
|
||||||
|
EOF
|
||||||
|
if [[ $? -eq 0 ]] ; then
|
||||||
|
echo_ok
|
||||||
|
opendmarc_needs_restart=true
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
error "$(cat $log_file)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -694,7 +788,7 @@ fi
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
# - Edit /etc/postfix/main.cf and add a section to activate
|
# - Edit /etc/postfix/main.cf and add a section to activate
|
||||||
# - processing of e-mail through the OpenDKIM daemon:
|
# - processing of e-mail through the OpenDKIM daemon:
|
||||||
# -
|
# -
|
||||||
backup_date="$(date +%Y-%m-%d-%H%M)"
|
backup_date="$(date +%Y-%m-%d-%H%M)"
|
||||||
@@ -740,8 +834,7 @@ milter_protocol = 6
|
|||||||
# 'smtpd_milters = local:/opendkim/opendkim.sock' here and add to
|
# 'smtpd_milters = local:/opendkim/opendkim.sock' here and add to
|
||||||
# localhost:10025 section in master.cf: 'smtpd_milters='
|
# localhost:10025 section in master.cf: 'smtpd_milters='
|
||||||
#
|
#
|
||||||
#smtpd_milters = local:/opendkim/opendkim.sock
|
smtpd_milters = local:/opendkim/opendkim.sock, local:/opendmarc/opendmarc.sock
|
||||||
smtpd_milters =
|
|
||||||
|
|
||||||
# Was sind non_smtpd_milters?
|
# Was sind non_smtpd_milters?
|
||||||
#
|
#
|
||||||
@@ -771,7 +864,7 @@ smtpd_milters =
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# DKIM soll auch die ausgehenden Mails signieren, die nicht über smtpd daemon versendet werden.
|
# DKIM soll auch die ausgehenden Mails signieren, die nicht über smtpd daemon versendet werden.
|
||||||
non_smtpd_milters = local:/opendkim/opendkim.sock
|
non_smtpd_milters = local:/opendkim/opendkim.sock, local:/opendmarc/opendmarc.sock
|
||||||
EOF
|
EOF
|
||||||
postfix_needs_restart=true
|
postfix_needs_restart=true
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
@@ -830,7 +923,7 @@ while IFS='' read -r _line || [[ -n $_line ]] ; do
|
|||||||
_changed=true
|
_changed=true
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if echo "$_line" | grep -i -q -E "^\s*(localhost|127.0.0.1):10025\s+inet\s+" 2> /dev/null ; then
|
if echo "$_line" | grep -i -q -E "^\s*(localhost|127.0.0.1):10025\s+inet\s+" 2> /dev/null ; then
|
||||||
|
|||||||
Reference in New Issue
Block a user