From 50f38880f523e9d9eb83ddbd2b2d00484706758c Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Tue, 7 Feb 2023 03:03:36 +0100 Subject: [PATCH] Improved all about pi-hole --- .vscode/settings.json | 1 + docker/pihole/crontab | 7 +++-- docker/pihole/docker-compose.yml | 32 +++++++++------------ knowledge base/pi-hole.md | 9 ++++++ knowledge base/pihole.md | 49 ++++++++++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 21 deletions(-) create mode 100644 knowledge base/pihole.md diff --git a/.vscode/settings.json b/.vscode/settings.json index 1db7a1d..c3e1c4a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -35,6 +35,7 @@ "ocsp", "pacman", "pamac", + "pihole", "pkexec", "polkit", "pvresize", diff --git a/docker/pihole/crontab b/docker/pihole/crontab index 6db80cb..67deac9 100644 --- a/docker/pihole/crontab +++ b/docker/pihole/crontab @@ -1,2 +1,5 @@ -# Update Graviton's DB once a week (at midnight on Sundays). -0 0 * * 0 docker ps -f 'name=pihole' -f 'status=running' -f 'health=healthy' -q | xargs -I{} docker exec {} pihole -g +# Update Graviton's DB once a week (at 3:00 on Sundays). +0 3 * * 0 docker ps -f 'name=pihole' -f 'status=running' -f 'health=healthy' -q | xargs -I{} docker exec {} pihole -g + +# Create a complete backup once a week (at 3:30 on Sundays). +30 3 * * 0 docker ps -f 'name=pihole' -f 'status=running' -f 'health=healthy' -q | xargs -I{} docker exec {} pihole -a -t /etc/pihole/teleporter_backup.tar.gz diff --git a/docker/pihole/docker-compose.yml b/docker/pihole/docker-compose.yml index 6bb3506..a7c5e4e 100644 --- a/docker/pihole/docker-compose.yml +++ b/docker/pihole/docker-compose.yml @@ -1,36 +1,30 @@ version: "3.2" - secrets: webpassword: file: ./webpassword - services: pihole: container_name: pihole - image: pihole/pihole:latest + image: pihole/pihole:2023.01.10 environment: + FTLCONF_LOCAL_IPV4: 127.0.0.1 + REV_SERVER_CIDR: 192.168.1.0/24 + REV_SERVER_DOMAIN: localdomain + REV_SERVER_TARGET: 192.168.1.1 + REV_SERVER: "true" + SKIPGRAVITYONBOOT: 1 TZ: Europe/Amsterdam WEBPASSWORD_FILE: /run/secrets/webpassword - # DNSMASQ_LISTENING: all # Only required if using Docker's default 'bridge' network setting volumes: - - ./etc-pihole:/etc/pihole - - ./etc-dnsmasq.d:/etc/dnsmasq.d + - ./etc/pihole:/etc/pihole + - ./etc/dnsmasq.d:/etc/dnsmasq.d dns: - 127.0.0.1 - 1.1.1.1 restart: unless-stopped secrets: - webpassword - - # If using the container's DHCP server it is recommended to replace the - # 'ports' definition with the 'network_mode' definition instead. - network_mode: "host" - # ports: - # - "53:53/tcp" - # - "53:53/udp" - # - "67:67/udp" # Only required if using the DHCP server component. - # - "80:80/tcp" - - # Only required if using the DHCP server component. - # cap_add: - # - NET_ADMIN + ports: + - "53:53/tcp" + - "53:53/udp" + - "80:80/tcp" diff --git a/knowledge base/pi-hole.md b/knowledge base/pi-hole.md index a6e4efa..eea56fe 100644 --- a/knowledge base/pi-hole.md +++ b/knowledge base/pi-hole.md @@ -16,5 +16,14 @@ stat /etc/pihole/gravity.db ## Further readings - Pi-hole's [repository] +- The [pihole] command +- [Run Pi-hole as a container with Podman on openSUSE] + [repository]: https://github.com/pi-hole/pi-hole + + +[pihole]: pihole.md + + +[run pi-hole as a container with podman on opensuse]: https://www.suse.com/c/pihole-podman-opensuse/ diff --git a/knowledge base/pihole.md b/knowledge base/pihole.md new file mode 100644 index 0000000..6ab677d --- /dev/null +++ b/knowledge base/pihole.md @@ -0,0 +1,49 @@ +# Pihole + +## TL;DR + +```sh +# Check the status. +pihole status + +# Temporarily disable blocking. +pihole disable '5m' + +# Follow the logs in real-time. +pihole tail + +# Set or change the Web Interface's password. +pihole -a -p +pihole -a -p 'new-password' + +# Show Chronometer, the console dashboard of real-time stats. +pihole -c + +# Show Chronometer and exit. +pihole -c -e + +# Empty Pi-hole's logs. +pihole flush + +# Update Graviton's DB. +pihole -g + +# Backup all settings and the configuration. +# Without a path, the backup will be created in the current directory. +# The resulting archive can be imported using the Settings > Teleport webpage. +pihole -a -t +pihole -a -t 'path/to/backup/file.tar.gz' +``` + +## Further readings + +- [Pi-hole] +- [The pihole command] + + +[the pihole command]: https://docs.pi-hole.net/core/pihole-command/ + + +[pi-hole]: pi-hole.md + +