DEV Community

Pi-hole in Azure Container Instances

Ganessh Kumar on May 01, 2020

A simple guide to deploy Pi-hole, a black hole for Internet advertisements, in Azure Container Instances. We use pi-hole's docker image. We persi...
Collapse
 
engineerer profile image
Kai Boschung •

Thanks for the great article! The idea of Pi-Hole hooked me.
I further automated the installation through PowerShell dev.to/expertsinside/automated-pi-...

But I couldn't get it working... I was wondering if you had the same issue I mentioned in my blog post.

Collapse
 
ganesshkumar profile image
Ganessh Kumar •

PowerShell script is a nice idea. I will try to create an Azure Deploy button next -docs.microsoft.com/en-us/azure/azu...

No, I haven't tried installing pi-hold manually. Never came across this issue. Exactly one of the reasons why I rely heavily on containers.

Collapse
 
engineerer profile image
Kai Boschung •

I didn't set up manually, but exactly as you explained in your post.
The instance then never worked.
Maybe because of the "latest" tag of the container image I used ultimately a different Linux base image. I guess.

Collapse
 
smurfpandey profile image
Neeraj Verma • • Edited

Looks like your pi-hole instance is accessible on public internet. Leaving a open DNS resolver is a huge no. You should close the Port 53, and setup VPN to securely access the pihole instance.

Read this to know why leaving pihole publicly accessible is a very bad idea.
github.com/beesecurity/How-I-Hacke...

Collapse
 
ganesshkumar profile image
Ganessh Kumar • • Edited

That's a good idea to run it behind a VPN. I know that by leaving it in public network, anyone can talk to this DNS. Is there any other vulnerability beyond that?

Edit: I have explored more about this. The password I am using is large enough to not let bruteforce algorithms to crack it. I am planning to put the container behind a virtual network while blocking 80 and 443 while letting the DNS to be a public DNS. Unfortunately, the region where my containers are running doesn't support this yet. I have to move my resources to another region before attempting to put it behind a virtual network and a security group.

Collapse
 
srebella profile image
Santiago Rebella •

Thanks for the article! I always wanted to get my hands into the PiHole, and this is a good kickstart. However I could create all the pihole and services in Azure, but i am having an issue with the gravity database on Azure file share.
Somehow after installing the PiHole, the database is empty, and I am finding impossible to fill the blocklist.
So it works but you can't block the ads.

Collapse
 
balauppaloori profile image
Bala Uppaloori •

Same issue here!! dont know how the author got to block all those ads. perhaps it was a different/specific version that is broken later?

Collapse
 
balauppaloori profile image
Bala Uppaloori • • Edited

There seems to be something missing with this installation. Whether we specify latest or a specific version, the gravity db seems to be corrupt. It doesnt accept any adlist, or individual domain. I have searched high and low, found some solutions and they all need ssh to the container. Even after that, the gravity db columns are missing, making this whole exercize a waste of time, because you cant block anything. This would just be a skeleton pihole, sadly looking all the ads being served!! :( Any thoughts?

Collapse
 
mikemilzz profile image
🅜🅘🅚🅔🅜🅘🅛🅩🅩 •

This is a great idea. Any idea what the cost is to keep this running?

Collapse
 
ganesshkumar profile image
Ganessh Kumar •

It comes to around $30 dollars per month. The CPU utilization of the container group is very less. I am planning to deploy few self-hosted applications together in the same container group. That should bring down the cost of running this significantly.

Collapse
 
balauppaloori profile image
Bala Uppaloori •

Is there a way to ssh into the pihole container? My gravity db seems to be broken and needs a rebuild. Thanks!