mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
check .pem existence and concat to combined.pem with added eol
Checks existince of cert, chain and privkey.pem. Concats these files to combined.pem and adds a linebreak after each file if there were none. This commit doesn't change the LE created .pem files, so no unlinking on the host should happen (see https://github.com/tomav/docker-mailserver/pull/111)
This commit is contained in:
parent
5048f8b509
commit
d2bb97a810
|
@ -120,17 +120,18 @@ 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
|
||||||
sed -i -r 's/smtpd_tls_key_file=\/etc\/ssl\/private\/ssl-cert-snakeoil.key/smtpd_tls_key_file=\/etc\/letsencrypt\/live\/'$(hostname)'\/privkey.pem/g' /etc/postfix/main.cf
|
sed -i -r 's/smtpd_tls_key_file=\/etc\/ssl\/private\/ssl-cert-snakeoil.key/smtpd_tls_key_file=\/etc\/letsencrypt\/live\/'$(hostname)'\/privkey.pem/g' /etc/postfix/main.cf
|
||||||
|
|
||||||
# Courier configuration
|
# Courier configuration
|
||||||
cat "/etc/letsencrypt/live/$(hostname)/cert.pem" "/etc/letsencrypt/live/$(hostname)/chain.pem" "/etc/letsencrypt/live/$(hostname)/privkey.pem" > "/etc/letsencrypt/live/$(hostname)/combined.pem"
|
|
||||||
sed -i -r 's/TLS_CERTFILE=\/etc\/courier\/imapd.pem/TLS_CERTFILE=\/etc\/letsencrypt\/live\/'$(hostname)'\/combined.pem/g' /etc/courier/imapd-ssl
|
sed -i -r 's/TLS_CERTFILE=\/etc\/courier\/imapd.pem/TLS_CERTFILE=\/etc\/letsencrypt\/live\/'$(hostname)'\/combined.pem/g' /etc/courier/imapd-ssl
|
||||||
|
|
||||||
# POP3 courier configuration
|
# POP3 courier configuration
|
||||||
|
@ -141,6 +142,7 @@ case $DMS_SSL in
|
||||||
|
|
||||||
echo "SSL configured with letsencrypt certificates"
|
echo "SSL configured with letsencrypt certificates"
|
||||||
|
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"custom" )
|
"custom" )
|
||||||
|
|
Loading…
Reference in a new issue