Unbound host entries generating bug

Started by Tikimotel, March 16, 2016, 08:22:09 PM

Previous topic - Next topic
Currently (16.1.7) unbound does not generate the host and domain itself inside the "host_entries.conf" file.
My current work around was setting a host override.

Without it hostname lookups in windows look like so:

nslookup <enter>
Default Server:  Unkown
Address:  192.168.0.1

> Anduril
Server:  Unkown
Address:  192.168.0.1

Name:    Anduril.home
Address:  192.168.0.51

> exit


It was because the "host_entries.conf" only added localhost.
"host_entries.conf"
local-zone: "home" transparent
local-data-ptr: "127.0.0.1 localhost"
local-data: "localhost A 127.0.0.1"
local-data: "localhost.home A 127.0.0.1"
local-data-ptr: "::1 localhost"
local-data: "localhost AAAA ::1"
local-data: "localhost.home AAAA ::1"


To fix this the reference to the 'interface' needs to be changed to 'active_interface'.
Part of "unbound.inc"

519    if (isset($config['unbound']['interface'])) {
520        $interfaces = explode(",", $config['unbound']['interface']);


519    if (isset($config['unbound']['active_interface'])) {
520        $interfaces = explode(",", $config['unbound']['active_interface']);

After saving the config again the "host_entries.conf" does save for LAN interface the hostname of opnsense.
(a bit further in the code "$if" is used a variable for testing real interfaces, reading "if" and "$if" not nice...and should be changed)

local-zone: "home" transparent
local-data-ptr: "127.0.0.1 localhost"
local-data: "localhost A 127.0.0.1"
local-data: "localhost.home A 127.0.0.1"
local-data-ptr: "::1 localhost"
local-data: "localhost AAAA ::1"
local-data: "localhost.home AAAA ::1"
local-data-ptr: "192.168.0.1 OPNsense.home"
local-data: "OPNsense.home A 192.168.0.1"
local-data: "OPNsense A 192.168.0.1"


After this fix hostname lookups in windows look like so:

nslookup <enter>
Default Server:  OPNsense.home
Address:  192.168.0.1

> Anduril
Server:  OPNsense.home
Address:  192.168.0.1

Name:    Anduril.home
Address:  192.168.0.51

> exit


It only works for 1 interface at a time.
When selecting LAN and Localhost, the DNS Lookup page won't respond for 127.0.0.1
So when just using/choosing LAN (IPv4) it works fine.

I'm guessing that's the same issue as reported here: https://github.com/opnsense/core/issues/746#issuecomment-197067451

Not sure how to fix this for all cases yet, but that you for the analysis. That will help. :)

Using Localhost (which you can select in the unbound menu options) kind off, needs to be excluded.
You get double 127.0.0.1 entries, and unbound refuses to start. That's why, dns lookups are unresponsive.

I feel you can get away with just the LAN and or the LAN IPv6 Link-Local as options.
But don't know how virtual interfaces would translate, using the current "unbound.inc"