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.98k stars 1.44k forks source link

Custom DNS does not work for specific URL | always shows wrong IP #1973

Open cmasterdelphi opened 3 years ago

cmasterdelphi commented 3 years ago

Short Description:

1 specific URL on my MiaB Custom DNS entry won't resolve at all or not correctly and will always point directly to my MiaB

Long description

I have a couple of domains pointing to my MiaB and sofar, all of them worked great. Today I noticed (but this could be already an issue for quite some time) that one single Domain did not respond at all. (Host unreachable via Ping) I checked but everything as set up ok (like the other domains) so I rebooted MiaB with no success. Next, I deleted the custom DNS entry and set it again. Now it resolves to my MiaB but not to the custom DNS entry. It simply won't forward / show the correct IP no matter what.

Idea

The only difference I have in this domain compared to the others is, that it uses a "-" in its domainname. Could that be an issue? It was working great sofar but not anymore.

//edit: Sub-Domains including a "-" are not effected. (eg. a-b.domain.xyz) but only a-b.xyz is

History

Last time it definitely worked was February 17th 2021. Back then I set up a DNS01 challenge for this domain (instead of HTTP01) with the acme.sh script and everything worked fine. This was on v0.52 - I updated to v.53 somewhere at the end of April but didn't check if all websites are still accessible. So it could be an issue with 0.53

//edit: also the status website shows for the specific domain a MTA-STS error MTA-STS policy is missing: STSFetchResult.NONE

System

Mail-in-a-Box. v0.53 Running on Ubuntu: 18.04.05 (all updates made)

cmasterdelphi commented 3 years ago

"/home/user-data/dns/custom.yaml" looks just fine ./mailinabox/tools/dns_update --force didn't bring any success either. Still wrong IP is showing

cmasterdelphi commented 3 years ago

Could my problem be related to this issue? I am not really capable to understand what's going on:

https://discourse.mailinabox.email/t/solved-but-a-bug-miab-dns-added-new-custom-dns-did-not-work/5550

cmasterdelphi commented 3 years ago

I checked the log file under /etc/log/nsd.log and it shows as following:

[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:6: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:7: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:8: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:9: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:10: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:11: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:12: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:13: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:14: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:15: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: my-domain.info.txt.signed:16: CNAME and other data at the same name
[2021-05-05 08:32:37.852] nsd[988]: error: zone my-domain.info file my-domain.info.txt.signed read with 11 errors

But I dont really now, what I should do now.

PS: the same issue occurs for 4 of 8 other domains. For those 4 domains, I cannot add working custom dns entries anymore. So it seems to be related to this errors or the nsd.

Can someone please help me or give me a hint?

cmasterdelphi commented 3 years ago

I was going through https://github.com/mail-in-a-box/mailinabox/issues/1870 and https://github.com/mail-in-a-box/mailinabox/issues/1041 where it is discussed, that creating a domain cannot use a CNAME but only an A record but I don't understand why and it was working till the last update and now it works only on half my domains?

My Setup looks kinda like this:

Domain Type IP
domain1.com A 127.0.0.0
sub1.domain1.com A 127.0.0.0
domain2.com CNAME sub1.domain1.com
www.domain2.com CNAME domain2.com
domain3.com CNAME sub1.domain1.com
www.domain3.com CNAME domain3.com

The reason is, so I can easily switch many domains from one IP to another by only changing 1 entry. It worked but not anymore. Is this causing my issues?

//edit: it might be the case. (Link: https://www.freecodecamp.org/news/why-cant-a-domain-s-root-be-a-cname-8cbab38e5f5c/) I haven't succeeded yet because I do not now to to fix this nsd errors but simply changing from CNAME to A Record didn't do the trick

cmasterdelphi commented 3 years ago

@lorena1976 could you please delete the not necessary quotations please?

Can anybody else give me a hint or has some ideas how to solve this problem?

JoshData commented 3 years ago

@cmasterdelphi It's a spam bot. It's already blocked. I will delete the comments.

cmasterdelphi commented 3 years ago

Finally I was able to solve my problem of non-reachable domain. Changing from CNAME records to A records from the root level of the domain itself did the trick. I didn't simply notice the first time I tried because my DNS was cached. (I cleared my local cache but forgot, that just recently installed a PiHole and of course, the IPs where cached there too) So the ticket can be closed.

Please note, that my initial thought of managing various domains with a single A record using CNAME is not feasible. I am sure, there is a need for this besides my own and I found out, that various hosters did implement their own custom solution to work around the RFC. Sadly, this isnt a standard. So for anyone with my or similar issue: currently there is no way around than by using A records for each domain.

Synchro commented 3 years ago

This sounds like exactly what ANAME records were designed for. Might be a nice addition.

cmasterdelphi commented 3 years ago

That would be great indeed. Also on the mailinabox-discourse it was already requested/mentioned. Would be great to have it. https://discourse.mailinabox.email/t/dns-alias-aname/7635