mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
13.99k stars 1.44k forks source link

status check errors for secondary domain when using external DNS with @, www A records at different IP #1978

Open melato opened 3 years ago

melato commented 3 years ago

Description

If I use external DNS for a mailinabox secondary domain and set the @ and www A/AAAA records to a different IP than the mailinabox IP (MX) then mailinabox shows errors in the status page about.

Steps to reproduce

Result

The Status page shows three errors (not warnings).

Expected Result

There should be no errors. There could be warnings.

Workaround

I can get rid of the errors, by setting the A record in Custom DNS, even though I'm not using the Mail-In-A-Box DNS nameserver:

melato commented 3 years ago

The workaround works because the status page checks for custom DNS settings of the @ A record uses this code: management/status_checks.py:

# Get the list of domains that we don't serve web for because of a custom CNAME/A record.
domains_with_a_records = get_domains_with_a_records(env)

management/web_update.py:

def get_domains_with_a_records(env):
    domains = set()
    dns = get_custom_dns_config(env)
    for domain, rtype, value in dns:
        if rtype == "CNAME" or (rtype in ("A", "AAAA") and value not in ("local", env['PUBLIC_IP'])):
            domains.add(domain)
    return domains

Perhaps a solution would be for get_domains_with_a_records to do a DNS query for the A record, instead of looking for custom DNS settings.

There is a related enhancement request: #404

ttimpe commented 3 years ago

Please, finally fix this. I've been using MIAB since the beginning and assuming that I want it to handle all of my DNS for all of my domains is just a little too much. Give me per-domain checkboxes or radioboxes. 🔘Just mail, contacts, calendar 🔘Website hosting (root domain and www should resolve to this server) 🔘Have MIAB be the primary nameserver for this domain

This would remove a lot of clutter on the status check dashboard.

JoshData commented 3 years ago

Really not interested in having folks demand that other contributors add new features, so I blocked @ttimpe.