-#!/bin/sh -e
+#!/bin/sh
+
+set -e
[ "$1" = "configure" ] || exit 0
[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
/etc/dovecot/conf.d/20-pop3.conf || true
cp_check_and_sed '#ssl_cipher_list' \
- 's/#ssl_cipher_list.*/ssl_cipher_list = ALL:!aNULL:!eNULL:!ADH!LOW:!MEDIUM:!EXP:!SSLv2:HIGH/g' \
+ 's/#ssl_cipher_list.*/ssl_cipher_list = ALL:!aNULL:!eNULL:!ADH!LOW:!MEDIUM:!EXP:HIGH/g' \
+ /etc/dovecot/conf.d/10-ssl.conf || true
+
+# izbacujemo SSLv2
+cp_check_and_sed 'ssl_cipher_list' \
+ 's/:\!SSLv2//g' \
/etc/dovecot/conf.d/10-ssl.conf || true
# trazio zelja
if ! grep -q ^ssl_cert /etc/dovecot/conf.d/10-ssl.conf \
&& ! grep -q ^ssl_key /etc/dovecot/conf.d/10-ssl.conf; then
+
+ if [ ! -f /etc/dovecot/dovecot.pem -a ! -f /etc/dovecot/private/dovecot.pem ]; then
+ echo "CN: Generating certificate and key..."
+ /usr/share/dovecot-cn/mkcert.sh || true
+ fi
+
cp_check_and_sed '#ssl_cert = </etc/dovecot/dovecot.pem' \
's|#ssl_cert = </etc/dovecot/dovecot.pem|ssl_cert = </etc/dovecot/dovecot.pem|g' \
/etc/dovecot/conf.d/10-ssl.conf || true
cp_check_and_sed '#ssl_key = </etc/dovecot/private/dovecot.pem' \
's|#ssl_key = </etc/dovecot/private/dovecot.pem|ssl_key = </etc/dovecot/private/dovecot.pem|g' \
/etc/dovecot/conf.d/10-ssl.conf || true
-
- echo "CN: Generating certificate and key..."
- /usr/share/dovecot-cn/mkcert.sh > /dev/null
+ # negdje se pojavljuje dovecot.key
+ cp_check_and_sed 'ssl_key = </etc/dovecot/private/dovecot.key' \
+ 's|ssl_key = </etc/dovecot/private/dovecot.key|ssl_key = </etc/dovecot/private/dovecot.pem|g' \
+ /etc/dovecot/conf.d/10-ssl.conf || true
fi
-# dodao ico, gasi stare SSL protokole
+# dodao ico, gasi SSLv3 protokol
cp_check_and_sed '#ssl_protocols =' \
- 's/^#ssl_protocols.*/ssl_protocols = !SSLv2 !SSLv3/g' \
+ 's/^#ssl_protocols.*/ssl_protocols = !SSLv3/g' \
/etc/dovecot/conf.d/10-ssl.conf || true
-# restart
-if [ -x /usr/sbin/invoke-rc.d ]; then
- [ -x /etc/init.d/dovecot ] && invoke-rc.d dovecot restart
-else
- [ -x /etc/init.d/dovecot ] && /etc/init.d/dovecot restart
+# dodao zelja, gasi stare SSL protokole
+cp_check_and_sed 'ssl_protocols =' \
+ 's/\!SSLv2 //g' \
+ /etc/dovecot/conf.d/10-ssl.conf || true
+
+# dodao zelja, gasi stare SSL protokole/ciphere u 95-cn9-upgrade.conf ako postoje
+if [ -f /etc/dovecot/conf.d/95-cn9-upgrade.conf ]; then
+ cp_check_and_sed 'ssl_protocols =' \
+ 's/\!SSLv2 //g' \
+ /etc/dovecot/conf.d/95-cn9-upgrade.conf || true
+ cp_check_and_sed 'ssl_cipher_list' \
+ 's/:\!SSLv2//g' \
+ /etc/dovecot/conf.d/95-cn9-upgrade.conf || true
fi
+# restart
+service dovecot restart || true
+
#DEBHELPER#
exit 0