install_update_dovecot.sh: add support for dovecot versions 2.3.x . Fix minor errors. Add mire default values.

This commit is contained in:
Christoph 2018-10-01 00:22:28 +02:00
parent 08d2914d13
commit 38c2c17114
2 changed files with 367 additions and 120 deletions

View File

@ -8,8 +8,15 @@
# --- Configure Settings for your Server here..
# ---
# ---
# - Base Configuration
# ---
# - Set update=false if that is a new installation
# -
# - This parameter must be set here! There is no default value.
# -
_update=false
@ -17,11 +24,13 @@ _update=false
# -
# - Defaults to 'true' if systemd is present, otherwise to 'false'
# -
systemd_support=""
#systemd_support=""
# - postmaster_address
# -
# - This parameter must be set here! There is no default value.
# -
# - Example:
# - postmaster_address="admin\@warenform.net"
# -
@ -30,6 +39,8 @@ postmaster_address=""
# - hostname
# -
# - This parameter must be set here! There is no default value.
# -
hostname=""
@ -39,8 +50,10 @@ ipv4=""
ipv6=""
# ---
# - Listener configuration
# -
# ---
imap_listener_adresses="127.0.0.1 $ipv4 $ipv6"
imaps_listener_adresses="$ipv4 $ipv6"
@ -51,20 +64,45 @@ xmpp_listener=false
xmpp_listener_address="127.0.0.1"
xmpp_listener_port="4444"
# ---
# - Database settings
# ---
# - database
# -
# - This parameter must be set here! There is no default value.
# -
# - Possible values for parameter database are only 'mysql' and 'postgres'
# -
# -
database=postgres
#database=mysql
database=""
dbname=postfix
dbuser=postfix
# - dbname
# -
# - Defaults to 'postfix'
#dbname=postfx
# - dbuser
# -
# - Defaults to 'postfix'
# -
#dbuser=postfix
# - dbpassword
# -
# - This parameter must be set here!
# -
dbpassword=""
dbhost=/var/run/postgresql
# - dbhost
# -
# - Defaults to:
# - '/var/run/postgresql' if database is set to 'postgres'
# - '127.0.0.1' if database is set to 'mysql'
# -
dbhost=""
# - default_pass_scheme
# -
# - Password databases have a default password scheme.
# -
# - The password scheme can be overridden for each password by prefixing
@ -72,14 +110,19 @@ dbhost=/var/run/postgresql
# -
# - See: https://wiki.dovecot.org/Authentication/PasswordSchemes
# -
default_pass_scheme=PLAIN
# - Cert/Key configurations
# - Defaults to 'PLAIN'
# -
#default_pass_scheme=
# ---
# - Cert/Key configurations
# ---
cert_base_dir="/etc/postfix/ssl"
server_cert=${cert_base_dir}/mailserver.crt
server_key=${cert_base_dir}/mailserver.key
dh_pem_file="${cert_base_dir}/dh_4096.pem"
imap_cert=${cert_base_dir}/mailserver.crt
imap_key=${cert_base_dir}/mailserver.key

View File

@ -30,6 +30,7 @@ backup_date="$(date +%Y-%m-%d-%H%M)"
rc_done="\033[71G[ \033[32mdone\033[m ]"
rc_failed="\033[71G[ \033[31m\033[1mfailed\033[m ]"
rc_skipped="\033[71G[ \033[33m\033[1mskipped\033[m ]"
rc_wait="\033[71G[ \033[5m\033[1m..\033[m ]"
# -------------
@ -94,6 +95,66 @@ if [[ -z "$systemd_support" ]] ; then
fi
fi
## - Required parameters
## -
[[ -n "$_update" ]] || fatal "Parameter "_update" not set."
[[ -n "$postmaster_address" ]] || fatal "Parameter "postmaster_address" not set."
[[ -n "$hostname" ]] || fatal "Missing value for parameter 'hostname'."
[[ -n "$ipv4" ]] || fatal "Missing value for parameter 'ipv4'."
[[ -n "$ipv6" ]] || fatal "Missing value for parameter 'ipv6'."
[[ -n "$database" ]] || fatal "Parameter "database" not set."
if [[ "$database" != "postgres" ]] && [[ "$database" != "mysql" ]] ; then
fatal "Wrong value for parameter 'database' ({$database}). Only 'mysql' or 'postgres' is allowed."
fi
[[ -n "$dbpassword" ]] || fatal "Parameter "dbpassword" not set."
[[ -n "$from_address" ]] || fatal ""Parameter "from_address" not set.""
[[ -n "$reply_to" ]] || fatal ""Parameter "reply_to" not set.""
[[ -n "$webmailer" ]] || fatal ""Parameter "webmailer" not set.""
[[ -n "$salutation" ]] || fatal ""Parameter "salutation" not set.""
## - Some defaults if missing
## -
[[ -n "$imap_listener_adresses" ]] || imap_listener_adresses="127.0.0.1 $ipv4 $ipv6"
[[ -n "$imaps_listener_adresses" ]] || imaps_listener_adresses="$ipv4 $ipv6"
[[ -n "$pop_listener_adresses" ]] || pop_listener_adresses="$ipv4 $ipv6"
[[ -n "$pops_listener_adresses" ]] || pops_listener_adresses="$ipv4 $ipv6"
[[ -n "$xmpp_listener" ]] || xmpp_listener=false
if $xmpp_listener ; then
[[ -n "$xmpp_listener_address" ]] || xmpp_listener_address="127.0.0.1"
[[ -n "$xmpp_listener_port" ]] || xmpp_listener_port="4444"
fi
[[ -n "$dbname" ]] || dbname="postfix"
[[ -n "$dbuser" ]] || dbuser="postfix"
if [[ -z "$dbhost" ]] ; then
[[ "$dbhost" = "mysql" ]] && dbhost="127.0.0.1"
[[ "$dbhost" = "postgres" ]] && dbhost="/var/run/postgresql"
fi
[[ -n "$cert_base_dir" ]] || cert_base_dir="/etc/postfix/ssl"
[[ -n "$server_cert" ]] || server_cert="${cert_base_dir}/mailserver.crt"
[[ -n "$server_key" ]] || server_key="${cert_base_dir}/mailserver.key"
[[ -n "$dh_pem_file" ]] || dh_pem_file="${cert_base_dir}/dh_4096.pem"
[[ -n "$imap_cert" ]] || imap_cert="${cert_base_dir}/mailserver.crt"
[[ -n "$imap_key" ]] || imap_key="${cert_base_dir}/mailserver.key"
[[ -n "$pop_cert" ]] || pop_cert="${cert_base_dir}/mailserver.crt"
[[ -n "$pop_key" ]] || pop_key="${cert_base_dir}/mailserver.key"
[[ -n "$default_pass_scheme" ]] || default_pass_scheme="PLAIN"
[[ -n "$spam_folder" ]] || spam_folder="Spam"
[[ -n "$max_userip_connections" ]] || max_userip_connections=24
[[ -n "$auth_mechanisms" ]] || auth_mechanisms="plain login"
echo -e "\033[32m--\033[m"
echo ""
echo "Version Number of Dovecot to install"
@ -109,7 +170,9 @@ do
fi
done
dovecot_major_version="$(echo $_version | cut -d '.' -f1,2)"
dovecot_main_version="$(echo $_version | cut -d '.' -f1,2)"
dovecot_major_version="$(echo $_version | cut -d '.' -f1)"
dovecot_minor_version="$(echo $_version | cut -d '.' -f2)"
_log_dir=${_src_base_dir}/log-dovecot-$_version
@ -234,6 +297,10 @@ echo ""
echo -e "\tCertificat base directory.....: $cert_base_dir"
echo -e "\tServer certificate............: $server_cert"
echo -e "\tServer key....................: $server_key"
if [[ $dovecot_major_version -ge 3 ]] \
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -ge 3 ]] ); then
echo -e "\tDH Parameters file............: $dh_pem_file"
fi
echo ""
echo -e "\tImap certificate..............: $imap_cert"
echo -e "\tImap key......................: $imap_key"
@ -400,7 +467,7 @@ echo "Download sources.."
## -
echononl "\tDownload dovecot-${_version}.tar.gz"
if [ ! -f "${_src_base_dir}/dovecot-${_version}.tar.gz" ]; then
wget http://www.dovecot.org/releases/${dovecot_major_version}/dovecot-${_version}.tar.gz > /dev/null 2>&1
wget http://www.dovecot.org/releases/${dovecot_main_version}/dovecot-${_version}.tar.gz > /dev/null 2>&1
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
@ -414,9 +481,9 @@ fi
## - Download Pigeonhole for Dovecot v2.2
## -
echononl "\tDownload dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}.tar.gz.."
if [ ! -f "${_src_base_dir}/dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}.tar.gz" ]; then
wget http://pigeonhole.dovecot.org/releases/${dovecot_major_version}/dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}.tar.gz > /dev/null 2>&1
echononl "\tDownload dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}.tar.gz.."
if [ ! -f "${_src_base_dir}/dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}.tar.gz" ]; then
wget http://pigeonhole.dovecot.org/releases/${dovecot_main_version}/dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}.tar.gz > /dev/null 2>&1
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
@ -648,21 +715,21 @@ fi
cd ${_src_base_dir}
echo ""
echononl "\tExtracting dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}.tar.gz.."
gunzip < dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}.tar.gz | tar -xf -
echononl "\tExtracting dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}.tar.gz.."
gunzip < dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}.tar.gz | tar -xf -
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
fatal Extracting dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}.tar.gz failed
fatal Extracting dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}.tar.gz failed
fi
cd dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}
cd dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}
echononl "\tConfigure Pigeonhole ManageSieve.."
./configure \
--prefix=/usr/local/dovecot-${_version} \
--with-dovecot=/usr/local/dovecot-${_version}/lib/dovecot > ${_log_dir}/dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}-configure.log 2<&1
--with-dovecot=/usr/local/dovecot-${_version}/lib/dovecot > ${_log_dir}/dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}-configure.log 2<&1
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
@ -671,7 +738,7 @@ else
fi
echononl "\tCompile Pigeonhole ManageSieve.."
make > ${_log_dir}/dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}-make.log 2<&1
make > ${_log_dir}/dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}-make.log 2<&1
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
@ -680,7 +747,7 @@ else
fi
echononl "\tInstall Pigeonhole ManageSieve.."
make install > ${_log_dir}/dovecot-${dovecot_major_version}-pigeonhole-${_pigeonhole}-install.log 2<&1
make install > ${_log_dir}/dovecot-${dovecot_main_version}-pigeonhole-${_pigeonhole}-install.log 2<&1
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
@ -707,6 +774,7 @@ cp -r /usr/local/dovecot-${_version}/share/doc/dovecot/example-config/* \
## - protocols = imap pop3 sieve
## - listen = $ipv4 $ipv6
## - base_dir = /var/run/dovecot/
## - state_dir = /var/run/dovecot
## - shutdown_clients = no
## -
## - dict {
@ -718,7 +786,7 @@ perl -i.ORIG -n -p -e "s#^([ ]*)\#?\ ?(listen\ ?=.*)#\1\#\# \2\n\1listen = $ipv4
/usr/local/dovecot-${_version}/etc/dovecot/dovecot.conf || _failed=true
perl -i -n -p -e "s#^([ ]*)\#?\ ?(protocols\ ?=.*)#\1\#\# \2\n\1protocols = imap pop3 sieve#g" \
/usr/local/dovecot-${_version}/etc/dovecot/dovecot.conf || _failed=true
perl -i -n -p -e "s#^([ ]*)\#?\ ?(base_dir\ ?=.*)#\1\#\# \2\n\1base_dir = /var/run/dovecot/#g" \
perl -i -n -p -e "s#^([ ]*)\#?\ ?(base_dir\ ?=.*)#\1\#\# \2\n\1base_dir = /var/run/dovecot/\n\nstate_dir = /var/run/dovecot#g" \
/usr/local/dovecot-${_version}/etc/dovecot/dovecot.conf || _failed=true
perl -i -n -p -e "s#^([ ]*)\#?\ ?(shutdown_clients\ ?=.*)#\1\#\# \2\n\1shutdown_clients = no#g" \
/usr/local/dovecot-${_version}/etc/dovecot/dovecot.conf || _failed=true
@ -971,7 +1039,30 @@ fi
## -
## - default_vsz_limit = 512M
## -
## - !! Bemerkung
## - !! Bemerkung !!
## -
## - Das Hochsetzen des default_client_limit Parameters auf einen Wert größer
## - als 1024 geht nur dann wenn auch die Anzahl der zulässigen "open files"
## - (default = 1024) geändert wird.
## -
## -
## - Systemd System:
## - ===============
## -
## - In der service datei (z.Bsp. /etc/systemd/system/multi-user.target.wants/dovecot.service)
## - den Wert 'LimitNOFILE' hochsetzen:
## -
## - LimitNOFILE=32768 (must be greater or equal of 'default_client_limit')
## -
## - systemctl daemon-reload
## - systemctl restart dovecot.service
## -
## - Im Falle von LX containern muss zusätzlich auf dem hostsystem
## - in der datei '/etc/systemd/system.conf' der Wert für 'DefaultLimitNOFILE'
## - hochgesetzt werden.
## -
## - System V systems:
## - =================
## - Das Hochsetzen des default_client_limit Parameters auf einen Wert größer
## - als 1024 geht nur dann wenn auch die Anzahl der zulässigen "open files"
## - (default = 1024) geändert wird. Z.Bsp. in der Datei /etc/init.d/dovecot
@ -1081,6 +1172,29 @@ else
fi
## - Since dovecot version 2.3.x SSL DH parameters will be stored
## - permanently on filesystem. So we have to create such a file
## -
## - openssl dhparam -out /etc/postfix/ssl/dh_4096.pem`
## -
if [[ $dovecot_major_version -ge 3 ]] \
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -ge 3 ]] ); then
if [[ ! -f "$dh_pem_file" ]] ; then
echononl "\tCreate SSL DH parameters '$dh_pem_file'.."
echo -en "$rc_wait"
openssl dhparam -out "$dh_pem_file" 4096 > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
error "Creating DH parameter file '$dh_pem_file' failed."
fi
fi
fi
## - edit /usr/local/dovecot/etc/dovecot/conf.d/10-ssl.conf
## -
## - ssl = required
@ -1116,8 +1230,25 @@ perl -i -n -p -e "s#^([ ]*)(ssl_cert\ ?=.*)#\1\#\# \2\n\1ssl_cert = <$server_cer
/usr/local/dovecot-${_version}/etc/dovecot/conf.d/10-ssl.conf || _failed=true
perl -i -n -p -e "s#^([ ]*)(ssl_key\ ?=.*)#\1\#\# \2\n\1ssl_key = <$server_key#g" \
/usr/local/dovecot-${_version}/etc/dovecot/conf.d/10-ssl.conf || _failed=true
perl -i -n -p -e "s#^([ ]*)\#?(ssl_dh_parameters_length\ ?=.*)#\1\#\# \2\nssl_dh_parameters_length = 2048#g" \
/usr/local/dovecot-${_version}/etc/dovecot/conf.d/10-ssl.conf || _failed=true
if [[ $dovecot_major_version -ge 3 ]] \
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -ge 3 ]] ); then
if [[ ! -f "$dh_pem_file" ]]; then
if [[ -f "/etc/postfix/ssl/dh_2048.pem" ]]; then
dh_pem_file="/etc/postfix/ssl/dh_2048.pem"
fi
fi
if [[ -f "$dh_pem_file" ]]; then
perl -i -n -p -e "s#^(\s*\#*)(ssl_dh\s*=.*)#\#\1\2\nssl_dh = <$dh_pem_file#g" \
/usr/local/dovecot-${_version}/etc/dovecot/conf.d/10-ssl.conf || _failed=true
else
_failed=true
fi
else
perl -i -n -p -e "s#^([ ]*)\#?(ssl_dh_parameters_length\ ?=.*)#\1\#\# \2\nssl_dh_parameters_length = 2048#g" \
/usr/local/dovecot-${_version}/etc/dovecot/conf.d/10-ssl.conf || _failed=true
fi
perl -i -n -p -e "s#^([ ]*)\#?(ssl_protocols\ ?=.*)#\1\#\# \2\nssl_protocols = !SSLv3#g" \
/usr/local/dovecot-${_version}/etc/dovecot/conf.d/10-ssl.conf || _failed=true
@ -1176,6 +1307,13 @@ perl -i -n -p -e "s#^([ ]*)\#?\ ?(auth_socket_path\ +=.*)#\1\#\# \2\n\1auth_sock
perl -i -n -p -e "s#^([ ]*)\#?\ ?(mail_plugins\ +=.*)#\1\#\# \2\n\1mail_plugins = quota expire#g" \
/usr/local/dovecot-${_version}/etc/dovecot/conf.d/10-mail.conf || _failed=true
if ! $_failed ; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
fatal "Adjusting file '10-mail.conf' failed"
fi
echononl "\tCreate TEMP directory '/var/vmail/tmp' .."
if [[ ! -d /var/vmail/tmp ]] ; then
@ -1216,7 +1354,6 @@ _tmp_file="$(mktemp)"
while IFS='' read -r _line || [[ -n $_line ]] ; do
if echo "$_line" | grep -i -E "^\s*namespace\s+inbox\s+" > /dev/null 2>&1 ; then
echo "found!"
echo "## $_line" >> $_tmp_file
_found=true
continue
@ -1818,17 +1955,19 @@ fi
chown -R vmail:vmail /usr/local/dovecot-${_version}/etc/dovecot/sieve
if $_new && ! $systemd_support; then
if $_new ; then
_create_init=""
echo
echo -n "Create init script /etc/init.d/dovecot ? [y/n]: "
read _create_init
if [ "y" = "$_create_init" -o "Y" = "$_create_init" -o "Yes" = "$_create_init" -o "yes" = "$_create_init" ];then
echononl "\tCreate init script for dovecot .."
## - running dovecot service via init-script
## -
cat <<EOF > /etc/init.d/dovecot
if ! $systemd_support; then
_create_init=""
echo
echo -n "Create init script /etc/init.d/dovecot ? [y/n]: "
read _create_init
if [ "y" = "$_create_init" -o "Y" = "$_create_init" -o "Yes" = "$_create_init" -o "yes" = "$_create_init" ];then
echononl "\tCreate init script for dovecot .."
## - running dovecot service via init-script
## -
cat <<EOF > /etc/init.d/dovecot
#! /bin/sh
### BEGIN INIT INFO
# Provides: dovecot
@ -2015,23 +2154,104 @@ esac
exit 0
EOF
if [ "$?" = 0 ]; then
echo -e "$rc_done"
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
fatal "Creating init script for dovecot failed"
fi
chmod 755 /etc/init.d/dovecot
else
echo -e "$rc_failed"
fatal "Creating init script for dovecot failed"
echononl "\tCreate init script for dovecot .."
echo -e "$rc_skipped"
fi
chmod 755 /etc/init.d/dovecot
else
echononl "\tCreate init script for dovecot .."
## - # - At time, we don't use private tmp directory for divecot.
## - # -
## - echononl "\tAdjust Systemd service file, set PrivateTmp=false.."
## - if [[ -f "/etc/systemd/system/dovecot.service" ]] ; then
## -
## - if $(grep -o -E "PrivateTmp\s*=\s*[^[:blank:]]+" /etc/systemd/system/dovecot.service | grep -q true 2> /dev/null ) ; then
## - perl -i -n -p -e "s/(PrivateTmp\s*=\s*)true/\1false/" /etc/systemd/system/dovecot.service
## - if [[ $? -eq 0 ]]; then
## - echo -e "$rc_done"
## - else
## - echo -e "$rc_failed"
## - fi
## - else
## - echo -e "$rc_skipped"
## - fi
## - else
## - echo -e "$rc_skipped"
## - fi
## - Increase LimitNOFILE to fit dovecots setting for 'default_client_limit'.
## -
## - here:
## - LimitNOFILE=32768
## -
echononl "\tAdjust 'LimitNOFILE' at file 'dovecot.service'.."
if [[ -f "/etc/systemd/system/dovecot.service" ]] ; then
if $(grep -q -o -E "LimitNOFILE\s*=\s*[^[:blank:]]+" /etc/systemd/system/dovecot.service 2> /dev/null ) ; then
perl -i -n -p -e "s/(LimitNOFILE\s*=\s*.*)/LimitNOFILE=32768/" /etc/systemd/system/dovecot.service
if [[ $? -eq 0 ]]; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
fi
else
echo -e "$rc_skipped"
fi
else
echo -e "$rc_skipped"
fi
fi
## - Add a cronjob to restart dovecot after booting the system.
## -
## - Notice:
## - On normal start, dovecot started its service even if ipv6 is not
## - yet present and dovecot cannot bind to ipv6 listeners.
## -
## - Doimg a restart (after ipv6 adresses are present) fixes this.
## -
echononl "\tCreate cronjob to restart dovecot service after reboot.."
_crontab_tmp_file=/tmp/crontab_root.$$
crontab -l > $_crontab_tmp_file 2> /dev/null
if [[ ! -s $_crontab_tmp_file ]]; then
echo "PATH=/usr/local/dovecot/bin:$PATH" > $_crontab_tmp_file
fi
if ! grep -q -E "\s*@reboot.*systemctl\s+restart\s+dovecot.service" $_crontab_tmp_file ; then
echo "" >> $_crontab_tmp_file
echo "# - Restart dovecot after reboot" >> $_crontab_tmp_file
echo "# -" >> $_crontab_tmp_file
echo "@reboot sleep 15 ; /bin/systemctl restart dovecot.service" >> $_crontab_tmp_file
crontab $_crontab_tmp_file
echo -e "$rc_done"
else
echo -e "$rc_skipped"
fi
rm -f $_crontab_tmp_file
## - Make dovecot start at boot time
## -
if $systemd_support ; then
echononl "\tReload systemd .."
systemctl daemon-reload > /dev/null 2>&1
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
fi
fi
echononl "\tMake dovecot start at boottime.."
if $systemd_support ; then
@ -2132,41 +2352,25 @@ EOF
fi
rm -f $_crontab_tmp_file
fi
## - # - At time, we don't use private tmp directory for divecot.
## - # -
## - echononl "\tAdjust Systemd service file, set PrivateTmp=false.."
## - if [[ -f "/etc/systemd/system/dovecot.service" ]] ; then
## -
## - if $(grep -o -E "PrivateTmp\s*=\s*[^[:blank:]]+" /etc/systemd/system/dovecot.service | grep -q true 2> /dev/null ) ; then
## - perl -i -n -p -e "s/(PrivateTmp\s*=\s*)true/\1false/" /etc/systemd/system/dovecot.service
## - if [[ $? -eq 0 ]]; then
## - echo -e "$rc_done"
## - else
## - echo -e "$rc_failed"
## - fi
## - else
## - echo -e "$rc_skipped"
## - fi
## - else
## - echo -e "$rc_skipped"
## - fi
# - Reload systemd
# -
echononl "\tReload systemd.."
if $systemd_support ; then
systemctl daemon-reload
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
error "Reloading systemd failed"
fi
else
echo -e "$rc_skipped"
fi
# - Reload systemd
# -
echononl "\tReload systemd.."
if $systemd_support ; then
systemctl daemon-reload
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
error "Reloading systemd failed"
fi
else
echo -e "$rc_skipped"
fi
fi # if $_new
echo
echo -e "Change (from lda) to lmtp-service"
@ -2209,45 +2413,45 @@ else
fi
if $_new ; then
## - /etc/postfix/main.cf
## -
## - comment in:
## - #virtual_transport = dovecot
## -
## - change:
## - smtpd_sasl_auth_enable = yes
## - smtpd_sasl_type = dovecot
## - smtpd_sasl_path = private/dovecot-auth
## - virtual_transport = lmtp:unix:private/dovecot-lmtp
_failed=false
echononl "\tAdjust /etc/postfix/main.cf"
perl -i -n -p -e "s#^(\s*)(smtpd_sasl_auth_enable\ *=.*)#smtpd_sasl_auth_enable = yes#" \
/etc/postfix/main.cf || _failed=true
#perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#\1\#\2\n\1smtpd_sasl_type = dovecot#" \
perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#smtpd_sasl_type = dovecot#" \
/etc/postfix/main.cf || _failed=true
#perl -i -n -p -e "s#^(\s*)(smtpd_sasl_path\ *=.*)#\1\#\2\n\1smtpd_sasl_path = private/dovecot-auth#" \
# /etc/postfix/main.cf || _failed=true
perl -i -n -p -e "s#^(\s*)(smtpd_sasl_path\ *=.*)#smtpd_sasl_path = private/dovecot-auth#" \
/etc/postfix/main.cf || _failed=true
#perl -i -n -p -e "s#^(\s*)(virtual_transport\ *=.*)#\1\#\2\n\1virtual_transport = lmtp:unix:private/dovecot-lmtp#" \
# /etc/postfix/main.cf || _failed=true
perl -i -n -p -e "s#^(\s*)(virtual_transport\ *=.*)#virtual_transport = lmtp:unix:private/dovecot-lmtp#" \
/etc/postfix/main.cf || _failed=true
perl -i-n -p -e "s#^(\s*)(dovecot_destination_recipient_limit.*)#\1\#\2#" /etc/postfix/main.cf || _failed=true
if ! $_failed ; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
fatal "Adjusting /etc/postfix/main.cf failed"
fi
fi
#if $_new ; then
#
# ## - /etc/postfix/main.cf
# ## -
# ## - comment in:
# ## - #virtual_transport = dovecot
# ## -
# ## - change:
# ## - smtpd_sasl_auth_enable = yes
# ## - smtpd_sasl_type = dovecot
# ## - smtpd_sasl_path = private/dovecot-auth
# ## - virtual_transport = lmtp:unix:private/dovecot-lmtp
# _failed=false
# echononl "\tAdjust /etc/postfix/main.cf"
# perl -i -n -p -e "s#^(\s*)(smtpd_sasl_auth_enable\ *=.*)#smtpd_sasl_auth_enable = yes#" \
# /etc/postfix/main.cf || _failed=true
# #perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#\1\#\2\n\1smtpd_sasl_type = dovecot#" \
# perl -i -n -p -e "s#^(\s*)(smtpd_sasl_type\ *=.*)#smtpd_sasl_type = dovecot#" \
# /etc/postfix/main.cf || _failed=true
# #perl -i -n -p -e "s#^(\s*)(smtpd_sasl_path\ *=.*)#\1\#\2\n\1smtpd_sasl_path = private/dovecot-auth#" \
# # /etc/postfix/main.cf || _failed=true
# perl -i -n -p -e "s#^(\s*)(smtpd_sasl_path\ *=.*)#smtpd_sasl_path = private/dovecot-auth#" \
# /etc/postfix/main.cf || _failed=true
#
#
#
# #perl -i -n -p -e "s#^(\s*)(virtual_transport\ *=.*)#\1\#\2\n\1virtual_transport = lmtp:unix:private/dovecot-lmtp#" \
# # /etc/postfix/main.cf || _failed=true
# perl -i -n -p -e "s#^(\s*)(virtual_transport\ *=.*)#virtual_transport = lmtp:unix:private/dovecot-lmtp#" \
# /etc/postfix/main.cf || _failed=true
# perl -i-n -p -e "s#^(\s*)(dovecot_destination_recipient_limit.*)#\1\#\2#" /etc/postfix/main.cf || _failed=true
# if ! $_failed ; then
# echo -e "$rc_done"
# else
# echo -e "$rc_failed"
# fatal "Adjusting /etc/postfix/main.cf failed"
# fi
#
#fi
## -----------------