-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report: Underscore in CNAME Record Name Treated as Invalid DNS Hostname #494
Comments
https://github.com/peteeckel/netbox-plugin-dns/blob/main/docs/using_netbox_dns.md
|
@erfanian: Thanks for reporting this. I'll look into the RFCs in detail shortly and if your findings are correct ( Meanwhile you can use the workaround provided by @kollross so you can continue working. |
When you work through the RFCs you'll find some very interesting things that don't exactly make the approach to validating DNS names more obvious - this is a good example for it. It's well known that there are apparently conflicting definitions in the RFCs. While RFC 1035 is quite restrictive at first sight, there's also RFC2181 that basically says "anything is possible", but then delegates responsibility for the decision what is a valid owner or value to the user of the records. In some cases this can also have strange effects. When you use
At first sight, this seems inconspicuous. Then you'll notice that according to As a first solution that will cover the use case you mentioned (leading undescore in CNAME owner) I will add |
Thank you very much for your prompt response and suggested solution. |
Versions
NetBox Version: 4.1.4
NetBox DNS Version: 1.1.5
Python Version: 3.12.3
Describe the bug
While attempting to create a CNAME record with an underscore in the name, such as _test.example.com, the following error was encountered:
'_test.example.com is not a valid DNS host name'
This indicates that the plugin validates the CNAME record's owner name based on the hostname convention, disallowing underscores. However, per RFC 1034, Section 3.6, underscores are allowed in the context of DNS names, including for CNAME record owners.
Expected Behavior
The owner name of a CNAME record should not be validated strictly as a hostname, as underscores are permissible in DNS names. For example:
_test.example.com should be treated as a valid owner name.
According to RFC 1034, Section 3.6:
Owner: "The domain name where the RR is found." This encompasses any valid domain name, not just a hostname.
RDATA for CNAME: "A domain name," which does not prohibit the use of underscores.
It is easy to test with named-checkzone.
You can find more information at this link.
https://serverfault.com/questions/834679/is-underscore-illegal-in-a-cname-record
Observed Behavior
The plugin enforces hostname rules for CNAME owner names, leading to rejection of valid use cases, such as _test.example.com.
To Reproduce
Steps to reproduce the behavior:
1.Navigate to the DNS plugin in NetBox.
2. Attempt to add a CNAME record with _test.example.com as the owner name.
3. Observe the error message: _test.example.com is not a valid DNS host name.
Impact
This limitation prevents the creation of valid CNAME records for use cases such as:
DKIM (_domainkey subdomains).
Service discovery (_service._protocol subdomains.
Suggested Resolution
Update the plugin's validation logic to:
Differentiate between hostnames and DNS names when validating the owner field.
Allow underscores (_) in DNS names for CNAME records, in line with RFC 1034 and RFC 2181.
The text was updated successfully, but these errors were encountered: