mimugmail / opn-repo

OPNsense repo by mimugmail
Other
325 stars 24 forks source link

AdGuardHome /etc/hosts overrides all other DNS requests. Please add "--no-etc-hosts" to startup #100

Open rchavers opened 2 years ago

rchavers commented 2 years ago

First of all, thanks for the excellent package(s)!

I am requesting the addition of a new cli switch option "--no-etc-hosts" to AdGuardHome's startup script (see diff below): /usr/local/etc/rc.d/adguardhome

root@fw:/usr/local/etc/rc.d # diff adguardhome.orig adguardhome.new 
13c13
< command_args="-f -P /var/run/adguardhome.pid /usr/local/AdGuardHome/AdGuardHome -s run &"
---
> command_args="-f -P /var/run/adguardhome.pid /usr/local/AdGuardHome/AdGuardHome --no-etc-hosts -s run &"

Background / reason for the request: Today I noticed some of my vlan clients received the wrong DNS lookup for the firewall by fqdn: e.g. "host fw.my.domain" returns only 192.168.1.1 located in /etc/hosts of OPNsense

Apparently, this is by design due to a recent (last year) change in AdGuardHome. See: https://github.com/AdguardTeam/AdGuardHome/issues/1947

I have several vlans (guest, lan, mgmt, cctv, etc.) when I do a DNS lookup, the expected behavior is to have AGH return at least the current interface's IP. Well, annoyingly, it returns all IPs for all interfaces (unbound upstream), but I can override this in AGH custom filters... except I can't for any item in OPNsense's host file.

Thanks for reading, and hopefully this helps someone else.

alexdelprete commented 1 year ago

Since 0.107.7 that switch option is deprecated, they've introduced a specific setting:

image

# BEFORE:
'clients':
- name: client-name
  # …

# AFTER:
'clients':
  'persistent':
    - name: client-name
      # …
  'runtime_sources':
    whois: true
    arp: true
    rdns: true
    dhcp: true
    hosts: true