mirror of
https://github.com/acme-dns/acme-dns.git
synced 2026-04-27 04:45:48 +03:00
[GH-ISSUE #238] NS and A record can both exist for 1 domain? #117
Labels
No labels
Documentation
Documentation
bug
enhancement
feature request
feature request
help wanted
pull-request
question
security
security
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/acme-dns#117
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DiveInto on GitHub (Aug 20, 2020).
Original GitHub issue: https://github.com/acme-dns/acme-dns/issues/238
in README.md:
seems the doc above assumes that for the domain: auth.example.org, NS record and A record can exist at the same time, but in Cloudflare, I failed to do so.
After add an A record for my domain: my-dns-server.xxx.com, I failed to add NS record for it, the error is: non-NS records already exists with that host. (Code: 81055)
@jvanasco commented on GitHub (Aug 28, 2020):
In Cloudflare, I have 2 records:
In acme-dns' config file, I have 3 records:
This is based on the older setup instructions, but this has worked for several years and works with the current codebase.
A lot more people seem to have issues with the current setup instructions than the older ones (which also caused issues)
@OneAceGuy commented on GitHub (Sep 4, 2020):
Thanks @jvanasco . I am one of the people who is confused by the instructions, but I blame my lack of knowledge and experience, not necessarily the instructions.
Can you provide your insights on the naming convention for these entries? I have changed them around based on what makes sense to me, but I am trying to learn why this might NOT be correct:
This all matters because I get confused with what the values should be provided in the
config.cfgfile. From the instructions:Based on the NS and A records from your cloudflare example, I would guess the values would be:
which further confuses me. Did I misunderstand how these pieces fit together?
I appreciate your assistance in helping me understand. I have read so much on this, I think I have just confused myself (RFC-1034, RFC-1035, RFC-2606, RFC-4367, RFC-2219, and tons of blogs, write-ups, and unhelpful youtube videos!).
Thanks again for your insights.
@jvanasco commented on GitHub (Sep 4, 2020):
Here is the read me at an earlier version, which uses these names and has descriptions :
github.com/joohoi/acme-dns@0991b3e3c9/README.mdIt was changed to the new names for clarity, but I find this set of instructions easier.
@OneAceGuy commented on GitHub (Sep 4, 2020):
That's interesting, thanks for the link.
So if I read that correctly, the older instructions assumed there was an A record for the ns1.xxx.xxx.xxx, in addition to the NS record? Or maybe at some point it was realized that you can simply add an NS record, point it to the A record and call it a day (i.e. simplify the host DNS records). I will have to think on this, probably do some experimenting to verify.
One other item I noticed in the older readme, the tls parameter is set to "none"; in the newer version it is set to "letsencryptstaging". @rtfmoz2 found this change was causing a problem starting acme-dns as a service and reported as issue #228.
@OneAceGuy commented on GitHub (Sep 6, 2020):
Following up after more investigation and documenting what I learned so future confused people can hopefully benefit.
The way I have been thinking about how NS records work is in fact incorrect. The critical assumption here is that
acme-dns.example.comnot only specifies a subdomain, but also represents a DNS sub-zone that will be independently managed (i.e. a separate name server) which will be responsible for that subdomain. This implies that everything atacme-dns.example.com, including additional sub-domains (i.e.www.acme-dns.example.com, orfoo.bar.acme.dns.example.com) would be managed by this other nameserver that will be identified in the NS record. This is what we want, and exactly what @joohoi states in his instructions.DNS servers process in a series of recursions that work through referrals. NS records ARE the referrals. So to resolve
acme-dns.example.comwe would start with root nameservers that have NS records that refer to top level domains (TLDs), such as "com.", "net.", "org,", etc. The root nameservers do not contain records for our specificacme-dns.example.com, but they have referrals (NS Records) to nameservers forcom., matching the first part of our query (the farthest to the right). Now the server will re-query foracme-dns.example.comto just thecom.nameservers. Thecom.nameservers will have a NS record forexamplewhich will be another referral to nameservers responsible forexample.com. This will repeat again, querying foracme-dns.example.comto the nameserver(s) responsible forexample.comdomain until it findsacme-dns.example.com.This recursion will continue until it a) finds an appropriate A record, known as a "glue record", which will point to the corresponding IP address and successfully resolve the query; or b) responds with NXDOMAIN (non-existent domain) because there were no more referrals (NS records) and no A records to successfully resolve the query.
Going back to our examples above, here is my revised commentary:
acme-dns.example.comIf you setup a new nameserver, you have to create a glue record (A record) for that NS entry, otherwise you will create a circular reference (an endless loop) in your DNS entries. Specifying the A record will avoid the loop and allow DNS queries to resolve correctly.
I know that @jvanasco and @joohoi have explained what the configuration settings should be, hopefully my sharing what I learned will help others understand why the settings need to be the way they are.
@clmcavaney commented on GitHub (Dec 16, 2020):
I think the critical point here is the NS records can only be FQDN entries not IP addresses. So, you have to specify a FQDN for the NS record.
That FQDN could be anything, but ideally another A record that you manage and can point to the IP address that is hosting the acme-dns DNS service (i.e. the service sitting behind port 53).
For example:
Then, taking ns1.google.com as example:
So, if google had a subdomain acme-dns.google.com there would be an NS record for that subdomain which could be anything and intern resolve to the appropriate IP address with the acme-dns service running.
Hope that helps to clarify some more.
@ahmadgfari commented on GitHub (Nov 29, 2021):
Hi @DiveInto just now I experienced the same thing, and I managed to find a way by deleting existing records before you add NS records. Make sure the existing records value has been applied in the new domain manager (delegated).
@GHosaPhat commented on GitHub (Feb 16, 2022):
Okay, so I'm trying to set this up myself and I want to thank both of you, @jvanasco and @OneAceGuy, for at least pointing me in a direction that appears to be helpful. The older version of the README seems much more clear to me as well, so thank you so much for posting that. However, I still have a couple of related questions.
First of all, other than saving a couple of keystrokes, I don't see how creating the
NSrecord forauth.example.orgpointing toauth.example.orgis any "simpler" than pointing it tons1.auth.example.orgsince you still need theArecord pointing to the public IP anyway. In fact, it seems to me that thens1.auth.example.orgversion actually makes the entire flow of DNS resolution more clear in the long run. The version that points directly back to itself (auth.example.org->auth.example.org) presents a loop in the logic in my mind, which I actually ran up against in my second point/question:Secondly, my DNS host would not allow me to set up the
NSrecord as defined in the current README (auth.example.org. 86400 IN NS auth.example.org.) because, when they tried to test that configuration with myArecord set up to point to my ACME-DNS server's public IP address, it resulted in an infinite loop of DNS lookups:By creating the
Arecord asns1.auth.example.org. 86400 IN A 198.51.100.1and theNSrecord pointing to that asauth.example.org. 86400 IN NS ns1.auth.example.org., it should "loop" once, but prevent the infinite recursion b/c the second lookup will actually be forns1.auth.example.orginstead of asking again for justauth.example.org. I believe thens1.xxx.xxx.xxxmethod is a more reliable way overall to ensure that the DNS host is able to avoid such infinite loop scenarios. Is there something simply inherent in the way that certain DNS servers/resolvers operate differently than others that causes this recursion issue, or am I just being dense?Finally, and somewhat tangentially, my (limited) understanding is that the
Arecord created in this process acts as a "glue" record. Now, I readily admit that I'm far from having an in-depth knowledge of DNS, so I'm still looking for a satisfying answer of what a "glue" record is, exactly, and, more importantly to me at this point is, is there any difference between creating a "glue" record and any otherArecord for the zone. Or, to ask it another way, if I were to look at just the "glue" record and anotherArecord in the zone, could I tell a difference (besides the specific details about the host, target, and TTL)?i.e., I don't see anything "special" that I have to do before, after, or during the creation of the
Arecord to flag it as a "glue" record. Unless it's simply that this particular (regular, old)Arecord exists in the zone to resolve the target of theNSrecord, and that's the only thing that identifies it as a "glue" record instead of any other, run-of-the-millArecord. If someone could please confirm/clarify this for me just so I can stop Googling, I'd greatly appreciate it.Just to provide a more "concrete" example to (maybe) help visualize this whole thing and answer the questions, here is the (redacted) zone file for the domain on which I am trying to set up my ACME-DNS server:
I'm still waiting for my DNS host to actually add the
NSrecord forauth.example.orgso I can't test everything out yet. But, if I'm correctly understanding what I'm reading here, that last line (theArecord forns1.auth.example.orgthat looks basically like every otherArecord in the zone) is a "glue" record. The only way one could know that it's specifically a glue record would be by looking at the entire zone and recognizing the fact that this particularArecord defines the IP address of one of theNSrecords in the zone.@webprofusion-chrisc commented on GitHub (Feb 17, 2022):
Pretty sure you just need the NS record [in your main DNS], which in turn delegates the lookup (including the A record) to the acme-dns service for that whole subdomain.
@GHosaPhat commented on GitHub (Feb 17, 2022):
Thanks for pointing out my less-than-clear explanation above, @webprofusion-chrisc and sorry for the confusion. The zone file I posted is for the main/root domain (with my DNS hosting service). I was trying to get some clarity regarding the specific DNS records required with the DNS host/resolver for the root of the domain, including the glue record pointing to the nameserver that will be hosted by my local ACME-DNS installation.
From what I understood reading the current README.md, it says to create the
Arecord without thens1prefix (auth.example.org) and theNSrecord pointed to thatArecord on the DNS server where the main/root domain is being resolved. However, my DNS host tells me that it can't be done like that (ref. the second section in my previous post). That's why it looks like the instructions for this process from the previous version of the README posted by @jvanasco seem like a more "accurate"/"reliable" configuration.Just for additional reference, I have the ACME-DNS server configured with the
Arecord for the delegatedauth.example.orgsubdomain:I hope that helps to clarify what I was trying to ask. Please let me know if I can provide any more detail, and thanks again.
EDIT: Actually, I just realized that I probably don't need the
Arecord forns1.auth.example.orgin the ACME-DNS configuration, since it's already set up on the main DNS host, so I'll go ahead and get rid of that. Still, I believe I have everything else set up "correctly" and, when my DNS host finally adds theNSrecord to my main domain's zone file, I should be able to get things rolling.@GHosaPhat commented on GitHub (Feb 17, 2022):
Okay. Please let me know if I'm completely off-base here but I believe I'm finally starting to fully understand what I'll need to do from start to finish with regards to configuration (at least in my environment). Here's basically what I've come up with:
One "gotcha" I believe I see in this process (and, I could certainly be wrong or simply over-thinking things) is with regards to the registration on the self-hosted acme-dns server. If I'm correct in my assumptions, I'll need to do that registration through my server - i.e., I can't register on
auth.acme-dns.ioand use those credentials on my self-hosted acme-dns server.@candlerb commented on GitHub (Feb 21, 2022):
Let me try to clarify this. Basically there are two ways the DNS setup can work work.
Options 1: your server's primary name is "acme.example.com". You then delegate the domain "acme.example.com" to this server, whose name also happens to be "acme.example.com" (yes that seems weird, but it is perfectly valid).
This delegation allows your server to respond to DNS queries for both
acme.example.comand<subdomain>.acme.example.comTo configure this, in the parent domain (example.com), you need to insert an NS record for the delegation:
You also need to insert glue record(s) into the parent domain, so that a resolver chasing the referral can solve the "chicken-and-egg" problem of needing the nameserver's IP address before it can do the resolution of name to IP address.
Then, on the acme-dns server itself, you also need to hold the authoritative, identical copy of all these records:
This is because the values in the parent zone are, in effect, just hints to the resolver. The resolver will use them to locate the authoritative nameserver, but will only return an answer fetched from the authoritative server itself.
You should also put the corresponding settings in the SOA record, although these don't really make much difference in practice, you're just documenting things for a human to see:
This is the way the sample configuration in the documentation works. And of course, the API endpoint is
https://acme.example.comOption 2: the acme-dns server has a different name outside of this zone, for example
nsa.example.netIn this case, the name
nsa.example.nethas been set up to resolve to IPv4 and/or IPv6 addresses already. So you just need a simple delegation with no glue:Within the zone, you still need to return these records:
This is because we still need
acme.example.comto resolve to the right address for the API endpointhttps://acme.example.com, and we need an authoritative in-zone copy of the NS record.Here are the matching SOA settings, again not really important:
Now, in this case you might think that
https://nsa.example.netwould also work as the API endpoint, because it resolves to the same IP address - but it doesn't. This is firstly because acme-dns only fetches a certificate for "acme.example.com"; it's unable to fetch one for nsa.example.net (well, maybe it could using a http-01 challenge, but it doesn't). And secondly, when an incoming https connection arrives, acme-dns looks at the Server Name Indication for the hostname that the client is trying to connect to, and when it sees the user is trying to talk to a host other than "acme.example.com" it drops the connection on the floor.Aside: there is an option 3, but you should forget about it. This is when your server is known as
ns1.acme.example.com(for delegation) andacme.example.com(for API). It requires even more records to be added to the acme-dns serverrecordssection, and it will just confuse you even more. You can make it work, but why bother when (1) and (2) are simpler?It's either/or.
If you register on
auth.acme-dns.io, then you put CNAME records pointing at<subdomain>.auth.acme-dns.io, and you send your DNS updates to the APIauth.acme-dns.io. The subdomain, username and password are all the ones which were returned fromauth.acme-dns.iowhen you registered.If you register on
acme.selfhosted.com, then you put CNAME records pointing at<subdomain>.acme.selfhosted.com, and you send your DNS updates to the API atacme.selfhosted.com. The subdomain, username and password are all the ones which were returned fromacme.selfhosted.comwhen you registered.It has to work like this: the same server that you registered with is the same one that's checking the username and password when you connect, against what's in its local database (postgres or sqlite). There's no crossover between these, because the databases aren't connected.
@ylbeethoven commented on GitHub (Aug 31, 2022):
Hi,
I've tried creating an A record for
ns.acme.example.comto a public IP and NS record foracme.example.compointing tons.acme.example.comas mentioned above. However, the NS record was not getting propagated at all. (I've waited for 2 days)DNS provider tested : Cloudflare, Hurricane electric
Can anyone please advise how to get this working? Thank you
@candlerb commented on GitHub (Aug 31, 2022):
Firstly, please don't hijack an existing issue with a new problem.
Secondly, I recommend you follow option 1 in the post above, especially if you don't really understand DNS. What you should do is in the master nameserver for the "example.com" zone, add an A record for "acme.example.com" pointing to a public IP and an NS record for "acme.example.com" pointing to "acme.example.com".
Don't attempt to use ns.acme.example.com as the name of the acme-dns server unless you fully understand DNS delegations and glue records. And unless you tell us the actual domain rather than "example.com", we can't give you any more specific advice.
@ylbeethoven commented on GitHub (Aug 31, 2022):
Hi @candlerb
Thanks for your reply and guidance.
I went back with Hurricane Electric which allows me to use option 1, after solving the default
listen: 127.0.0.1:53, it is now working as expected.P.S. The reason I created
ns.acme.example.comandacme.example.combecause this is howauth.acme-dns.ioset-up.@gimlichael commented on GitHub (Nov 16, 2022):
Agreed; much easier explanation - I actually got it to work now.
The current example leads to believe that everything should be tied to auth.example.org.
Thank you for resolving HOURS of diagnostication .. what also helped (and might help others) was this little tool: https://dig.ping.pe/
E.g., https://dig.ping.pe/965d5223-c904-43e9-860e-b64fce111f71.auth.example.org:TXT:8.8.8.8 returned
Status: NXDOMAINbut after your clearer finding, now returns965d5223-c904-43e9-860e-b64fce111f71.auth.example.org. 1 IN TXT "EOiXmyLVFGDxLAGz7yYjVdEjZC6NefLfgWdO8xIzdkW"https://dig.ping.pe/965d5223-c904-43e9-860e-b64fce111f71.auth.example.org:TXT:8.8.8.8
Note: auth.example.org should of course be changed with your domain name; this was just for clarity and link into current and previous documentation as highlighted by @jvanasco