Adding to whitelist and blacklist doesn't work

Hi,

When I try to either whitelist or blacklist any site I get an error if I include https:// in the URL, i get an error which is fine I assume it's a syntax thing.

However when I don't have https:// I get a success message but the list doesn't get updated even with a refresh or checking via ssh.

to add sites I always have to add via ssh.

Am i doing something wrong? i tried installing pihole a few times with no luck.

thanks in advance

When you add a domain to the list, you should only add the domain, not the URL or protocol (http, https). If it's still not adding them when you are only adding the domain (example.com) then run pihole -d for a debug token.

thanks for the reply.. i ran the command and uploaded the log.

debug token: vwzp3knkx2

Please manually edit your file /etc/pihole/whitelist.txt and remove all extra slashes and http:// and https://, e.g.

  • example.com/    →    example.com
  • https://example.com    →    example.com
  • https://example.com/    →    example.com

Run pihole -g afterwards to reprocess your lists.

Hi

thanks for the reply.

so I did what you suggested. I also noticed a couple of duplicates which I got rid of... but I still have the same problem can't add to whitelist through the web interface.
could it be that I am using a Pi 2?
I just used TeamViewer to access a PC at my parent's house where I set up a pi-hole on a Pi 3 and tried whitelisting and it worked fine.

It looks like maybe the sudoer file hasn't been installed. What's the output of sudo cat /etc/sudoers.d/pihole?

pi@raspberrypi:~ $ sudo cat /etc/sudoers.d/pihole
 # Pi-hole: A black hole for Internet advertisements
 # (c) 2015, 2016 by Jacob Salmela
 # Network-wide ad blocking via your Raspberry Pi
 # http://pi-hole.net
 # Allows the WebUI to use Pi-hole commands
 #
 # Pi-hole is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 2 of the License, or
 # (at your option) any later version.

Moderator edit: Introduced code delimiters for better formating

Ok, looks like this line failed to run for some reason during install. Add this to the end of the file:

www-data ALL=NOPASSWD: /usr/local/bin/pihole

@Mcat12's solution should fix your issue.

By any chance, do you still have the installation log so we could have a look if there was an error message during install? It is located in /etc/pihole/install.log. You can either post it here or send it via PM to me.

sorry, which file do you mean that I should add the line too?

Add it to the file from which you posted the content earlier

@DL6ER @Mcat12 haha thanks, I can almost imagine your face palm from me asking that last question.

worked great thanks for the patient help.


here is what is in the install.log file.

:::
::: Installing scripts from /etc/.pihole... done.
:::
::: Installing configs...
:::    Existing dnsmasq.conf found... it is not a pi-hole file, leaving alone!
:::    Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf... done.
:::
::: Creating log file and changing owner to dnsmasq... already exists!
:::
::: Installing pihole custom index page...
:::     index.php missing, replacing...  done!
:::     Existing index.js detected, not overwriting
:::     index.css missing, replacing...  done!
:::
::: Installing sudoer file... done!
:::
::: Installing latest Cron script... done!
:::
::: Preparing to run gravity.sh to refresh hosts...
::: Cleaning up previous install (preserving whitelist/blacklist)
::: Running gravity.sh
:::
::: Neutrino emissions detected...
:::
::: Custom adList file detected. Reading... done!
:::
::: Getting raw.githubusercontent.com list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: Getting mirror1.malwaredomains.com list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: Getting sysctl.org list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: Getting zeustracker.abuse.ch list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: Getting s3.amazonaws.com list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: Getting s3.amazonaws.com list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: Getting hosts-file.net list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: Getting raw.githubusercontent.com list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: Getting raw.githubusercontent.com list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: Getting pastebin.com list... done
:::   Status: Success (OK)
:::   List updated, transport successful!
::: 
::: Aggregating list of domains... done!
::: Formatting list of domains to remove comments.... done!
::: 148047 domains being pulled in by gravity...
::: Removing duplicate domains.... done!
::: 111156 unique domains trapped in the event horizon.
:::
::: Adding adlist sources to the whitelist... done!
::: Whitelisting 16 domains... done!
::: Blacklisting 0 domains... done!
::: Formatting domains into a HOSTS file... done!
:::
::: Cleaning up un-needed files... done!
:::
::: Refresh lists in dnsmasq... done!
::: DNS service is running
::: Pi-hole blocking is Enabled

There seems to be nothing wrong in this output. Does it work when you add the missing line?