letsencrypt & traefik wildcard support

set SSL_DOMAIN=*.example.com to extract a wildcard certificate from traefiks acme.json store
This commit is contained in:
Michael Sprauer 2020-07-07 21:30:40 +02:00
parent 3a3cec6a8f
commit d61a8cd9c0
9 changed files with 17 additions and 13 deletions

View file

@ -64,7 +64,11 @@ if [[ $chksum == *"FAIL"* ]]; then
flock -e 200
if [[ $chksum == *"/etc/letsencrypt/acme.json: FAILED"* ]]; then
(extractCertsFromAcmeJson "$HOSTNAME" || extractCertsFromAcmeJson "$DOMAINNAME")
for certdomain in $SSL_DOMAIN $HOSTNAME $DOMAINNAME; do
if extractCertsFromAcmeJson "$certdomain"; then
break
fi
done
fi
#regen postix aliases.

View file

@ -7,7 +7,7 @@
# matches the local IP (ie. you're connecting from the same computer), the
# connection is considered secure and plaintext authentication is allowed.
# See also ssl=required setting.
#disable_plaintext_auth = yes
disable_plaintext_auth = no
# Authentication cache size (e.g. 10M). 0 means it's disabled. Note that
# bsdauth, PAM and vpopmail require cache_key to be set for caching to be used.
@ -121,7 +121,7 @@ auth_mechanisms = plain login
#!include auth-system.conf.ext
#!include auth-sql.conf.ext
######!include auth-ldap.conf.ext
#######!include auth-ldap.conf.ext
!include auth-passwdfile.inc
#!include auth-checkpassword.conf.ext
#!include auth-vpopmail.conf.ext

View file

@ -3,7 +3,7 @@
##
# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
ssl = required
ssl = yes
# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
# dropping root privileges, so keep the key file unreadable by anyone but

View file

@ -4,11 +4,11 @@
# Address to use when sending rejection mails.
# Default is postmaster@<your domain>. %d expands to recipient domain.
postmaster_address = postmaster@domain.com
postmaster_address = postmaster@my-domain.com
# Hostname to use in various parts of sent mails (e.g. in Message-Id) and
# in LMTP replies. Default is the system's real hostname@domain.
#hostname =
hostname = mail.my-domain.com
# If user is over quota, return with temporary failure instead of
# bouncing the mail.

View file

@ -15,7 +15,7 @@
# to give additional 100 MB when saving to Trash:
plugin {
#quota_rule = *:storage=1G
#quota_rule = *:storage=0
#quota_rule2 = Trash:storage=+100M
# LDA/LMTP allows saving the last mail to bring user from under quota to
@ -75,6 +75,6 @@ plugin {
plugin {
#quota = dict:user::proxy::quota
#quota2 = dict:domain:%d:proxy::quota_domain
#quota_rule = *:storage=102400
#quota_rule = *:storage=0
#quota2_rule = *:storage=1048576
}

View file

@ -1 +1,2 @@
mail_max_userip_connections = 69
recipient_delimiter = ~

View file

@ -17,10 +17,8 @@
"Certificates": [
{
"domain": {
"main": "mail.my-domain.com",
"sans": [
"mail2.my-domain.com"
]
"main": "example.com",
"sans": ["*.example.com"]
},
"certificate": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1RENDQWN5Z0F3SUJBZ0lKQU4vKzNMTVF2bnYxTUEwR0NTcUdTSWIzRFFFQkN3VUFNQkl4RURBT0JnTlYKQkFNTUIzUmxjM1F0WTJFd0hoY05NakF3TmpJNU1qQTFOVEl4V2hjTk1qQXdPREk0TWpBMU5USXhXakFXTVJRdwpFZ1lEVlFRRERBdGxlR0Z0Y0d4bExtTnZiVENDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dFUEFEQ0NBUW9DCmdnRUJBTDVVTmc3eWJyWG9DSW5teFErZjM4KytzTEVjZ0c2UDBYK2ZhSDExQnc0N1Z0K21mMXZsdEloN29qTzgKRGVYcUZ4c0dMM1MvWXF5dVhYMFRHSU9oL2Nzam52djFHRUwxVXgwWUNzeUZrdmZsYjhOdVNLVzUyVDBkblVxRgpaRndsZHlrQ3dIblF4bXdZWnhuWmpWRjJZT3IvS21HWnZPNWR4U1RzL3FEdVUwY3AzRkQ0ejJDQkVMTG16aXh2CmZPMkxnazFZbi9IOW1OTE5TS1FhaVNlQ3hJZDVDek5JbG1VSWZuTDB0dWMzbjJmTmlnanVQS09WMkgvN05WVFQKVHJpdVAzODRieDlXVExmWDI5Y24rSG80aEtCYXEydDFXbXoranNXaTFneWExS3JMQU00enpRSE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FicnlPWlA3YVB0T0lWWnBZSDc3cU1ySjR2RmJ6MkphQTFiMWlySgoyMkhkajFYRDdMdjJ1cXQ3UVVsYU5RY3VrSkZJSE94WVJOWUNobEpuSUVmMmU3MGpkbEN4TGc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=",

0
test/config/user-patches/user-patches.sh Normal file → Executable file
View file

View file

@ -34,6 +34,7 @@ function setup_file() {
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-e DMS_DEBUG=0 \
-e SSL_TYPE=letsencrypt \
-e "SSL_DOMAIN=*.example.com" \
-h mail.my-domain.com -t ${NAME}
wait_for_finished_setup_in_container mail_lets_acme_json
@ -114,7 +115,7 @@ function teardown_file() {
cp "`pwd`/test/config/letsencrypt/acme-changed.json" "`pwd`/test/config/acme.json"
sleep 11
run docker exec mail_lets_acme_json /bin/bash -c "supervisorctl tail changedetector"
assert_output --partial "Cert found in /etc/letsencrypt/acme.json for mail.my-domain.com"
assert_output --partial "Cert found in /etc/letsencrypt/acme.json for *.example.com"
assert_output --partial "postfix: stopped"
assert_output --partial "postfix: started"
assert_output --partial "Update checksum"