Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS rewrites outputting invalid addresses (manually having to use rewrites to bypass issue) #3815

Closed
kiwilad-nz opened this issue Nov 8, 2021 · 11 comments
Assignees
Milestone

Comments

@kiwilad-nz
Copy link

kiwilad-nz commented Nov 8, 2021

Issue Details

  • Version of AdGuard Home server:
    [2.5.2-RELEASE][[email protected]]/opt/AdGuardHome: ./AdGuardHome -v --version
    AdGuard Home
    Version: v0.107.0-b.14
    Channel: beta
    Go version: go1.16.9
    Build time: 2021-11-03T11:57:53Z+0000
    GOOS: freebsd
    GOARCH: amd64
    Race: false
    Dependencies:
    github.com/AdguardTeam/[email protected] (sum: h1:lH4lKA7KHKFJZgzlij1YAVX6v7eIQpUFpYh9qV+WfGw=)
    github.com/AdguardTeam/[email protected] (sum: h1:TAwnS4Y49sSUa4UX1yz/MWNGbIlXHqafrWr9MxdIh9A=)
    github.com/AdguardTeam/[email protected] (sum: h1:emqoKZElooHACYehRBYENeKVN1a/rspxiqTIMYLuoIo=)
    github.com/NYTimes/[email protected] (sum: h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=)
    github.com/aead/[email protected] (sum: h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY=)
    github.com/aead/[email protected] (sum: h1:52m0LGchQBBVqJRyYYufQuIbVqRawmubW3OFGqK1ekw=)
    github.com/ameshkov/dnscrypt/[email protected] (sum: h1:lxtS1iSA2EjTOMToSi+2+rwspNA+b/wG5/JpccvE9CU=)
    github.com/ameshkov/[email protected] (sum: h1:Srzik+J9mivH1alRACTbys2xOxs0lRH9qnTA7Y1OYVo=)
    github.com/beefsack/[email protected] (sum: h1:M57m0xQqZIhx7CEJgeLSvRFKEK1RjzRuIXiA3HfYU7g=)
    github.com/cheekybits/[email protected] (sum: h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=)
    github.com/fsnotify/[email protected] (sum: h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=)
    github.com/go-ping/[email protected] (sum: h1:mdi6AbCEoKCA1xKCmp7UtRB5fvGFlP92PvlhxgdvXEw=)
    github.com/google/[email protected] (sum: h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=)
    github.com/google/[email protected] (sum: h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=)
    github.com/google/[email protected] (sum: h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU=)
    github.com/AdguardTeam/[email protected] (sum: h1:gc042VRSIRSUzZ+Px6xQCRWNJZTaPkomisDfUZmoFNk=)
    github.com/joomcode/[email protected] (sum: h1:3e1mi0u7/HTPNdg6d6DYyKGBhA5l9XpsfuVE29NxnWw=)
    github.com/kardianos/[email protected] (sum: h1:bGuZ/epo3vrt8IPC7mnKQolqFeYJb7Cs8Rk4PSOBB/g=)
    github.com/lucas-clemente/[email protected] (sum: h1:uuhCcu885TE9u/piPYMChI/yqA1lXfaLUEx8uCMxf8w=)
    github.com/marten-seemann/[email protected] (sum: h1:XEZ1xGorVy9u+lJq+WXNE+hiqRYLNvJGYmwfwKQN2gU=)
    github.com/mdlayher/[email protected] (sum: h1:lez6TS6aAau+8wXUP3G9I3TGlmPFEq2CTxBaRqY6AGE=)
    github.com/mdlayher/[email protected] (sum: h1:InctQoB89TIkmgIFQeIL4KXNvWc1iebQXdZggqPSwL8=)
    github.com/miekg/[email protected] (sum: h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=)
    github.com/patrickmn/[email protected]+incompatible (sum: h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=)
    github.com/satori/[email protected] (sum: h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=)
    github.com/u-root/[email protected]+incompatible (sum: h1:u+KSS04pSxJGI5E7WE4Bs9+Zd75QjFv+REkjy/aoAc8=)
    go.etcd.io/[email protected] (sum: h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=)
    golang.org/x/[email protected] (sum: h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=)
    golang.org/x/[email protected] (sum: h1:Z04ewVs7JhXaYkmDhBERPi41gnltfQpMWDnTnQbaCqk=)
    golang.org/x/[email protected] (sum: h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=)
    golang.org/x/[email protected] (sum: h1:XMgFehsDnnLGtjvjOfqWSUzt0alpTR1RSEuznObga2c=)
    golang.org/x/[email protected] (sum: h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=)
    gopkg.in/natefinch/[email protected] (sum: h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=)
    gopkg.in/[email protected] (sum: h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=)
    howett.net/[email protected] (sum: h1:QDxUo/w2COstK1wIBYpzQlHX/NqaQTcf9jyz347nI58=)

  • How did you install AdGuard Home:

    • GitHub release
  • How did you setup DNS configuration:

    • IoT
  • If it's a router or IoT, please write device model:

    • Intel(R) Celeron(R) CPU J3160 @ 1.60GHz
  • CPU architecture:

    • AMD64
  • Operating system and version:

    • freebsd (pfSense)

Expected Behavior

Expect correct IPs to be resolved (IPv4 and IPv6)

Actual Behavior

When querying localhost domains (pfSense + local host overrides) the resolved IP's include invalid addresses that I can't explain.

Additional Information

Previously DNS rewrites appeared to function correctly before updating to latest release (may have broken from a previous however).

Suspect issue could be related to updated fix/change:
$dnsrewrite rules and other DNS rewrites will now be applied even when the protection is disabled (#1558).

The issue appears with host overrides that include IPv6 entries from my findings. Removing the IPv6 host override within pfsense appears to isolate the issue (or using a manual rewrite from AdguardHome).

Have checked the localhost file from pfSense and the invalid entries below are not there.

Under the query log, the queries that appear invalid include a "A: ttl=10 " as a result.

Without rewrite:

C:\Users\strut>nslookup pfsense
Server: LAN.kiwilad.nz
Address: 192.168.2.1

Non-authoritative answer:
Name: pfsense.kiwilad.nz
Addresses: ::ffff:192.168.1.1
2406:e001:2:9801::1
192.168.1.1
0.0.0.0 <-----------------

C:\Users\strut>nslookup lan
Server: LAN.kiwilad.nz
Address: 192.168.2.1

Non-authoritative answer:
Name: lan.kiwilad.nz
Addresses: ::ffff:192.168.2.1
2406:e001:2:9802::1
192.168.2.1
249.127.0.0 <-----------------

With manual rewrite:

C:\Users\strut>nslookup pfsense
Server: LAN.kiwilad.nz
Address: 192.168.2.1

Non-authoritative answer:
Name: pfsense.kiwilad.nz
Addresses: ::ffff:192.168.1.1
2406:e001:2:9801::1
192.168.1.1

C:\Users\strut>nslookup lan
Server: LAN.kiwilad.nz
Address: 192.168.2.1

Non-authoritative answer:
Name: lan.kiwilad.nz
Addresses: ::ffff:192.168.2.1
2406:e001:2:9802::1
192.168.2.1

@ainar-g
Copy link
Contributor

ainar-g commented Nov 8, 2021

It looks like your Windows machine is configured (probably by your network's DHCP server) to have kiwilad.nz as the local domain (DHCP Option 119 aka Domain Suffix Search?). Try using FQDNs:

nslookup pfsense.

(N.B. the dot at the end.)

@ainar-g ainar-g added the waiting for data Waiting for users to provide more data. label Nov 8, 2021
@kiwilad-nz
Copy link
Author

kiwilad-nz commented Nov 8, 2021

Yes, that is correct, but previously this worked without the "." as I had had a DNS forwarder entry to the pfSense local resolver as followed. I didn't quite see the need for rewrites up until now:
[/kiwilad.nz/]127.0.0.1:5335

Interestingly enough though, I did your suggestion and it's done the reverse now

C:\Users\strut>nslookup lan.
Server:  LAN.kiwilad.nz
Address:  192.168.2.1

Non-authoritative answer:
Name:    lan
Addresses:  ::ffff:192.168.2.1
          2406:e001:2:9802::1
          192.168.2.1
          0.0.0.0 <-----------
C:\Users\strut>nslookup lan.kiwilad.nz
Server:  LAN.kiwilad.nz
Address:  192.168.2.1

Non-authoritative answer:
Name:    lan.kiwilad.nz
Addresses:  ::ffff:192.168.2.1
          2406:e001:2:9802::1
          192.168.2.1

@ainar-g
Copy link
Contributor

ainar-g commented Nov 8, 2021

I see. Can you please provide the following information:

  1. Do you use AGH as your DHCP server? (I assume that you don't, but just in case.)

  2. When you say “DNS rewrites”, which ones do you mean: the /etc/hosts syntax ones, the $dnsrewrite rules, or the ones on the “DNS Rewrites” page in the UI?

@EugeneOne1, please investigate if we have broken any of the ordering when implementing #2499.

@ainar-g ainar-g added the needs investigation Needs to be reproduced reliably. label Nov 8, 2021
@kiwilad-nz
Copy link
Author

kiwilad-nz commented Nov 8, 2021 via email

@kiwilad-nz
Copy link
Author

adguard1

@kiwilad-nz
Copy link
Author

adguard2

@kiwilad-nz
Copy link
Author

adguard3

@kiwilad-nz
Copy link
Author

Just thought I would pop in to say, I think this is a pretty bad problem, it's now caused me other issues where drive shares wouldn't work unless there was a manual rewrite added.

Shouldn't I be able to simply use [/kiwilad.nz/]127.0.0.1:5335 as previously done?

@ainar-g ainar-g added bug P3: Medium and removed waiting for data Waiting for users to provide more data. labels Nov 9, 2021
@ainar-g ainar-g added this to the v0.107.0 milestone Nov 9, 2021
@EugeneOne1 EugeneOne1 removed the needs investigation Needs to be reproduced reliably. label Nov 14, 2021
adguard pushed a commit that referenced this issue Nov 16, 2021
Merge in DNS/adguard-home from 3815-weird-rewrites to master

Updates #3815.

Squashed commit of the following:

commit d217db9
Merge: 006b67b 9c8e087
Author: Eugene Burkov <[email protected]>
Date:   Tue Nov 16 16:08:41 2021 +0300

    Merge branch 'master' into 3815-weird-rewrites

commit 006b67b
Author: Eugene Burkov <[email protected]>
Date:   Tue Nov 16 15:49:50 2021 +0300

    filtering: fix doc

commit 7ffafce
Author: Eugene Burkov <[email protected]>
Date:   Tue Nov 16 14:17:41 2021 +0300

    all: imp hosts container more

commit b60dedd
Author: Eugene Burkov <[email protected]>
Date:   Sun Nov 14 19:06:16 2021 +0300

    all: log changes

commit 37c76f4
Author: Eugene Burkov <[email protected]>
Date:   Sun Nov 14 18:14:21 2021 +0300

    aghnet: imp hosts container

commit 187251c
Author: Eugene Burkov <[email protected]>
Date:   Sun Nov 14 16:16:41 2021 +0300

    all: merge hosts container more
@EugeneOne1
Copy link
Member

@kiwilad-nz, hello again. The latest build in the edge channel should fix the issue. Could you please install it and check if it works properly?

@kiwilad-nz
Copy link
Author

Hi there @EugeneOne1 - It's working as it was now with no added rewrite rules!
Thanks very much! :)

@EugeneOne1
Copy link
Member

@kiwilad-nz, thanks for testing!

heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Merge in DNS/adguard-home from 3815-weird-rewrites to master

Updates AdguardTeam#3815.

Squashed commit of the following:

commit d217db9
Merge: 006b67b 9c8e087
Author: Eugene Burkov <[email protected]>
Date:   Tue Nov 16 16:08:41 2021 +0300

    Merge branch 'master' into 3815-weird-rewrites

commit 006b67b
Author: Eugene Burkov <[email protected]>
Date:   Tue Nov 16 15:49:50 2021 +0300

    filtering: fix doc

commit 7ffafce
Author: Eugene Burkov <[email protected]>
Date:   Tue Nov 16 14:17:41 2021 +0300

    all: imp hosts container more

commit b60dedd
Author: Eugene Burkov <[email protected]>
Date:   Sun Nov 14 19:06:16 2021 +0300

    all: log changes

commit 37c76f4
Author: Eugene Burkov <[email protected]>
Date:   Sun Nov 14 18:14:21 2021 +0300

    aghnet: imp hosts container

commit 187251c
Author: Eugene Burkov <[email protected]>
Date:   Sun Nov 14 16:16:41 2021 +0300

    all: merge hosts container more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants