gaenserich / hostsblock

an ad- and malware-blocking script for Linux
https://github.com/gaenserich/hostsblock
225 stars 28 forks source link

detect_dnscacher function error? #7

Closed Sadi58 closed 9 years ago

Sadi58 commented 10 years ago

While testing the new pre-alpha version I get the error "USING no DNSCACHER, BUT THE 'hostsfile' VARIABLE IS NOT SET TO /etc/hosts" But I am using DNSCACHER.

gaenserich commented 10 years ago

Could you post your hostsblock.conf?

bjauy commented 9 years ago

As a side note, default hostsblock.conf should have dnscacher entry.

After adding it manually and setting to dnsmasq or auto it worked.

Sadi58 commented 9 years ago

@bjauy 1) Please can you explain how to add dnscacher entry to hostsblock.conf? I have added the following but still no luck:

postprocess(){                #
    /etc/init.d/dnsmasq restart # For dnsmasq under initscripts
} 

2) Maybe I also need to know how to set it to dnsmasq or auto I can't see anything about these settings in ReadMe or hostsblock.conf files :-/

bjauy commented 9 years ago

I have simply put

dnsmasq="dnsmasq"

in hostsblock.conf. There was no such variable in the file earlier.

Sadi58 commented 9 years ago

@bjauy Thanks, but this made no difference here. When I use dnscacher="dnsmasq" instead (or "auto"), I get this message: DHCP CLIENT NOT FOUND OR NOT OPERATIONAL. EXITING...

bjauy commented 9 years ago

Weird, because I can't find such message in the code (I'm using latest git revision).

Have you tried running hostsblock with -v 3 or -v 4 parameter? It will print more messages which could help you diagnose source of the problem.

Sadi58 commented 9 years ago

Thanks a lot @bjauy :-) Finally got it working! 1) Apparently the cause of this second problem was that my system has /etc/dhcp/dhclient.conf instead of /etc/dhclient.conf specified in hostsblock-common.sh. 2) After creating a symlink there, I also had to uncomment the line prepend domain-name-servers 127.0.0.1; Now I also have a working copy of this latest version of hostsblock with 3 minor amends :-)

gaenserich commented 9 years ago

pass on the amends so that future versions can include more distribution-agnostic code.

Jacob A. van der Kolk http://personal.psu.edu/jav209 Lecturer in German Ph.D. Candidate in German Literature and Culture, ABD Department of Germanic and Slavic Languages and Literatures The Pennsylvania State University jav209@psu.edu PGP Public Key http://www.personal.psu.edu/jav209/jvdk.gpg (plaintext http://www.personal.psu.edu/jav209/jvdk.asc)

2015-01-28 4:23 GMT-05:00 Sadi Yumuşak notifications@github.com:

Thanks a lot @bjauy https://github.com/bjauy :-) Finally got it working! 1) Apparently the cause of this second problem was that my system has /etc/dhcp/dhclient.conf instead of /etc/dhclient.conf specified in hostsblock-common.sh. 2) After creating a symlink there, I also had to uncomment the line prepend domain-name-servers 127.0.0.1; Now I also have a working copy of this latest version of hostsblock with 3 minor amends :-)

— Reply to this email directly or view it on GitHub https://github.com/gaenserich/hostsblock/issues/7#issuecomment-71803723.

Sadi58 commented 9 years ago

Conclusion: 1) The file hostsblock.conf should perhaps also include an entry like this: #dnscacher="dnsmasq" # This should be uncommented when using dnsmasq as dnschacher 2) The file hostsblock-common.sh may perhaps support the dhcp client location in debian systems by performing check_dhclient_config also at /etc/dhcp/dhclient.conf 3) Users may be warned somewhere that the line #prepend domain-name-servers 127.0.0.1; in dhclient.conf should be uncommented

gaenserich commented 9 years ago

Should be fixed now through 6c67687139be666b722caad671970b452bf0e36a.

Sadi58 commented 9 years ago

Thanks, I can confirm that it works fine now :-) Do you think the item 3 above should be included in the ReadMe or elsewhere?

gaenserich commented 9 years ago

3 should/will be included in the hostsblock.conf.8 man page or mentioned

in stdout/err. I was hoping to cut back a bit on how verbose the comments are in our config files. Am 24.04.2015 10:02 schrieb "Sadi Yumuşak" notifications@github.com:

Thanks, I can confirm that it works fine now :-) Do you think the item 3 above should be included in the ReadMe or elsewhere?

— Reply to this email directly or view it on GitHub https://github.com/gaenserich/hostsblock/issues/7#issuecomment-95943266.