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

Add an option to ignore local hosts file #1947

Closed
AlexHighTower opened this issue Jul 26, 2020 · 16 comments
Closed

Add an option to ignore local hosts file #1947

AlexHighTower opened this issue Jul 26, 2020 · 16 comments
Assignees
Milestone

Comments

@AlexHighTower
Copy link

Hello,

using latest 0.103.2 I found that it parse local /etc/hosts file and return addresses from it and return to clients wrong IP.
e.g., hosts have record
127.0.0.1 domain.name
and when client request domain.name agh return 127.0.0.1 instead of forwarding query to upstream...
I need to disable reading local hosts file

@ameshkov
Copy link
Member

This is the intended behavior. Please explain why do you want to change it and why can't you edit the hosts file instead?

@AlexHighTower
Copy link
Author

I'd prefer to have possibility disable reading local hosts file

hosts have higher priority of dns for local host and I can override some hosts for some purposes. plus I prefer local host domain name point to 127.0.0.1 instead of static or dynamic ip.
and what you've done? - you translate local host setting to all agh clients...
this is not acceptable!

@AlexHighTower
Copy link
Author

in addition you broke another thing:
for example, there is domain example.com
it has A and MX records
if call host example.com
result will contain both A and MX records
if add example.com to /etc/hosts and ask host example.com
in this case only A record is returned and no MX

@Eyeborgs
Copy link

I'd prefer to have possibility disable reading local hosts file

I want to have a function like this too

@ammnt
Copy link

ammnt commented Jul 27, 2020

@ameshkov, yes, it must be definitely optional. I use four IP addresses (two ipv4 and two ipv6), but because of the hosts file, essentially only one ipv4 address works when I access the domain😒

@ameshkov ameshkov changed the title ignore local hosts file Add an option to ignore local hosts file Jul 30, 2020
@ameshkov ameshkov added this to the v0.105 milestone Jul 30, 2020
@ameshkov
Copy link
Member

Temporary solution - use AGH docker image

@Aikatsui
Copy link
Contributor

Aikatsui commented Oct 4, 2020

Temporary solution - use AGH docker image

I also interest for this topic. "Add an option to ignore local hosts file"
Docker instance too apply it's etc/hosts #2085

adguard pushed a commit that referenced this issue Apr 12, 2021
Merge in DNS/adguard-home from 1947-hosts-opt to master

Updates #1947.
Updates #2829.

Squashed commit of the following:

commit d09285c
Merge: cff8c4c 7c6557b
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 18:23:20 2021 +0300

    Merge branch 'master' into 1947-hosts-opt

commit cff8c4c
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 17:46:19 2021 +0300

    home: fix help

commit 1fa01d5
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 17:40:48 2021 +0300

    home: fix option order

commit 9d83cb6
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 17:28:30 2021 +0300

    aghnet: add important todo

commit 7f1386f
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 17:17:17 2021 +0300

    all: correct naming

commit cbe2b2e
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 15:55:46 2021 +0300

    all: mv functionality from util

commit e82ad53
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 15:41:35 2021 +0300

    home: imp code, docs

commit 9058977
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 15:02:34 2021 +0300

    home: add an option to disable autohosts
@EugeneOne1
Copy link
Member

The new option --no-etc-hosts was introduced in e671f43 and is available in the latest snapshots. The wiki section about flags is also updated. Could you please check if our solution works well for you?

@AlexHighTower
Copy link
Author

The new option --no-etc-hosts was introduced in e671f43 and is available in the latest snapshots. The wiki section about flags is also updated. Could you please check if our solution works well for you?

I'd love to, but where can I get x64 linux binary for tests?

@EugeneOne1
Copy link
Member

EugeneOne1 commented Apr 13, 2021

Here you can find the instructions for using unstable versions and also links for the precompiled binaries.

adguard pushed a commit that referenced this issue Apr 14, 2021
Merge in DNS/adguard-home from 2956-fix-flag to master

Closes #2956.
Updates #1947.

Squashed commit of the following:

commit ffb98f7
Merge: 800d67d 7be2fc3
Author: Eugene Burkov <[email protected]>
Date:   Wed Apr 14 19:01:34 2021 +0300

    Merge branch 'master' into 2956-fix-flag

commit 800d67d
Author: Eugene Burkov <[email protected]>
Date:   Wed Apr 14 18:54:26 2021 +0300

    home: fix clients disabling
@EugeneOne1
Copy link
Member

@AlexHighTower, hi, just a heads-up, we've messed up the feature in the initial snapshot and beta 2, so you probably shouldn't install it. Any edge release after 69f526b should be fine though. We're planning to release beta 3 on Monday or Tuesday (19th or 20th of April) which will also contain the fixed version. Apologies!

@EugeneOne1
Copy link
Member

We'll close the issue for now. Please feel free to open new issues if the feature will cause any problems.

heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Merge in DNS/adguard-home from 1947-hosts-opt to master

Updates AdguardTeam#1947.
Updates AdguardTeam#2829.

Squashed commit of the following:

commit d09285c
Merge: cff8c4c 7c6557b
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 18:23:20 2021 +0300

    Merge branch 'master' into 1947-hosts-opt

commit cff8c4c
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 17:46:19 2021 +0300

    home: fix help

commit 1fa01d5
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 17:40:48 2021 +0300

    home: fix option order

commit 9d83cb6
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 17:28:30 2021 +0300

    aghnet: add important todo

commit 7f1386f
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 17:17:17 2021 +0300

    all: correct naming

commit cbe2b2e
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 15:55:46 2021 +0300

    all: mv functionality from util

commit e82ad53
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 15:41:35 2021 +0300

    home: imp code, docs

commit 9058977
Author: Eugene Burkov <[email protected]>
Date:   Mon Apr 12 15:02:34 2021 +0300

    home: add an option to disable autohosts
heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Merge in DNS/adguard-home from 2956-fix-flag to master

Closes AdguardTeam#2956.
Updates AdguardTeam#1947.

Squashed commit of the following:

commit ffb98f7
Merge: 800d67d 7be2fc3
Author: Eugene Burkov <[email protected]>
Date:   Wed Apr 14 19:01:34 2021 +0300

    Merge branch 'master' into 2956-fix-flag

commit 800d67d
Author: Eugene Burkov <[email protected]>
Date:   Wed Apr 14 18:54:26 2021 +0300

    home: fix clients disabling
@celevra
Copy link

celevra commented Apr 11, 2023

--no-etc-hosts is depricated now
what is the new way?

@vin047
Copy link

vin047 commented Oct 3, 2023

clients.runtime_sources.hosts to false in the config file.

source: https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration#configuration-file

@tjharman
Copy link

tjharman commented Jan 28, 2024

Hi,
This option clients.runtime_sources.hosts: false isn't working.
My AdGuardHome (v0.107.43) is still using my /etc/hosts

Should I log a seperate issue or keep it contained within this one?

Thanks!

Edit: Just for clarity I'm not an idiot - I have stopped the AdGuardHome process before changing the line which isn't as written above, it's in the yaml file as thus:

clients:
  runtime_sources: 
    whois: true
    arp: true
    rdns: true
    dhcp: true 
    hosts: false

I have a log file with log.verbose: true to share (but I'd rather not post it publically, thanks)

@tjharman
Copy link

Sorry ignore my update here, I can see that #6610 exists.

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

10 participants