peteeckel / netbox-plugin-dns

NetBox DNS is a NetBox plugin for managing DNS data.
https://pypi.org/project/netbox-plugin-dns
MIT License
191 stars 14 forks source link

Rejects record names with underscores #86

Closed bentosquares closed 10 months ago

bentosquares commented 10 months ago

Versions NetBox Version: 3.6.4 NetBox DNS Version: 0.20.2 Python Version: 3.9.5

Describe the bug When attempting to create a record with a name that includes an underscore such as qtr._domainkey.domain.com, the plugin displays "Not a valid DNS host name" and will not save the record.

peteeckel commented 10 months ago

Hi @bentosquares, could you please provide the full record, including its type?

By default, TXT and SRV records allow underscores, while others don't.

If you have a need for other record types for which underscores in labesls should be allowed, you can change the default setting

        "tolerate_leading_underscore_types": [
            "TXT",
            "SRV",
        ],

If you want to allow underscores generally (for example because you need to interact with Microsoft AD DNS), you can also set

        "tolerate_underscores_in_hostnames": True,
bentosquares commented 10 months ago

It's a CNAME record, so that explains it. Where should those settings be entered? They do not look to be the correct format for the PLUGINS_CONFIG parameter of configuration.py.

peteeckel commented 10 months ago

It's a CNAME record, so that explains it. Where should those settings be entered? They do not look to be the correct format for the PLUGINS_CONFIG parameter of configuration.py.

They are (with some context, though):

PLUGINS_CONFIG = {
    "netbox_dns": {
        "tolerate_leading_underscore_types": [
            "TXT",
            "SRV",
            "CNAME", 
        ],   
    },
}

should do in your case.

bentosquares commented 10 months ago

Awesome, thanks!