feat(k8s/pihole): whitelist client

This commit is contained in:
2026-03-22 18:43:05 +02:00
parent a28a69df76
commit a3ccd0c430
2 changed files with 10 additions and 2 deletions

View File

@@ -13,3 +13,6 @@ data:
https://raw.githubusercontent.com/braveinnovators/ukrainian-security-filter/main/lists/domains.txt https://raw.githubusercontent.com/braveinnovators/ukrainian-security-filter/main/lists/domains.txt
# Phishing Army Extended # Phishing Army Extended
https://phishing.army/download/phishing_army_blocklist_extended.txt https://phishing.army/download/phishing_army_blocklist_extended.txt
unfiltered-clients.txt: |
# Clients without ad blocking (one per line, use IP — PiHole matches by IP, not hostname)
10.127.0.10

View File

@@ -74,9 +74,14 @@ spec:
done done
grep -v '^#\|^$' /etc/pihole-adlists/adlists.txt | while read -r url; do grep -v '^#\|^$' /etc/pihole-adlists/adlists.txt | while read -r url; do
curl -s -X POST "http://localhost/api/lists?type=block&sid=$SID" \ curl -s -X POST "http://localhost/api/lists?type=block&sid=$SID" \
-d "{\"address\":\"$url\"}" > /dev/null -d "{\"address\":\"$url\"}"
done done
curl -s -X POST "http://localhost/api/action/gravity?sid=$SID" > /dev/null grep -v '^#\|^$' /etc/pihole-adlists/unfiltered-clients.txt | while read -r client; do
curl -s -X POST "http://localhost/api/clients?sid=$SID" \
-d "{\"client\":\"$client\",\"groups\":[]}"
done
# NOTE: gravity must be last — it blocks until complete and may outlive the SID
curl -s -X POST "http://localhost/api/action/gravity?sid=$SID"
) & ) &
volumeMounts: volumeMounts:
- name: pihole-config - name: pihole-config