Simplified check for subdomain inclusion in certificate.

This commit is contained in:
pitchum 2020-03-25 12:20:23 +01:00
parent 5e6e53142b
commit ceaacfbd97

View file

@ -643,11 +643,10 @@ def _prepare_certificate_signing_request(domain, key_file, output_folder):
if domain == _get_maindomain():
# Include xmpp-upload subdomain in subject alternate names
subdomain="xmpp-upload." + domain
try:
_check_domain_is_ready_for_ACME(subdomain)
if _dns_ip_match_public_ip(get_public_ip(), subdomain):
logger.info("Subdmain {} is ready for ACME and will be included in the certificate.".format(subdomain))
csr.add_extensions([crypto.X509Extension("subjectAltName", False, "DNS:" + subdomain)])
except YunohostError:
else:
logger.warning(m18n.n('certmanager_warning_subdomain_dns_record', subdomain=subdomain, domain=domain))
# Set the key