mirror of
https://github.com/unman/shaker.git
synced 2024-10-01 01:25:41 -04:00
Pi-hole - update for 4.2
This commit is contained in:
parent
461f6195ef
commit
8ed3baa258
@ -21,10 +21,10 @@ Run `sudo /srv/salt/pihole/change_netvm.sh` .
|
|||||||
Pi-hole will be installed with these default settings:
|
Pi-hole will be installed with these default settings:
|
||||||
The DNS provider is Quad9 (filtered, DNSSEC)
|
The DNS provider is Quad9 (filtered, DNSSEC)
|
||||||
StevenBlack's Unified Hosts List is included
|
StevenBlack's Unified Hosts List is included
|
||||||
The web interface is availble at http://localhost
|
The web interface is availble at http://localhost/admin
|
||||||
Query logging is enabled to show everything.
|
Query logging is enabled to show everything.
|
||||||
|
|
||||||
You can change these settings by logging in to the admin interface at http://localhost.
|
You can change these settings by logging in to the admin interface at http://localhost/admin
|
||||||
The default Admin Webpage login password is UpSNQsy4
|
The default Admin Webpage login password is UpSNQsy4
|
||||||
You should change this on first use, by running:
|
You should change this on first use, by running:
|
||||||
`pihole -a -p`
|
`pihole -a -p`
|
||||||
@ -32,7 +32,7 @@ You should change this on first use, by running:
|
|||||||
|
|
||||||
The implementation is based on work by Patrizio Tufarolo,
|
The implementation is based on work by Patrizio Tufarolo,
|
||||||
(https://blog.tufarolo.eu/how-to-configure-pihole-in-qubesos-proxyvm/ ),
|
(https://blog.tufarolo.eu/how-to-configure-pihole-in-qubesos-proxyvm/ ),
|
||||||
and updated for Qubes 4.1
|
and updated for Qubes 4.2
|
||||||
|
|
||||||
for i in `qvm-ls -O NAME,NETVM | awk '/ sys-firewall/{ print $1 }'`; do qvm-prefs $i netvm sys-pihole; done
|
for i in `qvm-ls -O NAME,NETVM | awk '/ sys-firewall/{ print $1 }'`; do qvm-prefs $i netvm sys-pihole; done
|
||||||
if [[ $(qubes-prefs default_netvm sys-firewall |grep sys-firewall ) ]]; then qubes-prefs default_netvm sys-pihole; fi
|
if [[ $(qubes-prefs default_netvm sys-firewall |grep sys-firewall ) ]]; then qubes-prefs default_netvm sys-pihole; fi
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
pihole_depends:
|
pihole_depends:
|
||||||
qvm.template_installed:
|
qvm.template_installed:
|
||||||
- name: debian-11-minimal
|
- name: debian-12-minimal
|
||||||
|
|
||||||
pihole-present-id:
|
pihole-present-id:
|
||||||
qvm.present:
|
qvm.present:
|
||||||
- name: sys-pihole
|
- name: sys-pihole
|
||||||
- template: debian-11-minimal
|
- template: debian-12-minimal
|
||||||
- label: green
|
- label: green
|
||||||
- class: StandaloneVM
|
- class: StandaloneVM
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
auto eth0
|
auto enX0
|
||||||
iface eth0 inet static
|
iface enX0 inet static
|
||||||
address
|
address
|
||||||
netmask 255.0.0.0
|
netmask 255.0.0.0
|
||||||
gateway
|
gateway
|
@ -1,4 +0,0 @@
|
|||||||
#!/usr/sbin/nft -f
|
|
||||||
flush chain nat PR-QBS
|
|
||||||
insert rule nat PR-QBS iifname "vif*" tcp dport 53 dnat to 127.0.0.1
|
|
||||||
insert rule nat PR-QBS iifname "vif*" udp dport 53 dnat to 127.0.0.1
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
nft -f /rw/config/network-hooks.d/flush
|
|
@ -16,24 +16,24 @@
|
|||||||
{% set IP = salt['cmd.shell']('qubesdb-read /qubes-ip') %}
|
{% set IP = salt['cmd.shell']('qubesdb-read /qubes-ip') %}
|
||||||
{% set GW = salt['cmd.shell']('qubesdb-read /qubes-gateway') %}
|
{% set GW = salt['cmd.shell']('qubesdb-read /qubes-gateway') %}
|
||||||
|
|
||||||
/etc/network/interfaces.d/eth0:
|
/etc/network/interfaces.d/enX0:
|
||||||
file.managed:
|
file.managed:
|
||||||
- source:
|
- source:
|
||||||
- salt://pihole/eth0
|
- salt://pihole/enX0
|
||||||
- user: root
|
- user: root
|
||||||
- group: root
|
- group: root
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
|
|
||||||
set_ip:
|
set_ip:
|
||||||
file.line:
|
file.line:
|
||||||
- name: /etc/network/interfaces.d/eth0
|
- name: /etc/network/interfaces.d/enX0
|
||||||
- match: address
|
- match: address
|
||||||
- mode: replace
|
- mode: replace
|
||||||
- content: "address {{IP}}"
|
- content: "address {{IP}}"
|
||||||
|
|
||||||
set_gw:
|
set_gw:
|
||||||
file.line:
|
file.line:
|
||||||
- name: /etc/network/interfaces.d/eth0
|
- name: /etc/network/interfaces.d/enX0
|
||||||
- match: gateway
|
- match: gateway
|
||||||
- mode: replace
|
- mode: replace
|
||||||
- content: "gateway {{GW}}"
|
- content: "gateway {{GW}}"
|
||||||
@ -67,10 +67,6 @@ Pihole_installed:
|
|||||||
- php-xml
|
- php-xml
|
||||||
- unzip
|
- unzip
|
||||||
|
|
||||||
Pihole-systemd-mask:
|
|
||||||
cmd.run:
|
|
||||||
- name: systemctl disable systemd-resolved
|
|
||||||
|
|
||||||
https://github.com/pi-hole/pi-hole.git:
|
https://github.com/pi-hole/pi-hole.git:
|
||||||
git.latest:
|
git.latest:
|
||||||
- name: https://github.com/pi-hole/pi-hole.git
|
- name: https://github.com/pi-hole/pi-hole.git
|
||||||
@ -89,13 +85,6 @@ Pihole-setup:
|
|||||||
cmd.run:
|
cmd.run:
|
||||||
- name: '/root/pi-hole/automated\ install/basic-install.sh --unattended'
|
- name: '/root/pi-hole/automated\ install/basic-install.sh --unattended'
|
||||||
|
|
||||||
/rw/config/qubes-firewall-user-script:
|
|
||||||
file.append:
|
|
||||||
- text:
|
|
||||||
- nft flush chain nat PR-QBS
|
|
||||||
- nft insert rule nat PR-QBS iifname "vif*" tcp dport 53 dnat to 127.0.0.1
|
|
||||||
- nft insert rule nat PR-QBS iifname "vif*" udp dport 53 dnat to 127.0.0.1
|
|
||||||
|
|
||||||
/rw/config/qubes-firewall.d/update_nft.sh:
|
/rw/config/qubes-firewall.d/update_nft.sh:
|
||||||
file.managed:
|
file.managed:
|
||||||
- source:
|
- source:
|
||||||
@ -105,6 +94,15 @@ Pihole-setup:
|
|||||||
- makedirs: True
|
- makedirs: True
|
||||||
- mode: 755
|
- mode: 755
|
||||||
|
|
||||||
|
/rw/config/qubes-firewall.d/update_nft.nft:
|
||||||
|
file.managed:
|
||||||
|
- source:
|
||||||
|
- salt://pihole/update_nft.nft
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- makedirs: True
|
||||||
|
- mode: 755
|
||||||
|
|
||||||
/rw/config/network-hooks.d/internalise.sh:
|
/rw/config/network-hooks.d/internalise.sh:
|
||||||
file.managed:
|
file.managed:
|
||||||
- source:
|
- source:
|
||||||
@ -114,19 +112,10 @@ Pihole-setup:
|
|||||||
- makedirs: True
|
- makedirs: True
|
||||||
- mode: 755
|
- mode: 755
|
||||||
|
|
||||||
/rw/config/network-hooks.d/flush.sh:
|
/rw/config/network-hooks.d/update_nft.sh:
|
||||||
file.managed:
|
file.managed:
|
||||||
- source:
|
- source:
|
||||||
- salt://pihole/flush.sh
|
- salt://pihole/update_nft.sh
|
||||||
- user: root
|
|
||||||
- group: root
|
|
||||||
- makedirs: True
|
|
||||||
- mode: 755
|
|
||||||
|
|
||||||
/rw/config/network-hooks.d/flush:
|
|
||||||
file.managed:
|
|
||||||
- source:
|
|
||||||
- salt://pihole/flush
|
|
||||||
- user: root
|
- user: root
|
||||||
- group: root
|
- group: root
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
PIHOLE_INTERFACE=eth0
|
PIHOLE_INTERFACE=enX0
|
||||||
PIHOLE_DNS_1=9.9.9.9
|
PIHOLE_DNS_1=9.9.9.9
|
||||||
PIHOLE_DNS_2=149.112.112.112
|
PIHOLE_DNS_2=149.112.112.112
|
||||||
QUERY_LOGGING=true
|
QUERY_LOGGING=true
|
||||||
|
14
pihole/update_nft.nft
Normal file
14
pihole/update_nft.nft
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/sbin/nft -f
|
||||||
|
flush chain qubes dnat-dns
|
||||||
|
|
||||||
|
flush chain qubes custom-forward
|
||||||
|
insert rule qubes custom-forward tcp dport 53 drop
|
||||||
|
insert rule qubes custom-forward udp dport 53 drop
|
||||||
|
|
||||||
|
flush chain qubes custom-input
|
||||||
|
insert rule qubes custom-input tcp dport 53 accept
|
||||||
|
insert rule qubes custom-input udp dport 53 accept
|
||||||
|
|
||||||
|
flush chain qubes dnat-dns
|
||||||
|
insert rule qubes dnat-dns iifname "vif*" tcp dport 53 dnat to 127.0.0.1
|
||||||
|
insert rule qubes dnat-dns iifname "vif*" udp dport 53 dnat to 127.0.0.1
|
@ -1,12 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
get_handle(){
|
nft -f /rw/config/qubes-firewall.d/update_nft.nft
|
||||||
local my_handle=$( nft -a list table $1|awk 'BEGIN{c0} /related,established/{c++; if (c==1) print $NF}' )
|
|
||||||
echo $my_handle
|
|
||||||
}
|
|
||||||
|
|
||||||
nft insert rule filter FORWARD tcp dport 53 drop
|
|
||||||
nft insert rule filter FORWARD udp dport 53 drop
|
|
||||||
|
|
||||||
handle=$(get_handle filter)
|
|
||||||
nft add rule filter INPUT position $handle iifname "vif*" tcp dport 53 accept
|
|
||||||
nft add rule filter INPUT position $handle iifname "vif*" udp dport 53 accept
|
|
||||||
|
Loading…
Reference in New Issue
Block a user