3 [ "$1" = "configure" ] || exit 0
4 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
7 . /usr/share/carnet-tools/functions.sh
9 cp_check_and_sed '#disable_plaintext_auth' \
10 's/#disable_plaintext_auth/disable_plaintext_auth/g' \
11 /etc/dovecot/conf.d/10-auth.conf || true
13 cp_check_and_sed 'disable_plaintext_auth.*yes' \
14 's/disable_plaintext_auth.*$/disable_plaintext_auth = no/g' \
15 /etc/dovecot/conf.d/10-auth.conf || true
17 cp_check_and_sed '#imap_client_workarounds' \
18 's/#imap_client_workarounds/imap_client_workarounds/g' \
19 /etc/dovecot/conf.d/20-imap.conf || true
21 cp_check_and_sed '#pop3_client_workarounds' \
22 's/#pop3_client_workarounds/pop3_client_workarounds/g' \
23 /etc/dovecot/conf.d/20-pop3.conf || true
25 cp_check_and_sed 'imap_client_workarounds' \
26 's/imap_client_workarounds.*$/imap_client_workarounds = delay-newmail tb-extra-mailbox-sep tb-lsub-flags/g' \
27 /etc/dovecot/conf.d/20-imap.conf || true
29 cp_check_and_sed 'pop3_client_workarounds' \
30 's/pop3_client_workarounds.*$/pop3_client_workarounds = outlook-no-nuls oe-ns-eoh/g' \
31 /etc/dovecot/conf.d/20-pop3.conf || true
33 cp_check_and_sed '#ssl_cipher_list' \
34 's/#ssl_cipher_list.*/ssl_cipher_list = ALL:!aNULL:!eNULL:!ADH!LOW:!MEDIUM:!EXP:!SSLv2:HIGH/g' \
35 /etc/dovecot/conf.d/10-ssl.conf || true
38 cp_check_and_sed '#ssl =' \
40 /etc/dovecot/conf.d/10-ssl.conf || true
43 cp_check_and_sed 'ssl = no' \
44 's/^ssl = no/ssl = yes/g' \
45 /etc/dovecot/conf.d/10-ssl.conf || true
47 if ! grep -q ^ssl_cert /etc/dovecot/conf.d/10-ssl.conf \
48 && ! grep -q ^ssl_key /etc/dovecot/conf.d/10-ssl.conf; then
50 echo "CN: Generating certificate and key..."
51 /usr/share/dovecot-cn/mkcert.sh > /dev/null
53 cp_check_and_sed '#ssl_cert = </etc/dovecot/dovecot.pem' \
54 's|#ssl_cert = </etc/dovecot/dovecot.pem|ssl_cert = </etc/dovecot/dovecot.pem|g' \
55 /etc/dovecot/conf.d/10-ssl.conf || true
56 cp_check_and_sed '#ssl_key = </etc/dovecot/private/dovecot.pem' \
57 's|#ssl_key = </etc/dovecot/private/dovecot.pem|ssl_key = </etc/dovecot/private/dovecot.pem|g' \
58 /etc/dovecot/conf.d/10-ssl.conf || true
63 # dodao ico, gasi stare SSL protokole
64 cp_check_and_sed '#ssl_protocols =' \
65 's/^#ssl_protocols.*/ssl_protocols = !SSLv2 !SSLv3/g' \
66 /etc/dovecot/conf.d/10-ssl.conf || true
69 if [ -x /usr/sbin/invoke-rc.d ]; then
70 [ -x /etc/init.d/dovecot ] && invoke-rc.d dovecot restart
72 [ -x /etc/init.d/dovecot ] && /etc/init.d/dovecot restart