OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 23.1 Legacy Series »
  • Unbound refuses to serve DNS records for DHCP leases with underscores
« previous next »
  • Print
Pages: [1]

Author Topic: Unbound refuses to serve DNS records for DHCP leases with underscores  (Read 1181 times)

bugfixin

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Unbound refuses to serve DNS records for DHCP leases with underscores
« on: July 13, 2023, 09:30:45 pm »
I have several DHCP clients that use hostnames with underscores which worked on an older version of OPNsense (~6+months ago? unfortunately I don't have great records there).

Now, unbound logs the error "dhcpd leases: XXX_XXX not a valid hostname, ignoring"

I understand that some RFCs advise against this or even forbid it, but there are many environments where this is de facto required. I don't think it's the place of software to police adherence to RFCs

Is there a way to force the records to be added?
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Unbound refuses to serve DNS records for DHCP leases with underscores
« Reply #1 on: July 13, 2023, 09:41:18 pm »
It's the way of software to conform to RFCs. Always.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

bugfixin

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: Unbound refuses to serve DNS records for DHCP leases with underscores
« Reply #2 on: July 13, 2023, 09:53:30 pm »
So why is it that I can add DNS records to virtually any DNS software with underscores in it, but not in this case. Media players play noncompliant files all the time. even in networking, flags are changed, things are played with all the time. If anything should balk at hostnames with underscores, shouldn't it be DHCPD instead of unbound?

This post isn't for arguing about RFCs, it's asking how do I tell unbound to do it anyway?
« Last Edit: July 13, 2023, 09:56:09 pm by bugfixin »
Logged

bugfixin

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: Unbound refuses to serve DNS records for DHCP leases with underscores
« Reply #3 on: July 13, 2023, 10:12:24 pm »
I was able to edit unbound_watcher.py at /usr/local/opnsense/scripts/dhcp/unbound_watcher.py to make
Code: [Select]
hostname_pattern = re.compile("(?!-)[A-Z0-9-_]*(?<!-)$", re.IGNORECASE). This allows unbound to serve the records properly.

Relevant commits:
https://github.com/opnsense/core/commit/02aae56f05f313e7a5bc59d1e2551864dbea9a12
https://github.com/opnsense/core/commit/2b89ff975f5f0e41c5edec9f3b6cc70967b38db8

FWIW I believe that this should be modified to DNS name rather than Host name, as DNS names allow underscores and there are plenty of real-world scenarios that this breaks. As this behavior was only changed 3 weeks ago, I expect more folks to be affected over time.
« Last Edit: July 13, 2023, 10:17:22 pm by bugfixin »
Logged

cookiemonster

  • Hero Member
  • *****
  • Posts: 1830
  • Karma: 95
    • View Profile
Re: Unbound refuses to serve DNS records for DHCP leases with underscores
« Reply #4 on: July 14, 2023, 11:46:56 am »
I've just updated my firewall from 22.7.11 to 23.1. today and I can see the change. The underscore was allowed prior to the update.
Code: [Select]
Date,Severity,Process,Line
2023-07-14T10:09:35 Warning unbound dhcpd leases: Honor_6X not a valid hostname, ignoring
2023-07-14T10:09:20 Warning unbound dhcpd leases: Honor_6X not a valid hostname, ignoring
2023-07-14T10:09:18 Warning unbound dhcpd leases: Honor_6X not a valid hostname, ignoring
2023-07-14T10:08:38 Warning unbound dhcpd leases: Honor_6X not a valid hostname, ignoring
2023-07-14T10:08:26 Warning unbound dhcpd leases: Honor_6X not a valid hostname, ignoring
2023-07-14T10:06:52 Warning unbound dhcpd leases: Honor_6X not a valid hostname, ignoring
2023-07-14T10:05:55 Warning unbound dhcpd leases: Honor_6X not a valid hostname, ignoring
2023-07-14T10:05:53 Warning unbound dhcpd leases: Honor_6X not a valid hostname, ignoring
2023-07-07T09:57:10 Notice unbound dhcpd expired Honor_6X @ 192.168.5.179
2023-06-21T11:04:34 Notice unbound dhcpd expired Honor_6X @ 192.168.5.179
2023-06-19T19:56:49 Notice unbound dhcpd expired Honor_6X @ 192.168.5.179
2023-06-16T08:19:50 Notice unbound dhcpd expired Honor_6X @ 192.168.5.179
2023-06-14T08:09:56 Notice unbound dhcpd expired Honor_6X @ 192.168.5.179
I'll ask on github logging it as a bug, which sounds like it isn't one if previous behaviour was against RFCs, if we can have the non-compliant behaviour back.
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 23.1 Legacy Series »
  • Unbound refuses to serve DNS records for DHCP leases with underscores
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2