Pi-Hole (ad blocking DNS server) Controller

Plugins that users have built. NOTE: plugins that were developed for Indigo versions older than 2022.1 will have to be updated to work with Indigo 2022.1 (Python 3 - see this blog post for details). If the plugin listed here is not in the Plugin Store (which will show updated plugins) then you will need to ask on the appropriate thread below if it has been updated and where you get get the update.
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: Pi-Hole (ad blocking DNS server) Controller

Post by kw123 »

if you can not do ssh after setup you need to first enable ssh in
sudo raspi-config

ssh is disabled by default when you download the SSD from raspberry


Karl
autolog
Posts: 4077
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK
Contact:

Re: Pi-Hole (ad blocking DNS server) Controller

Post by autolog »

FlyingDiver wrote:Are you sure you enabled ssh on the rPi? It's not enabled by default.
Yes, I think you are correct - I now seem to recall that I had a monitor and keyboard plugged into it when I set it up. I will have to do that again to sort it out. :)
Ramias
Posts: 272
Joined: Tue Nov 24, 2015 5:21 pm

Re: Pi-Hole (ad blocking DNS server) Controller

Post by Ramias »

I love my RasPi's.

But I run Pi Hole in a docker container on my qnap. night and day difference in reliability. I think it was probably IO on the RasPi SSD card, but didn't debug it that much since the container is so easy and reliable.
User avatar
DaveL17
Posts: 7321
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Pi-Hole (ad blocking DNS server) Controller

Post by DaveL17 »

I've been thinking about this problem from the standpoint of WAF damage points.

Why not set the preferred DNS to 10.0.1.123 (the piHole) *and* also set one for 10.0.1.1 (or whatever the default DNS is)? Then the client would first attempt to use the piHole and if that didn't respond, wouldn't it then fall back to the default and motor happily along? This, of course, presumes that you want the client to connect in "ad space" if the piHole was down.
I came here to drink milk and kick ass....and I've just finished my milk.

My Plugins and Scripts
User avatar
Professor Falken
Posts: 304
Joined: Sun Mar 29, 2015 7:07 am

Re: Pi-Hole (ad blocking DNS server) Controller

Post by Professor Falken »

DaveL17 wrote:I've been thinking about this problem from the standpoint of WAF damage points.

Why not set the preferred DNS to 10.0.1.123 (the piHole) *and* also set one for 10.0.1.1 (or whatever the default DNS is)? Then the client would first attempt to use the piHole and if that didn't respond, wouldn't it then fall back to the default and motor happily along? This, of course, presumes that you want the client to connect in "ad space" if the piHole was down.
I think you are responding to me here Dave, though I'm not completely sure. If not, feel free to disregard.

Your solution might be worth trying. But I think what would happen is, the content blocked by the pi-hole would get loaded by the secondary DNS server, thereby defeating the purpose.

Running it through Indigo was a perfect solution, because it gave a dead simple way to disable it when it was interfering with browsing, etc. (strangely, that never happens to me-- I guess I don't frequent the tracking required sites). Basically the plugin allowed the WAF to go high enough for me to get away with deploying it on our network. I made a nice little toggleable icon on the main home Indigo dashboard that was easy to press if someone needed it off. Even had it turn back on every midnight if someone forgot to turn it back on.

The kids even loved it because it radically cut down on ad clutter in iOS games as well. But unfortunately, the connection to Indigo was one of the things that seemed to fail when it locks up (the other was my ability to easily SSH in to the pi, as well as the browser based dashboard). Oddly, it keeps right on blocking mostly unperturbed, though I think it might over-block a little in thast circumstance.

I've been testing some options for the past week or so by putting the home router back to "regular" DNS servers, but I changed my phone (and only my phone) to the pi-hole-- you can do that for individual wifi connections in iOS. It has been working fine, which kinda makes me wonder if it's a volume problem-- that is, if the pi is hit with too many requests from a busy, very connected house, does it get overwhelmed or something?

I've seen a few comments online that a weak spot on the pi's may be the microSD card. I'm pretty sure I set this one up with a high quality card, but it might be worthwhile to see if redoing it with a different card might help.

Thanks for the suggestions.
User avatar
DaveL17
Posts: 7321
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Pi-Hole (ad blocking DNS server) Controller

Post by DaveL17 »

Professor Falken wrote:I think you are responding to me here Dave, though I'm not completely sure.
I was approaching it from a "the pi-Hole is locked up which will cause WAF damage points" perspective. I'm thinking that having the client fall back to a "wide-open" DNS server (with all its ads and cruft) is preferable to having the client not be able to connect at all. I'm thinking that the client will always use the first DNS server in the list, so the pi-Hole would always be the one used (unless it was down.)

This makes me wonder, too, whether there's a way to send an alert message to the client to let them know that they're being tracked when that happens.
I came here to drink milk and kick ass....and I've just finished my milk.

My Plugins and Scripts
User avatar
Professor Falken
Posts: 304
Joined: Sun Mar 29, 2015 7:07 am

Re: Pi-Hole (ad blocking DNS server) Controller

Post by Professor Falken »

I hear ya, thanks.

Here's the scenario...

1) Wife wants to connect to some blocked site (say, for example eBates, which appears to be REALLY bad for trackers).

2) Pi-Hole correctly blocks this tracking heavy site (even when it is locked up, it still somehow executes its core function and blocks).

3) Wife, now slightly annoyed, tries to temporarily disable the pi-hole using the Indigo dashboard icon, which fails because that's something that doesn't work when it gets into this state.

4) Chaos ensues.

Since the dashboard also locks up, as well as SSH access, it's a bit of a process to get it disabled, especially if I'm not around. That's why for now, I've reset most of the network to generic DNS servers (via the router) and am just running the pi-hole for my phone.


Strangely, this all worked well for around 6 months. Not really sure what changed. I updated the pi-hole software when it started happening, but that didn't fix it.
User avatar
DaveL17
Posts: 7321
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Pi-Hole (ad blocking DNS server) Controller

Post by DaveL17 »

Got it. I somehow missed that the pi was still blocking when it was unreachable by Indigo. I thought it was completely unresponsive.

Therefore, my suggestion is totally OT. :D
I came here to drink milk and kick ass....and I've just finished my milk.

My Plugins and Scripts
Ramias
Posts: 272
Joined: Tue Nov 24, 2015 5:21 pm

Re: Pi-Hole (ad blocking DNS server) Controller

Post by Ramias »

It is called "Pi Hole" because I think Raspberry Pi was the original targeted platform. But the IO is probably too much for the SD Cards. Run it on another system (try a docker container on your Mac -- pihole/pihole is the official one) and it will run so much better.
User avatar
Professor Falken
Posts: 304
Joined: Sun Mar 29, 2015 7:07 am

Re: Pi-Hole (ad blocking DNS server) Controller

Post by Professor Falken »

Ramias wrote:It is called "Pi Hole" because I think Raspberry Pi was the original targeted platform. But the IO is probably too much for the SD Cards. Run it on another system (try a docker container on your Mac -- pihole/pihole is the official one) and it will run so much better.
Yeah, thanks. I guess I am going to have to try something like that. Running it with just my phone using it for the DNS server didn't seem to change the behavior at all, so I guess it's not a volume of queries issue. And yesterday I swapped out transformers as an easy troubleshoot and it is already locked up again.

I think my problem with Docker on the Mac is that my OS is one too far back for it, if I remember correctly, but I'll need to check. The (strangely persistent) Insteon driver bug has kept me from constantly updating the mac mini that runs the home automation setup.

Thanks for the suggestions.
sumocomputers
Posts: 268
Joined: Mon Jun 23, 2008 10:46 pm

Re: Pi-Hole (ad blocking DNS server) Controller

Post by sumocomputers »

Every so often, I am getting errors in the logs as shown below (I turned on advanced logging). I am on 1.1.0 and Indigo 7.4.1.

I tried stopping and starting the plugin, reloading the plugin, and even shutting down and starting up the Indigo Server itself.

None worked. Rebooting the Mac is the only thing that works, for a time.

I should note that I have 2 PiHoles, and both are called out as separate devices in Indigo.

Code: Select all

Traceback (most recent call last):
  File "plugin.py", line 163, in runConcurrentThread
  File "plugin.py", line 140, in udpateStatus
UnboundLocalError: local variable 'response' referenced before assignment

   Pi Hole DNS Controller Error    plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
   Pi Hole DNS Controller Debug    Starting concurrent thread
   Pi Hole DNS Controller Debug    Sent "PiHole Primary" status request
   Pi Hole DNS Controller Debug    PiHole is Enabled
   Pi Hole DNS Controller Debug    Sent "PiHole Secondary" status request
   Pi Hole DNS Controller Error    Error in plugin execution runConcurrentThread:
siclark
Posts: 2355
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: Pi-Hole (ad blocking DNS server) Controller

Post by siclark »

Morning all.
So my pihole running on the QNAP, but interestingly not the QNAP itself lost connection last night, the pihole API was saying it has lost connection to interface, but I could still log on to teh admin panel and a simple request to restart solved it but it was preventing all internet traffic.

Does anyone know if its possible to automate a restart of the pihole with this plugin? I could trigger that from the online sensor losing connection (I hope) assuming I use name not IP address?
kendals
Posts: 95
Joined: Mon May 24, 2004 6:48 am

Re: Pi-Hole (ad blocking DNS server) Controller

Post by kendals »

Hello all,

I am playing with Indigo plugins and ran across this great plugin, but having problems getting it to work. My Indigo machine is an M1 Mac mini running on Monterey, and I am running PiHole as docker container on my Synology and keep getting this Indigo error:

Pi Hole DNS Controller Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 163, in runConcurrentThread
File "plugin.py", line 140, in udpateStatus
UnboundLocalError: local variable 'response' referenced before assignment

Pi Hole DNS Controller Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

I double checked that I am using my web password so that is not the issue...your thoughts?
autolog
Posts: 4077
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK
Contact:

Re: Pi-Hole (ad blocking DNS server) Controller

Post by autolog »

kendals wrote:... Pi Hole DNS Controller Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 163, in runConcurrentThread
File "plugin.py", line 140, in udpateStatus
UnboundLocalError: local variable 'response' referenced before assignment

Pi Hole DNS Controller Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

I double checked that I am using my web password so that is not the issue...your thoughts?
I have just looked at the code and it looks like a response of enabled or disabled is not being returned from PiHole (or maybe no response at all)?

The URLfrom the code is something like:

Code: Select all

u"http://" + dev.pluginProps["address"] + "/admin/api.php?status&auth=" + dev.pluginProps["password"]
So you could try typing that into a web browser and see what it returns, e.g. :

Code: Select all

http://<IP ADDRESS OF YOUR DOCKER CONTAINER>/admin/api.php?status&auth=YOUR_PASSWORD
Last edited by autolog on Mon Jan 03, 2022 4:42 am, edited 1 time in total.
kendals
Posts: 95
Joined: Mon May 24, 2004 6:48 am

Re: Pi-Hole (ad blocking DNS server) Controller

Post by kendals »

Jon,

thanks for the info. My Pihole is running on port 8080 (for security reasons), so my string would be:

http://192.168.1.4:8080/admin/api.php?status&auth=<web password> and that returned
{"status":"enabled"}

It looks like I just needed to pass my port # thru as well...thanks for the info!
Post Reply

Return to “User Plugins”