install_update_dovecot.sh: (re)compltete changes for using LMTP service.

This commit is contained in:
Christoph 2021-04-25 16:40:56 +02:00
parent 632164051d
commit 7bae5e16bf
2 changed files with 95 additions and 39 deletions

View File

@ -1539,6 +1539,7 @@ cat <<EOF >> /etc/postfix/main.cf
## - ## -
## - using dovecot lda ## - using dovecot lda
## - virtual_transport = dovecot ## - virtual_transport = dovecot
## - dovecot_destination_recipient_limit = 1
## - ## -
## - using dovecot's lmtp service ## - using dovecot's lmtp service
## - virtual_transport = lmtp:unix:private/dovecot-lmtp ## - virtual_transport = lmtp:unix:private/dovecot-lmtp

View File

@ -2797,45 +2797,100 @@ else
fi fi
#if $_new ; then # - /etc/postfix/main.cf
# # -
# ## - /etc/postfix/main.cf # - comment in:
# ## - # - #virtual_transport = dovecot
# ## - comment in: # - #dovecot_destination_recipient_limit = ..
# ## - #virtual_transport = dovecot # -
# ## - # - change:
# ## - change: # - smtpd_sasl_auth_enable = yes
# ## - smtpd_sasl_auth_enable = yes # - smtpd_sasl_type = dovecot
# ## - smtpd_sasl_type = dovecot # - smtpd_sasl_path = private/dovecot-auth
# ## - smtpd_sasl_path = private/dovecot-auth # - virtual_transport = lmtp:unix:private/dovecot-lmtp
# ## - virtual_transport = lmtp:unix:private/dovecot-lmtp var="smtpd_sasl_auth_enable"
# _failed=false val="yes"
# echononl "\tAdjust /etc/postfix/main.cf" echononl "\t${postfix_main_cf}: adjust '${val}'.."
# perl -i -n -p -e "s#^(\s*)(smtpd_sasl_auth_enable\ *=.*)#smtpd_sasl_auth_enable = yes#" \ if ! $(grep -E -q "^\s*${var}\s*=\s*${val}" ${postfix_main_cf} 2> /dev/null) ; then
# /etc/postfix/main.cf || _failed=true perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#smtpd_sasl_type = dovecot#" \
# #perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#\1\#\2\n\1smtpd_sasl_type = dovecot#" \ /etc/postfix/main.cf > $log_file 2>&1
# perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#smtpd_sasl_type = dovecot#" \ if [[ $? -eq 0 ]]; then
# /etc/postfix/main.cf || _failed=true echo_ok
# #perl -i -n -p -e "s#^(\s*)(smtpd_sasl_path\ *=.*)#\1\#\2\n\1smtpd_sasl_path = private/dovecot-auth#" \ changed=true
# # /etc/postfix/main.cf || _failed=true else
# perl -i -n -p -e "s#^(\s*)(smtpd_sasl_path\ *=.*)#smtpd_sasl_path = private/dovecot-auth#" \ echo_failed
# /etc/postfix/main.cf || _failed=true error "$(cat "$log_file")"
# fi
# else
# echo_skipped
# #perl -i -n -p -e "s#^(\s*)(virtual_transport\ *=.*)#\1\#\2\n\1virtual_transport = lmtp:unix:private/dovecot-lmtp#" \ fi
# # /etc/postfix/main.cf || _failed=true
# perl -i -n -p -e "s#^(\s*)(virtual_transport\ *=.*)#virtual_transport = lmtp:unix:private/dovecot-lmtp#" \ var="smtpd_sasl_type"
# /etc/postfix/main.cf || _failed=true val="dovecot"
# perl -i-n -p -e "s#^(\s*)(dovecot_destination_recipient_limit.*)#\1\#\2#" /etc/postfix/main.cf || _failed=true echononl "\t${postfix_main_cf}: adjust '${val}'.."
# if ! $_failed ; then if ! $(grep -E -q "^\s*${var}\s*=\s*${val}" ${postfix_main_cf} 2> /dev/null) ; then
# echo -e "$rc_done" perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#smtpd_sasl_type = dovecot#" \
# else /etc/postfix/main.cf > $log_file 2>&1
# echo -e "$rc_failed" if [[ $? -eq 0 ]]; then
# fatal "Adjusting /etc/postfix/main.cf failed" echo_ok
# fi changed=true
# else
#fi echo_failed
error "$(cat "$log_file")"
fi
else
echo_skipped
fi
var="smtpd_sasl_path"
val="private/dovecot-auth"
echononl "\t${postfix_main_cf}: adjust '${val}'.."
if ! $(grep -E -q "^\s*${var}\s*=\s*${val}" ${postfix_main_cf} 2> /dev/null) ; then
perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#smtpd_sasl_type = dovecot#" \
/etc/postfix/main.cf > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
changed=true
else
echo_failed
error "$(cat "$log_file")"
fi
else
echo_skipped
fi
var="virtual_transport"
val="lmtp:unix:private/dovecot-lmtp"
echononl "\t${postfix_main_cf}: adjust '${val}'.."
if ! $(grep -E -q "^\s*${var}\s*=\s*${val}" ${postfix_main_cf} 2> /dev/null) ; then
perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#smtpd_sasl_type = dovecot#" \
/etc/postfix/main.cf > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
changed=true
error "$(cat "$log_file")"
fi
else
echo_skipped
fi
echononl "\tComment variable 'dovecot_destination_recipient_limit'.."
if $(grep -E -q "^\s*dovecot_destination_recipient_limit" ${postfix_main_cf} 2> /dev/null) ; then
perl -i-n -p -e "s/^(\s*)(dovecot_destination_recipient_limit.*)/\1\#\2/" /etc/postfix/main.cf > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
changed=true
else
echo_failed
error "$(cat "$log_file")"
fi
else
echo_skipped
fi
## ----------------- ## -----------------