1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2026-07-30 00:23:39 +00:00

[ACME] Skip autodiscover/mta-sts subdomains covered by wildcard certificates

This commit is contained in:
FreddleSpl0it
2026-03-13 12:35:22 +01:00
parent 09f09cb850
commit 127fb1e8f5
2 changed files with 40 additions and 5 deletions
+22
View File
@@ -135,3 +135,25 @@ verify_challenge_path(){
return 1
fi
}
# Check if a domain is covered by a wildcard in ADDITIONAL_SAN
# Usage: is_covered_by_wildcard "subdomain.example.com"
# Returns: 0 if covered, 1 if not covered
is_covered_by_wildcard() {
local DOMAIN=$1
# Return early if no ADDITIONAL_SAN is set
if [[ -z ${ADDITIONAL_SAN} ]]; then
return 1
fi
# Extract parent domain (e.g., mail.example.com -> example.com)
local PARENT_DOMAIN=$(echo ${DOMAIN} | cut -d. -f2-)
# Check if ADDITIONAL_SAN contains a wildcard for this parent domain
if [[ "${ADDITIONAL_SAN}" == *"*.${PARENT_DOMAIN}"* ]]; then
return 0 # Covered by wildcard
fi
return 1 # Not covered
}