Browse Source

Add pihole

master
nicolas.dorier 5 years ago
parent
commit
fc6c5f99eb
No known key found for this signature in database GPG Key ID: 6618763EF09186FE
  1. 1
      Generated/pihole/02-lan.conf
  2. 2
      Generated/pihole/resolv.conf
  3. 9
      README.md
  4. 3
      btcpay-setup.sh
  5. 7
      contrib/DockerFileBuildHelper/Program.cs
  6. 41
      contrib/build-all-images.sh
  7. 23
      docker-compose-generator/docker-fragments/opt-add-pihole.yml
  8. 66
      docs/pihole.md
  9. 1
      helpers.sh
  10. 3
      pihole.sh

1
Generated/pihole/02-lan.conf

@ -0,0 +1 @@
addn-hosts=/etc/pihole/lan.list

2
Generated/pihole/resolv.conf

@ -0,0 +1,2 @@
nameserver 127.0.0.1
nameserver 8.8.8.8

9
README.md

@ -164,6 +164,8 @@ Available `BTCPAYGEN_ADDITIONAL_FRAGMENTS` currently are:
* [opt-add-electrumx](docker-compose-generator/docker-fragments/opt-add-electrumx.yml), to integrate a full ElectrumX server (from official source) with BTCPay, using the BTCPay server's full bitcoin node for complete privacy when using your own Electrum wallet. You can also open port 50002 up to the internet on your router etc, to be part of the ElectrumX network, helping other Electrum wallet users to get connected. The bitcoin option `-txindex` is mandatory for ElectrumX, and this fragement will enable it on your BTCPay server automatically - NO need to use the fragment opt-txindex.yml.
* [opt-add-electrum-ps](docker-compose-generator/docker-fragments/opt-add-electrum-ps.yml), to integrate Electrum Personal Server (EPS) with BTCPay (EPS is a single-user alternative to the ElectrumX Server option above). EPS will also use the BTCPay server's full bitcoin node for complete privacy when using your own Electrum wallet, for your own personal use (i.e. other users cannot use your server to verify transactions). Also, the bitcoin option `-txindex` is NOT mandatory for EPS, and it will run on a pruned node (unlike ElectrumX). You will need to add your XPUB/YPUB/ZPUB as environment variable `EPS_XPUB` before enabling EPS for the first time (see above section on environment variables, and see [full documentation](https://github.com/btcpayserver/btcpayserver-doc/blob/master/ElectrumPersonalServer.md) for details).
* [opt-add-configurator](docker-compose-generator/docker-fragments/opt-add-configurator.yml), to integrate the [BTCPay Server Configurator](https://install.btcpayserver.org) to manage your BTCPay deployment through a UI, and to allow new deployments elsewhere easily.
* [opt-add-pihole](docker-compose-generator/docker-fragments/opt-add-pihole.yml) ([See the documentation](docs/pihole.md))
You can also create your own [custom fragments](#how-can-i-customize-the-generated-docker-compose-file).
@ -325,6 +327,7 @@ We are trying to update our dependencies to run on `arm32v7` and `x64` boards. H
| btcpayserver/btctransmuter | 0.0.50 | [✔️](https://raw.githubusercontent.com/btcpayserver/btctransmuter/v0.0.50/Dockerfiles/amd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/btctransmuter/v0.0.50/Dockerfiles/arm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/btctransmuter/v0.0.50/Dockerfiles/arm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/btctransmuter) - [DockerHub](https://hub.docker.com/r/btcpayserver/btctransmuter) |
| btcpayserver/btcpayserver-configurator | 0.0.18 | [✔️](https://raw.githubusercontent.com/btcpayserver/btcpayserver-configurator/v0.0.18/Dockerfiles/amd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/btcpayserver-configurator/v0.0.18/Dockerfiles/arm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/btcpayserver-configurator/v0.0.18/Dockerfiles/arm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/btcpayserver-configurator) - [DockerHub](https://hub.docker.com/r/btcpayserver/btcpayserver-configurator) |
| btcpayserver/eps | 0.2.0 | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/EPS/0.2.0/EPS/0.2.0/linuxamd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/EPS/0.2.0/EPS/0.2.0/linuxarm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/EPS/0.2.0/EPS/0.2.0/linuxarm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/dockerfile-deps) - [DockerHub](https://hub.docker.com/r/btcpayserver/eps) |
| pihole/pihole | v4.4 | ️❌ | [✔️](https://raw.githubusercontent.com/pi-hole/docker-pi-hole/v4.4/Dockerfile_armhf) | [✔️](https://raw.githubusercontent.com/pi-hole/docker-pi-hole/v4.4/Dockerfile_arm64) | [Github](https://github.com/pi-hole/docker-pi-hole) - [DockerHub](https://hub.docker.com/r/pihole/pihole) |
| btcpayserver/tor | 0.4.1.5 | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Tor/0.4.1.5/Tor/0.4.1.5/linuxamd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Tor/0.4.1.5/Tor/0.4.1.5/linuxarm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Tor/0.4.1.5/Tor/0.4.1.5/linuxarm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/dockerfile-deps) - [DockerHub](https://hub.docker.com/r/btcpayserver/tor) |
| postgres | 9.6.5 | [✔️](https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile) | [✔️](https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile) | [✔️](https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile) | [Github](https://github.com/docker-library/postgres) - [DockerHub](https://hub.docker.com/_/postgres) |
| kamigawabul/docker-bitcoingold | 0.15.2 | [✔️](https://raw.githubusercontent.com/Vutov/docker-bitcoin/master/bitcoingold/0.15.2/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/Vutov/docker-bitcoin) - [DockerHub](https://hub.docker.com/r/kamigawabul/docker-bitcoingold) |
@ -336,9 +339,9 @@ We are trying to update our dependencies to run on `arm32v7` and `x64` boards. H
| rockstardev/dogecoin | 1.10.0 | [✔️](https://raw.githubusercontent.com/rockstardev/docker-bitcoin/feature/dogecoin/dogecoin/1.10.0/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/rockstardev/docker-bitcoin) - [DockerHub](https://hub.docker.com/r/rockstardev/dogecoin) |
| chekaz/docker-feathercoin | 0.16.3 | [✔️](https://raw.githubusercontent.com/ChekaZ/docker/master/feathercoin/0.16.3/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/ChekaZ/docker) - [DockerHub](https://hub.docker.com/r/chekaz/docker-feathercoin) |
| nicolasdorier/docker-groestlcoin | 2.18.2 | [✔️](https://raw.githubusercontent.com/NicolasDorier/docker-bitcoin/master/groestlcoin/2.18.2/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/NicolasDorier/docker-bitcoin) - [DockerHub](https://hub.docker.com/r/nicolasdorier/docker-groestlcoin) |
| groestlcoin/lightning | v0.8.0 | [✔️](https://raw.githubusercontent.com/Groestlcoin/lightning/v0.8.0/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/Groestlcoin/lightning) - [DockerHub](https://hub.docker.com/r/groestlcoin/lightning) |
| groestlcoin/groestlcoin-lightning-charge | version-0.4.11 | [✔️](https://raw.githubusercontent.com/Groestlcoin/groestlcoin-lightning-charge/v0.4.11/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/Groestlcoin/groestlcoin-lightning-charge) - [DockerHub](https://hub.docker.com/r/groestlcoin/groestlcoin-lightning-charge) |
| groestlcoin/groestlcoin-spark | version-0.2.9 | [✔️](https://raw.githubusercontent.com/Groestlcoin/groestlcoin-spark/v0.2.9/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/Groestlcoin/groestlcoin-spark) - [DockerHub](https://hub.docker.com/r/groestlcoin/groestlcoin-spark) |
| groestlcoin/lightning | v0.8.1 | [✔️](https://raw.githubusercontent.com/Groestlcoin/lightning/v0.8.1/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/Groestlcoin/lightning) - [DockerHub](https://hub.docker.com/r/groestlcoin/lightning) |
| groestlcoin/groestlcoin-lightning-charge | version-0.4.16 | [✔️](https://raw.githubusercontent.com/Groestlcoin/groestlcoin-lightning-charge/v0.4.16/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/Groestlcoin/groestlcoin-lightning-charge) - [DockerHub](https://hub.docker.com/r/groestlcoin/groestlcoin-lightning-charge) |
| groestlcoin/groestlcoin-spark | version-0.2.12 | [✔️](https://raw.githubusercontent.com/Groestlcoin/groestlcoin-spark/v0.2.12/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/Groestlcoin/groestlcoin-spark) - [DockerHub](https://hub.docker.com/r/groestlcoin/groestlcoin-spark) |
| groestlcoin/lnd | v0.8.2-grs | [✔️](https://raw.githubusercontent.com/Groestlcoin/lnd/v0.8.2-grs/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/Groestlcoin/lnd) - [DockerHub](https://hub.docker.com/r/groestlcoin/lnd) |
| btcpayserver/elements | 0.18.1.1-1 | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Elements/0.18.1.1-1/Elements/0.18.1.1/linuxamd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Elements/0.18.1.1-1/Elements/0.18.1.1/linuxarm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Elements/0.18.1.1-1/Elements/0.18.1.1/linuxarm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/dockerfile-deps) - [DockerHub](https://hub.docker.com/r/btcpayserver/elements) |
| btcpayserver/litecoin | 0.17.1-1 | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Litecoin/0.17.1-1/Litecoin/0.17.1/linuxamd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Litecoin/0.17.1-1/Litecoin/0.17.1/linuxarm32v7.Dockerfile) | ️❌ | [Github](https://github.com/btcpayserver/dockerfile-deps) - [DockerHub](https://hub.docker.com/r/btcpayserver/litecoin) |

3
btcpay-setup.sh

@ -200,6 +200,7 @@ fi
: "${REVERSEPROXY_HTTP_PORT:=80}"
: "${REVERSEPROXY_HTTPS_PORT:=443}"
: "${BTCPAY_ENABLE_SSH:=false}"
: "${PIHOLE_SERVERIP:=}"
OLD_BTCPAY_DOCKER_COMPOSE="$BTCPAY_DOCKER_COMPOSE"
ORIGINAL_DIRECTORY="$(pwd)"
@ -305,6 +306,7 @@ BTCPAY_IMAGE:$BTCPAY_IMAGE
ACME_CA_URI:$ACME_CA_URI
TOR_RELAY_NICKNAME: $TOR_RELAY_NICKNAME
TOR_RELAY_EMAIL: $TOR_RELAY_EMAIL
PIHOLE_SERVERIP: $PIHOLE_SERVERIP
----------------------
Additional exported variables:
BTCPAY_DOCKER_COMPOSE=$BTCPAY_DOCKER_COMPOSE
@ -355,6 +357,7 @@ export BTCPAY_BASE_DIRECTORY=\"$BTCPAY_BASE_DIRECTORY\"
export BTCPAY_ENV_FILE=\"$BTCPAY_ENV_FILE\"
export BTCPAY_HOST_SSHKEYFILE=\"$BTCPAY_HOST_SSHKEYFILE\"
export BTCPAY_ENABLE_SSH=$BTCPAY_ENABLE_SSH
export PIHOLE_SERVERIP=\"$PIHOLE_SERVERIP\"
if cat \"\$BTCPAY_ENV_FILE\" &> /dev/null; then
while IFS= read -r line; do
! [[ \"\$line\" == \"#\"* ]] && [[ \"\$line\" == *\"=\"* ]] && export \"\$line\"

7
contrib/DockerFileBuildHelper/Program.cs

@ -232,6 +232,13 @@ namespace DockerFileBuildHelper
retry:
switch (name)
{
case "pihole":
dockerInfo.GitLink = "https://github.com/pi-hole/docker-pi-hole";
dockerInfo.DockerFilePathARM32v7 = $"Dockerfile_armhf";
dockerInfo.DockerFilePathARM64v8 = $"Dockerfile_arm64";
dockerInfo.GitRef = $"{image.Tag}";
dockerInfo.SupportedByUs = true;
break;
case "eps":
dockerInfo.DockerFilePath = $"EPS/{NoRevision(image.Tag)}/linuxamd64.Dockerfile";
dockerInfo.DockerFilePathARM32v7 = $"EPS/{NoRevision(image.Tag)}/linuxarm32v7.Dockerfile";

41
contrib/build-all-images.sh

@ -282,38 +282,38 @@ cd - && cd ..
# Build lightning
# https://raw.githubusercontent.com/Groestlcoin/lightning/v0.8.0/Dockerfile
# https://raw.githubusercontent.com/Groestlcoin/lightning/v0.8.1/Dockerfile
DOCKERFILE="Dockerfile"
echo "Building groestlcoin/lightning:v0.8.0"
echo "Building groestlcoin/lightning:v0.8.1"
git clone https://github.com/Groestlcoin/lightning lightning
cd lightning
git checkout v0.8.0
git checkout v0.8.1
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "groestlcoin/lightning:v0.8.0" .
docker build -f "$DOCKERFILE" -t "groestlcoin/lightning:v0.8.1" .
cd - && cd ..
# Build groestlcoin-lightning-charge
# https://raw.githubusercontent.com/Groestlcoin/groestlcoin-lightning-charge/v0.4.11/Dockerfile
# https://raw.githubusercontent.com/Groestlcoin/groestlcoin-lightning-charge/v0.4.16/Dockerfile
DOCKERFILE="Dockerfile"
echo "Building groestlcoin/groestlcoin-lightning-charge:version-0.4.11"
echo "Building groestlcoin/groestlcoin-lightning-charge:version-0.4.16"
git clone https://github.com/Groestlcoin/groestlcoin-lightning-charge groestlcoin-lightning-charge
cd groestlcoin-lightning-charge
git checkout v0.4.11
git checkout v0.4.16
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "groestlcoin/groestlcoin-lightning-charge:version-0.4.11" .
docker build -f "$DOCKERFILE" -t "groestlcoin/groestlcoin-lightning-charge:version-0.4.16" .
cd - && cd ..
# Build groestlcoin-spark
# https://raw.githubusercontent.com/Groestlcoin/groestlcoin-spark/v0.2.9/Dockerfile
# https://raw.githubusercontent.com/Groestlcoin/groestlcoin-spark/v0.2.12/Dockerfile
DOCKERFILE="Dockerfile"
echo "Building groestlcoin/groestlcoin-spark:version-0.2.9"
echo "Building groestlcoin/groestlcoin-spark:version-0.2.12"
git clone https://github.com/Groestlcoin/groestlcoin-spark groestlcoin-spark
cd groestlcoin-spark
git checkout v0.2.9
git checkout v0.2.12
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "groestlcoin/groestlcoin-spark:version-0.2.9" .
docker build -f "$DOCKERFILE" -t "groestlcoin/groestlcoin-spark:version-0.2.12" .
cd - && cd ..
@ -611,6 +611,23 @@ docker build -f "$DOCKERFILE" -t "jvandrew/isso:atron.22" .
cd - && cd ..
# Build pihole
DOCKERFILE=""
# https://raw.githubusercontent.com/pi-hole/docker-pi-hole/v4.4/Dockerfile_armhf
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="Dockerfile_armhf"
# https://raw.githubusercontent.com/pi-hole/docker-pi-hole/v4.4/Dockerfile_arm64
[[ "$(uname -m)" == "aarch64" ]] && DOCKERFILE="Dockerfile_arm64"
if [[ "$DOCKERFILE" ]]; then
echo "Building pihole/pihole:v4.4"
git clone https://github.com/pi-hole/docker-pi-hole pihole
cd pihole
git checkout v4.4
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "pihole/pihole:v4.4" .
cd - && cd ..
fi
# Build docker-gen
# https://raw.githubusercontent.com/btcpayserver/docker-gen/v0.7.7/linuxamd64.Dockerfile
DOCKERFILE="linuxamd64.Dockerfile"

23
docker-compose-generator/docker-fragments/opt-add-pihole.yml

@ -0,0 +1,23 @@
version: '3'
services:
pihole:
restart: unless-stopped
container_name: pihole
image: pihole/pihole:v4.4
environment:
ServerIP: "${PIHOLE_SERVERIP:-127.0.0.1}"
VIRTUAL_HOST: pi.hole
VIRTUAL_HOST_NAME: "pihole"
expose:
- "53"
- "67"
- "80"
- "443"
ports:
- "53:53/udp"
volumes:
- "./pihole/02-lan.conf:/etc/dnsmasq.d/02-lan.conf:ro"
- "./pihole/resolv.conf:/etc/resolv.conf:ro"
- "pihole_datadir:/etc/pihole"
volumes:
pihole_datadir:

66
docs/pihole.md

@ -0,0 +1,66 @@
# Pi-Hole support
[Pi-Hole](https://pi-hole.net/) is a black hole for internet advertisement.
It works as a DNS server which blacklist domains tied to advertisement. If you use it as your main DNS server and it detects your query is trying to resolve a domain belonging to an advertisement company, it will resolve the domain to IP `0.0.0.0`, preventing the advertisement to load on any computer using this DNS server.
Note that our pi-hole integration is meant to be used in a **local network**. Please do not try to use this option on a VPS.
## How to use
Let's imagine the local IP of your BTCPay Server is `192.168.1.2`.
1. Connect as root to your server
2. Add pihole as an option to your docker deployment
```bash
BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-pihole"
. btcpay-setup.sh -i
```
3. If your server has a firewall, make sure it allow incoming traffic to port `53 (UDP)`.
4. Configure your home router DHCP server to use `192.168.1.2`
From now everytime a device will connect to your local network, they will automatically use pi-hole as a DNS server. Advertisements will go to a black hole for all devices.
## Using the dashboard
Pi-Hole comes with a very nice admin dashboard to monitor its activity.
It is disabled by default. To enable it, you need to configure `PIHOLE_IPSERVER` to the IP of your server:
```bash
PIHOLE_IPSERVER="192.168.1.2"
. btcpay-setup.sh -i
```
If your device is using pi-hole as a DNS server, you should now be able to browse `http://pi.hole/admin` to connect to your dashboard.
You can find the admin password in the logs of pihole:
```bash
docker logs pihole | grep random
```
If the password does not work, you can try to reset the password:
```bash
pihole.sh -a -p
docker restart pihole
```
Then running again
```bash
docker logs pihole | grep random
```
## Adding custom entry to pi-hole dns
You can easily add your local domains to pi-hole.
Imagine you have a NAS (like synology) on your local network with IP `192.168.1.3`, and you want to access it through `synology.lan`.
```bash
local_dns_list="$(docker volume inspect generated_pihole_datadir -f "{{.Mountpoint}}")/lan.list"
# In most cases this will be /var/lib/docker/volumes/generated_pihole_datadir/_data/lan.list
echo "192.168.1.3 synology.lan" >> "$local_dns_list"
pihole.sh restartdns
```
You can now browse `http://synology.lan` to access your NAS.

1
helpers.sh

@ -18,6 +18,7 @@ install_tooling() {
"btcpayserver_trezarcoind" "trezarcoin-cli.sh" "Command line for your Trezar instance" \
"btcpayserver_viacoind" "viacoin-cli.sh" "Command line for your Viacoin instance" \
"btcpayserver_elementsd" "elements-cli.sh" "Command line for your Elements/Liquid instance" \
"pihole" "pihole.sh" "Command line for running pihole commands" \
"*" "btcpay-clean.sh" "Command line for deleting old unused docker images" \
"*" "btcpay-down.sh" "Command line for stopping all services related to BTCPay Server" \
"*" "btcpay-restart.sh" "Command line for restarting all services related to BTCPay Server" \

3
pihole.sh

@ -0,0 +1,3 @@
#!/bin/bash
docker exec pihole pihole "$@"
Loading…
Cancel
Save