packtloss / pihole-extension

32 stars 1 forks source link

dnsmasq not restarting #1

Open ghost opened 8 years ago

ghost commented 8 years ago

Strange, I added a few sites to the whitelist and blacklist but it did not take effect. I then manually did a "service dnsmasq restart" and refreshed the page that was being blacklisted and instantly it worked. Does this restart dnsmasq after each change? What can I look at to troubleshoot this? thanks for the work, this really brings pi-hole to a whole new level

packtloss commented 8 years ago

Hrm. It actually executes the whitelist.sh and blacklist.sh - and pihole takes care of all of the work. My first guess is that your webserver user is not allowed to access those scripts.

Try (as root): su www-data; /usr/local/bin/whitelist.sh test123456.com; /usr/local/bin/whitelist.sh -d test123456.com

Do you see permission errors?

If you do, make sure you've done this (as root): Edit /etc/sudoers, add these lines at the bottom:

User_Alias WWW_USER = www-data Cmnd_Alias WWW_COMMANDS = /usr/local/bin/gravity.sh, /usr/local/bin/whitelist.sh, /usr/local/bin/blacklist.sh WWW_USER ALL = (ALL) NOPASSWD: WWW_COMMANDS

Then retry the commands.

ghost commented 8 years ago

Thanks for the reply. Ran the first command and here was the output: root@adpie:/home/joe# su www-data; /usr/local/bin/whitelist.sh test123456.com; /usr/local/bin/whitelist.sh -d test123456.com This account is currently not available. ::: Adding test123456.com to whitelist.txt... done! ::: ::: Modifying HOSTS file to whitelist 25 domains... done! ::: ::: Refresh lists in dnsmasq... done! ::: ::: Modifying HOSTS file to un-whitelist domains... ::: Un-whitelisting test123456.com on IPv4 and IPv6... done! ::: Removing test123456.com from whitelist.txt... done! ::: ::: Refresh lists in dnsmasq... done!