From c87f1673f469a44acfa0a360e7f5cd0b1c98bc6b Mon Sep 17 00:00:00 2001 From: Vegard Hagen Date: Mon, 24 Jul 2023 23:38:01 +0200 Subject: [PATCH] feat(pi-hole): Configuring Pi-Hole lists --- infra/pi-hole/cm-adlists.yaml | 32 -------- infra/pi-hole/cm-dnsmasq.yaml | 8 -- infra/pi-hole/cm-ftl.yaml | 9 --- infra/pi-hole/cm-regex.yaml | 16 ---- infra/pi-hole/cm-whitelist.yaml | 9 --- infra/pi-hole/config/adlists.list | 10 +++ infra/pi-hole/config/pihole-FTL.conf | 2 + infra/pi-hole/config/regex.list | 2 + infra/pi-hole/config/whitelist.txt | 2 + infra/pi-hole/deployment.yaml | 108 +++++++++++---------------- infra/pi-hole/kustomization.yaml | 19 +++-- infra/pi-hole/pvc.yaml | 10 +++ 12 files changed, 81 insertions(+), 146 deletions(-) delete mode 100644 infra/pi-hole/cm-adlists.yaml delete mode 100644 infra/pi-hole/cm-dnsmasq.yaml delete mode 100644 infra/pi-hole/cm-ftl.yaml delete mode 100644 infra/pi-hole/cm-regex.yaml delete mode 100644 infra/pi-hole/cm-whitelist.yaml create mode 100644 infra/pi-hole/config/adlists.list create mode 100644 infra/pi-hole/config/pihole-FTL.conf create mode 100644 infra/pi-hole/config/regex.list create mode 100644 infra/pi-hole/config/whitelist.txt create mode 100644 infra/pi-hole/pvc.yaml diff --git a/infra/pi-hole/cm-adlists.yaml b/infra/pi-hole/cm-adlists.yaml deleted file mode 100644 index 440144e..0000000 --- a/infra/pi-hole/cm-adlists.yaml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: adlists.list - namespace: pi-hole -data: - adlists.list: | - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts - https://mirror1.malwaredomains.com/files/justdomains - http://sysctl.org/cameleon/hosts - https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt - https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt - https://hosts-file.net/ad_servers.txt - https://blocklist.site/app/dl/porn - https://blocklist.site/app/dl/fakenews - https://blocklist.site/app/dl/tracking - https://blocklist.site/app/dl/drugs - https://blocklist.site/app/dl/phishing - https://blocklist.site/app/dl/gambling - https://blocklist.site/app/dl/malware - https://blocklist.site/app/dl/spam - https://blocklist.site/app/dl/ads - https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV.txt - https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/android-tracking.txt - https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt - https://raw.githubusercontent.com/StevenBlack/hosts/master/data/add.2o7Net/hosts - https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt - https://v.firebog.net/hosts/Easyprivacy.txt - https://v.firebog.net/hosts/Prigent-Ads.txt - https://blocklist.site/app/dl/scam - https://blocklist.site/app/dl/proxy - https://blocklist.site/app/dl/redirect diff --git a/infra/pi-hole/cm-dnsmasq.yaml b/infra/pi-hole/cm-dnsmasq.yaml deleted file mode 100644 index f11c9e5..0000000 --- a/infra/pi-hole/cm-dnsmasq.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: pi-hole-custom-dnsmasq -data: - 02-custom.conf: | - address=/stonegarden.dev/192.168.1.128 - address=/stonegarden.lan/192.168.1.128 \ No newline at end of file diff --git a/infra/pi-hole/cm-ftl.yaml b/infra/pi-hole/cm-ftl.yaml deleted file mode 100644 index e2d329a..0000000 --- a/infra/pi-hole/cm-ftl.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: pihole-ftl.conf - namespace: pi-hole -data: - pihole-FTL.conf: | - MAXDBDAYS=7 - LOGFILE=/var/log/pihole/pihole-FTL.log diff --git a/infra/pi-hole/cm-regex.yaml b/infra/pi-hole/cm-regex.yaml deleted file mode 100644 index a35601f..0000000 --- a/infra/pi-hole/cm-regex.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: regex.list - namespace: pi-hole -data: - regex.list: | - (^|\.)googlevideo\.com$ - (^|\.)twitch\.tv$ - (^|\.)wuaki\.tv$ - (^|\.)youtube\.be$ - (^|\.)youtube\.com$ - (^|\.)xvpn\.com$ - (^|\.)xvpn\.io$ - (^|\.)tiktok\.com$ - (^|\.)musical\.ly$ diff --git a/infra/pi-hole/cm-whitelist.yaml b/infra/pi-hole/cm-whitelist.yaml deleted file mode 100644 index ceea752..0000000 --- a/infra/pi-hole/cm-whitelist.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: whitelist.txt - namespace: pi-hole -data: - whitelist.txt: | - ichnaea.netflix.com - nrdp.nccp.netflix.com diff --git a/infra/pi-hole/config/adlists.list b/infra/pi-hole/config/adlists.list new file mode 100644 index 0000000..5444344 --- /dev/null +++ b/infra/pi-hole/config/adlists.list @@ -0,0 +1,10 @@ +https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts +https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt +https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt +https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV.txt +https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/android-tracking.txt +https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt +https://raw.githubusercontent.com/StevenBlack/hosts/master/data/add.2o7Net/hosts +https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt +https://v.firebog.net/hosts/Easyprivacy.txt +https://v.firebog.net/hosts/Prigent-Ads.txt diff --git a/infra/pi-hole/config/pihole-FTL.conf b/infra/pi-hole/config/pihole-FTL.conf new file mode 100644 index 0000000..a399413 --- /dev/null +++ b/infra/pi-hole/config/pihole-FTL.conf @@ -0,0 +1,2 @@ +MAXDBDAYS=200 +LOGFILE=/var/log/pihole/pihole-FTL.log diff --git a/infra/pi-hole/config/regex.list b/infra/pi-hole/config/regex.list new file mode 100644 index 0000000..3c949ea --- /dev/null +++ b/infra/pi-hole/config/regex.list @@ -0,0 +1,2 @@ +(^|\.)twitch\.tv$ +(^|\.)youtube\.com$ diff --git a/infra/pi-hole/config/whitelist.txt b/infra/pi-hole/config/whitelist.txt new file mode 100644 index 0000000..026dab1 --- /dev/null +++ b/infra/pi-hole/config/whitelist.txt @@ -0,0 +1,2 @@ +ichnaea.netflix.com +nrdp.nccp.netflix.com diff --git a/infra/pi-hole/deployment.yaml b/infra/pi-hole/deployment.yaml index 12c9f2d..a514591 100644 --- a/infra/pi-hole/deployment.yaml +++ b/infra/pi-hole/deployment.yaml @@ -11,10 +11,10 @@ spec: matchLabels: app: pi-hole strategy: + type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 1 - type: RollingUpdate template: metadata: labels: @@ -55,86 +55,62 @@ spec: limits: cpu: "250m" memory: "896Mi" - #readinessProbe: - # exec: - # command: ['dig', '@127.0.0.1', 'cnn.com'] - # timeoutSeconds: 20 - # initialDelaySeconds: 5 - # periodSeconds: 60 - #livenessProbe: - # tcpSocket: - # port: dns-tcp - # initialDelaySeconds: 15 - # periodSeconds: 30 livenessProbe: - httpGet: - path: /admin/index.php - port: http - scheme: HTTP + tcpSocket: + port: dns-tcp initialDelaySeconds: 60 failureThreshold: 10 timeoutSeconds: 5 readinessProbe: - httpGet: - path: /admin/index.php - port: http - scheme: HTTP + exec: + command: + - 'dig' + - '@127.0.0.1' + - 'github.com' initialDelaySeconds: 60 failureThreshold: 3 timeoutSeconds: 5 volumeMounts: + - name: config + mountPath: /etc/pihole - name: custom-dnsmasq mountPath: /etc/dnsmasq.d/02-custom.conf subPath: 02-custom.conf - # - name: var-log - # mountPath: /var/log - # - name: var-log-lighttpd - # mountPath: /var/log/lighttpd - # - name: ftlconf - # mountPath: /etc/pihole/pihole-FTL.conf - # subPath: pihole-FTL.conf - # - name: regex - # mountPath: /etc/pihole/regex.list - # subPath: regex.list - # - name: whitelist - # mountPath: /etc/pihole/whitelist.txt - # subPath: whitelist.txt - # - name: adlists - # mountPath: /etc/pihole/adlists.list - # subPath: adlists.list + #- name: ftl-conf + # mountPath: /etc/pihole/pihole-FTL.conf + # subPath: pihole-FTL.conf + - name: ad-lists + mountPath: /etc/pihole/adlists.list + subPath: adlists.list + - name: regex + mountPath: /etc/pihole/regex.list + subPath: regex.list + - name: whitelist + mountPath: /etc/pihole/whitelist.txt + subPath: whitelist.txt restartPolicy: Always volumes: + - name: config + emptyDir: {} + # persistentVolumeClaim: + # claimName: pi-hole-config - name: custom-dnsmasq configMap: + # defaultMode: 420 name: custom-dnsmasq - defaultMode: 420 - #- name: var-log - # emptyDir: - # medium: Memory - #- name: var-log-lighttpd - # emptyDir: - # medium: Memory - #- name: ftlconf + #- name: ftl-conf # configMap: - # name: pihole-ftl.conf - # items: - # - key: pihole-FTL.conf - # path: pihole-FTL.conf - #- name: regex - # configMap: - # name: regex.list - # items: - # - key: regex.list - # path: regex.list - #- name: whitelist - # configMap: - # name: whitelist.txt - # items: - # - key: whitelist.txt - # path: whitelist.txt - #- name: adlists - # configMap: - # name: adlists.list - # items: - # - key: adlists.list - # path: adlists.list \ No newline at end of file + # defaultMode: 420 + # name: ftl-conf + - name: ad-lists + configMap: + # defaultMode: 420 + name: adlists.list + - name: regex + configMap: + # defaultMode: 420 + name: regex.list + - name: whitelist + configMap: + # defaultMode: 420 + name: whitelist.txt \ No newline at end of file diff --git a/infra/pi-hole/kustomization.yaml b/infra/pi-hole/kustomization.yaml index d3507b0..ab2fa7f 100644 --- a/infra/pi-hole/kustomization.yaml +++ b/infra/pi-hole/kustomization.yaml @@ -4,25 +4,32 @@ namespace: pi-hole commonLabels: app: pi-hole - configMapGenerator: - name: pi-hole-env envs: - config/pi-hole-env + - name: ftl-conf + files: + - config/pihole-FTL.conf - name: custom-dnsmasq files: - config/02-custom.conf + - name: adlists.list + files: + - config/adlists.list + - name: regex.list + files: + - config/regex.list + - name: whitelist.txt + files: + - config/whitelist.txt resources: - namespace.yaml - auth-secret.yaml - ingress-route.yaml - service.yaml - #- cm-dnsmasq.yaml - #- cm-adlists.yaml - #- cm-ftl.yaml - #- cm-regex.yaml - #- cm-whitelist.yaml +# - pvc.yaml - deployment.yaml helmGlobals: diff --git a/infra/pi-hole/pvc.yaml b/infra/pi-hole/pvc.yaml new file mode 100644 index 0000000..b14b58c --- /dev/null +++ b/infra/pi-hole/pvc.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: pi-hole-config +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 500Mi \ No newline at end of file