|
@@ -971,6 +971,7 @@ function install_composer {
|
971
|
971
|
function email_install_tls {
|
972
|
972
|
tls_config_file=/etc/exim4/conf.d/main/03_exim4-config_tlsoptions
|
973
|
973
|
tls_auth_config_file=/etc/exim4/conf.d/auth/30_exim4-config_examples
|
|
974
|
+ email_config_changed=
|
974
|
975
|
|
975
|
976
|
if [ ! -f $tls_config_file ]; then
|
976
|
977
|
tls_config_file=/etc/exim4/exim4.conf.template
|
|
@@ -982,28 +983,38 @@ function email_install_tls {
|
982
|
983
|
cp /etc/ssl/certs/exim.dhparam /etc/exim4
|
983
|
984
|
chown root:Debian-exim /etc/exim4/exim.dhparam
|
984
|
985
|
chmod 640 /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam
|
|
986
|
+ email_config_changed=1
|
985
|
987
|
fi
|
986
|
988
|
if ! grep -q 'MAIN_TLS_ENABLE = true' $tls_config_file; then
|
987
|
989
|
sed -i "/.ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME/i\MAIN_HARDCODE_PRIMARY_HOSTNAME =\nMAIN_TLS_ENABLE = true" $tls_config_file
|
|
990
|
+ email_config_changed=1
|
988
|
991
|
fi
|
989
|
992
|
if ! grep -q "tls_on_connect_ports=465" $tls_config_file; then
|
990
|
993
|
sed -i '/SSL configuration for exim/i\tls_on_connect_ports=465' $tls_config_file
|
|
994
|
+ email_config_changed=1
|
991
|
995
|
fi
|
992
|
996
|
if grep -q '# login_saslauthd_server' $tls_auth_config_file; then
|
993
|
997
|
sed -i '/login_saslauthd_server/,/.endif/ s/# *//' $tls_auth_config_file
|
|
998
|
+ email_config_changed=1
|
994
|
999
|
fi
|
995
|
1000
|
if [ -f /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem ]; then
|
996
|
1001
|
if ! grep -q "MAIN_TLS_CERTKEY = /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem" $tls_config_file; then
|
997
|
1002
|
sed -i "/.ifdef MAIN_TLS_CERTKEY/i\MAIN_TLS_CERTKEY = /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem" $tls_config_file
|
|
1003
|
+ email_config_changed=1
|
998
|
1004
|
fi
|
999
|
1005
|
fi
|
1000
|
1006
|
if [ -f /etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key ]; then
|
1001
|
1007
|
if ! grep -q "MAIN_TLS_PRIVATEKEY = /etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key" $tls_config_file; then
|
1002
|
1008
|
sed -i "/.ifdef MAIN_TLS_PRIVATEKEY/i\MAIN_TLS_PRIVATEKEY = /etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key" $tls_config_file
|
|
1009
|
+ email_config_changed=1
|
1003
|
1010
|
fi
|
1004
|
1011
|
fi
|
1005
|
1012
|
if ! grep -q "SMTPLISTENEROPTIONS='-oX 465:25:587" /etc/default/exim4; then
|
1006
|
1013
|
sed -i "s|SMTPLISTENEROPTIONS=.*|SMTPLISTENEROPTIONS='-oX 465:25:587 -oP /var/run/exim4/exim.pid'|g" /etc/default/exim4
|
|
1014
|
+ email_config_changed=1
|
|
1015
|
+ fi
|
|
1016
|
+ if [ $email_config_changed ]; then
|
|
1017
|
+ systemctl restart exim4
|
1007
|
1018
|
fi
|
1008
|
1019
|
}
|
1009
|
1020
|
|