DNS - Unable to use underscore _ in TXT record name

I tried to ad a TXT record with an underscore in the name, example:
_something.mydomain.tld
However I get this error:
Failed to save record : '_something.mydomain.tld' is not a valid record name
If I remove the underscore from it, I can add the record.
Underscore should afaik be legal i several record types, the very least TXT, SRV and CNAME.
Tested with CNAME and got the same result.

SYSTEM INFORMATION
OS type and version Ubuntu Linux 24.04.4
Webmin version 2.641
Usermin version 2.540
Virtualmin version 8.1.0 Professional
Theme version 26.41.1
Nginx version 1.24.0

Works fine for me? I create TXT, CNAME, and A record with an underscore in the name without trouble.

So…are you sure there’s not something else wrong?

Oh, wait, I’m assuming you’re talking about the BIND module, but you haven’t actually specified that. Where are you adding these records? Local BIND or a cloud provider or something else?

Maybe I am doing this the wrong way around but it makes sense for me it should work both ways?

So editing the zone from Virtualmin (realising this is a virtualmin thread, I should really be in bed by now…) works, Virtualmin > DNS > DNS Recordsand adding a TXT record with a _ inthe beginning of the name worked.

Doing the same from Webmin > Servers > Bind DNS Server > [zone] > Text and adding a TXT record with _ in the beginning fails. Suppose it could be done from the Edit Zone Records File though.

(Moving this thread to Webmin)

I’m able to do it directly in the BIND module, as well. So, this is confusing. You absolutely should be able to create a record with an underscore via any path in Virtualmin or Webmin, and I can’t reproduce not being able to, thus far.

Still trying…

see pictures below.
I have tried on two different webmin servers now, on four different zones, one newly created mydomain.tld
All attempts end up with the same thing, as soon as a _ is in the beginning of the name it fails.
Removing the _ succeeds.

images

Ah, hell, this is a new bug. I was testing on an older Webmin.

I can reproduce it, will fix it shortly.

Or, wait, it’s more complicated than that.

That ticket indicates the option was disabled by default in new installs (it’s configurable in the BIND module configuration, click the :gear: icon) due to BIND no longer allowing _ in many record types, but that was overzealous. It should still be allowed in TXT, CNAME, SRV, PTR, TLSA, CAA, NAPTR records, regardless of that config option.

So, it’s a bug, but not a super simple one. Working on it.

Fixed in this PR: Allow underscore in TXT, CNAME, etc. by swelljoe · Pull Request #2725 · webmin/webmin · GitHub

Jamie just merged it, so it will be in the next Webmin version.

Awesome, that was quick work, thank you!