diff --git a/mail/debian/changelog b/mail/debian/changelog index 612a4ba4e4bbf449e064917b21f6c44c3d573ef0..b70dd1ce1d538a712eddd8f73718b9edaae99812 100644 --- a/mail/debian/changelog +++ b/mail/debian/changelog @@ -1,4 +1,11 @@ -sympl-mail (10.0.190702.1) stable; urgency=medium +sympl-mail (10.0.190706.0) stable; urgency=medium + + * Updated sympl-mail-dovecot-sni for edge cases + * Improved sympl-mail ssl-hook + + -- Paul Cammish Sun, 06 Jul 2019 18:51:42 +0100 + + sympl-mail (10.0.190702.1) stable; urgency=medium * Adjusted exim config group diff --git a/mail/debian/prerm b/mail/debian/prerm index 4d02900f85183a9bbf47775ed627d4276655ddba..5bed295c1f5fb4873a08fbe42540ac29e15c0a49 100755 --- a/mail/debian/prerm +++ b/mail/debian/prerm @@ -16,13 +16,20 @@ if echo "ae779d6822f91492b26697d6b9931835 /etc/default/clamav-daemon" | md5sum rm -f /etc/default/clamav-daemon fi -# -# Remove the old diversion +# +# Remove the old Dovecot SNI config if it exists +# +if [ -f /etc/dovecot/sympl.d/10-main/60-sni ]; then + rm /etc/dovecot/sympl.d/10-main/60-sni +fi + +# +# Remove the old diversion # package="sympl-mail" conf="/etc/dovecot/dovecot.conf" -# +# # Dovecot ships with its own config. # package="sympl-mail" @@ -46,5 +53,6 @@ if dpkg-divert --list "$package" | grep -xFq "diversion of $conf to $theirfile b fi + #DEBHELPER# exit 0 diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 67befcf6d36d14566bb83fd68445956cc11b7c93..7f332e62e503b875b8eff620a6e3a770a9a2cc25 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -2,6 +2,25 @@ set -e +if [ ! -L /srv/*/config/ssl/current ]; then + # No certs avaialable, so check if /etc/dovecot/sympl.d/10-main/60-sni exists + if [ -f /etc/dovecot/sympl.d/10-main/60-sni ]; then + # it exists, so remove it + rm /etc/dovecot/sympl.d/10-main/60-sni + # then rebuild the configuration if theres a Makefile (ie: sympl-mail is installed) + if [ -f /etc/dovecot/Makefile ]; then + cd /etc/dovecot + sudo /usr/bin/make test + sudo /usr/bin/make > /dev/null + sudo /usr/sbin/service dovecot reload + fi + exit 0 + else + # Nothing to do yet, so just exit. + exit 0 + fi +fi + for certificate in $( find -L /srv/*/config/ssl/current -name 'ssl.crt' -print ); do certpath="$( echo $certificate | sed 's|/config/ssl/current/.*$|/config/ssl/current|' )" # Ensure there is a matching key file, and the path doesnt include an underscore @@ -36,13 +55,16 @@ if [ -f "/etc/dovecot/sympl.d/10-main/60-sni" ]; then fi fi -# Move the new config into place, make it and start it up +# Move the new config into place... mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni -cd /etc/dovecot -sudo make test -sudo make > /dev/null -sudo /usr/sbin/service dovecot reload +# ... and build the new config if the Makefile is in place. +if [ -f /etc/dovecot/Makefile ]; then + cd /etc/dovecot + sudo /usr/bin/make test + sudo /usr/bin/make > /dev/null + sudo /usr/sbin/service dovecot reload +fi if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi diff --git a/mail/sympl/ssl-hooks.d/sympl-mail b/mail/sympl/ssl-hooks.d/sympl-mail index fc25abf4bca79ddc177469e7a29709f6cf974902..1c9e08e65f1d2f36c9d5e5bc314f1040803125ab 100755 --- a/mail/sympl/ssl-hooks.d/sympl-mail +++ b/mail/sympl/ssl-hooks.d/sympl-mail @@ -8,4 +8,5 @@ fi # # Rebuild Dovecot SNI Certificates and reload on cert change. # -sudo /usr/sbin/sympl-mail-dovecot-sni +/usr/sbin/sympl-mail-dovecot-sni +/usr/sbin/service dovecot reload \ No newline at end of file