1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-23 02:27:05 +00:00

Try to print MTA-STS missing DNS policy error reason

When proper (not self-signed) TLS certificate is not provisioned on the domain yet,
MiaB prints only:

MTA-STS policy is missing: STSFetchResult.NONE

which may confuse the administrator, as .well-known/mta-sts.txt
file is already present and opens correctly.

Print more human-friendly reason for this case.
This commit is contained in:
ValdikSS 2020-12-17 23:16:39 +03:00
parent 8664afa997
commit ab7a5d4e4d

View File

@ -660,7 +660,16 @@ def check_mail_domain(domain, env, output):
else: else:
output.print_error("MTA-STS policy is present but has unexpected settings. [{}]".format(policy[1])) output.print_error("MTA-STS policy is present but has unexpected settings. [{}]".format(policy[1]))
else: else:
output.print_error("MTA-STS policy is missing: {}".format(valid)) certmessage = ''
cert = get_ssl_certificates(env).get(domain)
if not cert:
certmessage = "No TLS certificate provisioned for this domain"
else:
cert_status = check_certificate(domain, cert['certificate'], cert['private-key'])
if cert_status[0] != 'OK':
certmessage = "TLS certificate is not valid"
output.print_error("MTA-STS policy is missing: {}".format(certmessage if certmessage else valid))
else: else:
output.print_error("""This domain's DNS MX record is incorrect. It is currently set to '%s' but should be '%s'. Mail will not output.print_error("""This domain's DNS MX record is incorrect. It is currently set to '%s' but should be '%s'. Mail will not