ITGOIT - Wiki

Pi-hole

Requirements
- Macvlan network LAN

Make sure the macvlan network named: LAN has been created. If not then create one now

cd /home/myusername/docker
mkdir pihole && cd "$_"

nano docker-compose.yml

services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    hostname: pihole01
    ports:
      - "8124:53/tcp" # DNS Port
      - "8124:53/udp" # DNS Port
      - "8122:80/tcp" # Default HTTP Port
      - "8121:443/tcp" # Default HTTPs Port. FTL will generate a self-signed certificate
      - "8123:67/udp" # To use Pi-hole as a DHCP server
#      - "8125:123/udp" # To use Pi-hole as a NTP server
    environment:
      TZ: Etc/UTC
      FTLCONF_webserver_api_password: Pihole! # Set password to access web interface. If emty a random password will be generated
      FTLCONF_dns_listeningMode: all # If using Docker's default `bridge` network setting the dns listening mode should be set to 'all'
    volumes:
      - ./data:/etc/pihole
      - ./dnsmasq:/etc/dnsmasq.d
#      - ./lighttpd:/etc/lighttpd
#      - ./errorpage:/var/www/html/pihole
    cap_add:
      # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
      - NET_ADMIN # Required if Pi-hole is used as a DHCP server, else not needed
#      - SYS_TIME # Required if Pi-hole is used as a NTP server, else not needed
      - SYS_NICE # Optional if Pi-hole should get some more processing time
    restart: unless-stopped
    networks:
      LAN:
        ipv4_address: 192.168.1.123 # Access the web interface at http://192.168.1.123/admin/login.php

networks:
  LAN:
    external: true
docker compose up -d

Configure pi-hole

Visit: http://IMPORT_PIHOLE_URL_HERE/admin/login.php
Default login
Password: pihole!

Domain block lists

Tracking & Telemetry Lists - https://firebog.net/ GREEN

https://v.firebog.net/hosts/Easyprivacy.txt
https://v.firebog.net/hosts/Prigent-Ads.txt
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.2o7Net/hosts
https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt
https://hostfiles.frogeye.fr/firstparty-trackers-hosts.txt

Suspicious Lists - https://firebog.net/ GREEN

https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts
https://v.firebog.net/hosts/static/w3kbl.txt

Other Lists - https://firebog.net/ GREEN

https://zerodot1.gitlab.io/CoinBlockerLists/hosts_browser

Migrated from /etc/pihole/adlists.list

https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

Malicious Lists - https://firebog.net/ GREEN

https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareHosts.txt
https://osint.digitalside.it/Threat-Intel/lists/latestdomains.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt
https://v.firebog.net/hosts/Prigent-Crypto.txt
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Risk/hosts
https://bitbucket.org/ethanr/dns-blacklists/raw/8575c9f96e5b4a1308f2f12394abd86d0927a4a0/bad_lists/Mandiant_APT1_Report_Appendix_D.txt
https://phishing.army/download/phishing_army_blocklist_extended.txt
https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt
https://v.firebog.net/hosts/RPiList-Malware.txt
https://v.firebog.net/hosts/RPiList-Phishing.txt
https://raw.githubusercontent.com/Spam404/lists/master/main-blacklist.txt
https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts
https://urlhaus.abuse.ch/downloads/hostfile/

Advertising Lists - https://firebog.net/ GREEN

https://adaway.org/hosts.txt
https://v.firebog.net/hosts/AdguardDNS.txt
https://v.firebog.net/hosts/Admiral.txt
https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
https://v.firebog.net/hosts/Easylist.txt
https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/UncheckyAds/hosts
https://raw.githubusercontent.com/bigdargon/hostsVN/master/hosts

More information: https://www.youtube.com/watch?v=0wpn3rXTe0g

Configure pihole DNS from webui

  1. Visit the pi-hole admin dashboard: http://192.168.x.x/admin/index.php
  2. Go to: Local DNS > DNS Records
    Domain: mydockerhost.local.DOMAIN.COM
    IP Address: YOUR_DOCKER_HOST_IP_HERE
  3. Click on: Create
  4. Click on: CNAME Records
    Domain: myservice.local.DOMAIN.COM
    Target Domain: mydockerhost.local.DOMAIN.COM
  5. Click on: Add

Configure pihole DNS from file

nano pihole/dnsmasq/05-pihole-custom-cname.conf
cname=myservice.local.DOMAIN.COM,mydockerhost.local.DOMAIN.COM
cname=myservice02.local.DOMAIN.COM,mydockerhost.local.DOMAIN.COM
cname=myservice03.local.DOMAIN.COM,mydockerhost.local.DOMAIN.COM
cname=myservice04.local.DOMAIN.COM,mydockerhost.local.DOMAIN.COM
cname=myservice05.local.DOMAIN.COM,mydockerhost.local.DOMAIN.COM

Custom error-page

cd /home/myusername/docker/pihole/lighttpd
nano external.conf
server.error-handler-404    = "/pihole/pi-error.php"
cd /home/myusername/docker/pihole/errorpage

Download and Import the following file into the errorpage folder
pi-error.php

docker restart pihole

Troubleshooting pihole

docker exec -it pihole /bin/bash
sudo nano /etc/lighttpd/lighttpd.conf
sudo chmod +x /var/www/html/pihole/pi-error.php
sudo service lighttpd restart
sudo service pihole-FTL restart

Alternatives