X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostinst;h=95c1ccb4fd802813e2da78006944abca265321d4;hb=c1961f4fb4746d65968ac20fc77af7a3b13b696d;hp=110f226795b6708027fb7d03922c455aef2b110f;hpb=0e6678d145ec4d219dc722f1fec0be0eab122bc7;p=dovecot-cn.git diff --git a/debian/postinst b/debian/postinst index 110f226..95c1ccb 100755 --- a/debian/postinst +++ b/debian/postinst @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/bin/sh + +set -e [ "$1" = "configure" ] || exit 0 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx @@ -31,7 +33,12 @@ cp_check_and_sed 'pop3_client_workarounds' \ /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 @@ -39,18 +46,101 @@ cp_check_and_sed '#ssl =' \ 's/^#ssl =/ssl =/g' \ /etc/dovecot/conf.d/10-ssl.conf || true -# dodao ico, gasi stare SSL protokole -cp_check_and_sed '#ssl_protocols =' \ - 's/^#ssl_protocols.*/ssl_protocols = !SSLv2 !SSLv3/g' \ +# trazio zelja +cp_check_and_sed 'ssl = no' \ + 's/^ssl = no/ssl = yes/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 +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 =