Merge pull request #118 from Reldeis/master

check .pem existence and concat to combined.pem with added eol.

Minor changes to command line that combine certs.
This commit is contained in:
angus 2016-04-09 00:27:33 +02:00
commit a083292850

View file

@ -141,10 +141,12 @@ fi
case $DMS_SSL in case $DMS_SSL in
"letsencrypt" ) "letsencrypt" )
# letsencrypt folders and files mounted in /etc/letsencrypt # letsencrypt folders and files mounted in /etc/letsencrypt
# add eol to all files before concatenation if [ -e "/etc/letsencrypt/live/$(hostname)/cert.pem" ] \
sed -i -e '$a\' /etc/letsencrypt/live/$(hostname)/cert.pem && [ -e "/etc/letsencrypt/live/$(hostname)/chain.pem" ] \
sed -i -e '$a\' /etc/letsencrypt/live/$(hostname)/chain.pem && [ -e "/etc/letsencrypt/live/$(hostname)/privkey.pem" ]; then
sed -i -e '$a\' /etc/letsencrypt/live/$(hostname)/privkey.pem echo "Adding $(hostname) SSL certificate"
# create combined.pem from (cert|chain|privkey).pem with eol after each .pem
sed -e '$a\' -s /etc/letsencrypt/live/$(hostname)/{cert,chain,privkey}.pem > /etc/letsencrypt/live/$(hostname)/combined.pem
# Postfix configuration # Postfix configuration
sed -i -r 's/smtpd_tls_cert_file=\/etc\/ssl\/certs\/ssl-cert-snakeoil.pem/smtpd_tls_cert_file=\/etc\/letsencrypt\/live\/'$(hostname)'\/fullchain.pem/g' /etc/postfix/main.cf sed -i -r 's/smtpd_tls_cert_file=\/etc\/ssl\/certs\/ssl-cert-snakeoil.pem/smtpd_tls_cert_file=\/etc\/letsencrypt\/live\/'$(hostname)'\/fullchain.pem/g' /etc/postfix/main.cf
@ -156,6 +158,7 @@ case $DMS_SSL in
echo "SSL configured with letsencrypt certificates" echo "SSL configured with letsencrypt certificates"
fi
;; ;;
"custom" ) "custom" )