5 [ "$1" = "configure" ] || exit 0
6 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
9 . /usr/share/carnet-tools/functions.sh
11 cp_check_and_sed '#disable_plaintext_auth' \
12 's/#disable_plaintext_auth/disable_plaintext_auth/g' \
13 /etc/dovecot/conf.d/10-auth.conf || true
15 cp_check_and_sed 'disable_plaintext_auth.*yes' \
16 's/disable_plaintext_auth.*$/disable_plaintext_auth = no/g' \
17 /etc/dovecot/conf.d/10-auth.conf || true
19 cp_check_and_sed '#imap_client_workarounds' \
20 's/#imap_client_workarounds/imap_client_workarounds/g' \
21 /etc/dovecot/conf.d/20-imap.conf || true
23 cp_check_and_sed '#pop3_client_workarounds' \
24 's/#pop3_client_workarounds/pop3_client_workarounds/g' \
25 /etc/dovecot/conf.d/20-pop3.conf || true
27 cp_check_and_sed 'imap_client_workarounds' \
28 's/imap_client_workarounds.*$/imap_client_workarounds = delay-newmail tb-extra-mailbox-sep tb-lsub-flags/g' \
29 /etc/dovecot/conf.d/20-imap.conf || true
31 cp_check_and_sed 'pop3_client_workarounds' \
32 's/pop3_client_workarounds.*$/pop3_client_workarounds = outlook-no-nuls oe-ns-eoh/g' \
33 /etc/dovecot/conf.d/20-pop3.conf || true
35 cp_check_and_sed '#ssl_cipher_list' \
36 's/#ssl_cipher_list.*/ssl_cipher_list = ALL:!aNULL:!eNULL:!ADH!LOW:!MEDIUM:!EXP:!SSLv2:HIGH/g' \
37 /etc/dovecot/conf.d/10-ssl.conf || true
40 cp_check_and_sed '#ssl =' \
42 /etc/dovecot/conf.d/10-ssl.conf || true
45 cp_check_and_sed 'ssl = no' \
46 's/^ssl = no/ssl = yes/g' \
47 /etc/dovecot/conf.d/10-ssl.conf || true
49 if ! grep -q ^ssl_cert /etc/dovecot/conf.d/10-ssl.conf \
50 && ! grep -q ^ssl_key /etc/dovecot/conf.d/10-ssl.conf; then
52 if [ ! -f /etc/dovecot/dovecot.pem -a ! -f /etc/dovecot/private/dovecot.pem ]; then
53 echo "CN: Generating certificate and key..."
54 /usr/share/dovecot-cn/mkcert.sh || true
57 cp_check_and_sed '#ssl_cert = </etc/dovecot/dovecot.pem' \
58 's|#ssl_cert = </etc/dovecot/dovecot.pem|ssl_cert = </etc/dovecot/dovecot.pem|g' \
59 /etc/dovecot/conf.d/10-ssl.conf || true
60 cp_check_and_sed '#ssl_key = </etc/dovecot/private/dovecot.pem' \
61 's|#ssl_key = </etc/dovecot/private/dovecot.pem|ssl_key = </etc/dovecot/private/dovecot.pem|g' \
62 /etc/dovecot/conf.d/10-ssl.conf || true
67 # dodao ico, gasi stare SSL protokole
68 cp_check_and_sed '#ssl_protocols =' \
69 's/^#ssl_protocols.*/ssl_protocols = !SSLv2 !SSLv3/g' \
70 /etc/dovecot/conf.d/10-ssl.conf || true
73 service dovecot restart || true