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:HIGH/g' \
37 /etc/dovecot/conf.d/10-ssl.conf || true
40 cp_check_and_sed 'ssl_cipher_list' \
42 /etc/dovecot/conf.d/10-ssl.conf || true
45 cp_check_and_sed '#ssl =' \
47 /etc/dovecot/conf.d/10-ssl.conf || true
50 cp_check_and_sed 'ssl = no' \
51 's/^ssl = no/ssl = yes/g' \
52 /etc/dovecot/conf.d/10-ssl.conf || true
54 if ! grep -q ^ssl_cert /etc/dovecot/conf.d/10-ssl.conf \
55 && ! grep -q ^ssl_key /etc/dovecot/conf.d/10-ssl.conf; then
57 if [ ! -f /etc/dovecot/dovecot.pem -a ! -f /etc/dovecot/private/dovecot.pem ]; then
58 echo "CN: Generating certificate and key..."
59 /usr/share/dovecot-cn/mkcert.sh || true
62 cp_check_and_sed '#ssl_cert = </etc/dovecot/dovecot.pem' \
63 's|#ssl_cert = </etc/dovecot/dovecot.pem|ssl_cert = </etc/dovecot/dovecot.pem|g' \
64 /etc/dovecot/conf.d/10-ssl.conf || true
65 cp_check_and_sed '#ssl_key = </etc/dovecot/private/dovecot.pem' \
66 's|#ssl_key = </etc/dovecot/private/dovecot.pem|ssl_key = </etc/dovecot/private/dovecot.pem|g' \
67 /etc/dovecot/conf.d/10-ssl.conf || true
68 # negdje se pojavljuje dovecot.key
69 cp_check_and_sed 'ssl_key = </etc/dovecot/private/dovecot.key' \
70 's|ssl_key = </etc/dovecot/private/dovecot.key|ssl_key = </etc/dovecot/private/dovecot.pem|g' \
71 /etc/dovecot/conf.d/10-ssl.conf || true
76 # dodao ico, gasi SSLv3 protokol
77 cp_check_and_sed '#ssl_protocols =' \
78 's/^#ssl_protocols.*/ssl_protocols = !SSLv3/g' \
79 /etc/dovecot/conf.d/10-ssl.conf || true
81 # dodao zelja, gasi stare SSL protokole
82 cp_check_and_sed 'ssl_protocols =' \
84 /etc/dovecot/conf.d/10-ssl.conf || true
86 # dodao zelja, gasi stare SSL protokole/ciphere u 95-cn9-upgrade.conf ako postoje
87 if [ -f /etc/dovecot/conf.d/95-cn9-upgrade.conf ]; then
88 cp_check_and_sed 'ssl_protocols =' \
90 /etc/dovecot/conf.d/95-cn9-upgrade.conf || true
91 cp_check_and_sed 'ssl_cipher_list' \
93 /etc/dovecot/conf.d/95-cn9-upgrade.conf || true
97 service dovecot restart || true