Prevent installation to overwrithe existing postfix files. At least make a backup.

This commit is contained in:
Christoph 2018-01-02 10:43:49 +01:00
parent c0f4c5570b
commit 1c4555e410

View File

@ -1059,6 +1059,20 @@ fi
## - /etc/aliases
## -
echononl " Backup existing file '/etc/aliases'"
if [[ -f /etc/aliases ]] ; then
mv /etc/aliases "/etc/aliases.$backup_date" > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $tmp_err_msg)"
fi
else
echo_skipped
fi
echononl " Adjust \"/etc/aliases\""
cat << EOF > /etc/aliases
# See man 5 aliases for format
@ -1175,11 +1189,13 @@ fi
## - create files
## -
echononl " Create file \"access_recipient-rfc\""
cat <<EOF > /etc/postfix/access_recipient-rfc
if [[ ! -f /etc/postfix/access_recipient-rfc ]]; then
cat <<EOF > /etc/postfix/access_recipient-rfc
# if destination is ok, permit
/^postmaster\@/ permit_auth_destination
/^abuse\@/ permit_auth_destination
EOF
fi
postmap btree:/etc/postfix/access_recipient-rfc
if [[ $? -eq 0 ]] ; then
echo_ok
@ -1197,11 +1213,13 @@ fi
## - backup_anw-urban@oopen.de OK
## - anonymous@bbb-server.b3-bornim.de OK
echononl " Create file \"access_sender\""
cat <<EOF > /etc/postfix/access_sender
if [[ ! -f /etc/postfix/access_sender ]]; then
cat <<EOF > /etc/postfix/access_sender
# - bekannte Virus/Spam Absener blocken
# -
error@mailfrom.com REJECT
EOF
fi
postmap btree:/etc/postfix/access_sender
if [[ $? -eq 0 ]] ; then
echo_ok
@ -1210,7 +1228,9 @@ else
fi
echononl " Create file \"access_recipient\""
echo > /etc/postfix/access_recipient
if [[ ! -f /etc/postfix/access_recipient ]]; then
touch /etc/postfix/access_recipient
fi
postmap btree:/etc/postfix/access_recipient
if [[ $? -eq 0 ]] ; then
echo_ok
@ -1219,7 +1239,8 @@ else
fi
echononl " Create file \"transport\""
cat <<EOF > /etc/postfix/transport
if [[ ! -f /etc/postfix/transport ]]; then
cat <<EOF > /etc/postfix/transport
# - Force sending through IPv4
# -
# - Take care your master.cf file (/etc/postfix/master.cf) contains:
@ -1239,6 +1260,7 @@ cat <<EOF > /etc/postfix/transport
#example.net smtp-ipv6-only:
EOF
fi
postmap btree:/etc/postfix/transport
if [[ $? -eq 0 ]] ; then
echo_ok
@ -1246,8 +1268,11 @@ else
echo_failed
fi
echononl " Create file \"relay_domains\""
echo > /etc/postfix/relay_domains
if [[ ! -f /etc/postfix/relay_domains ]] ; then
touch /etc/postfix/relay_domains
fi
postmap btree:/etc/postfix/relay_domains
if [[ $? -eq 0 ]] ; then
echo_ok
@ -1320,6 +1345,18 @@ else
echo_skipped
fi
echononl " Backup existing file '/etc/postfix/sasl/smtpd.conf'"
if [[ -f /etc/postfix/sasl/smtpd.conf ]] ; then
mv /etc/postfix/sasl/smtpd.conf "/etc/postfix/sasl/smtpd.conf.$backup_date" > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $tmp_err_msg)"
fi
else
echo_skipped
fi
echononl " Create file '/etc/postfix/sasl/smtpd.conf'.."
cat <<EOF > /etc/postfix/sasl/smtpd.conf
# - Take care only using provided login mechanisms. You can check this, by