Add failing firewall configuration

This commit is contained in:
Thomas Kleinendorst 2024-04-15 09:46:00 +02:00
parent e06547e25c
commit 2502d034d9
3 changed files with 20 additions and 20 deletions

View file

@ -5,6 +5,7 @@
pkg:
- git
- vim
- dnsutils
- ufw
- podman
- snapd
@ -39,6 +40,12 @@
regexp: '^#net/ipv4/ip_forward=1$'
line: 'net/ipv4/ip_forward=1'
notify: Restart ufw
- name: Allow forwarding in sysctl
become: true
ansible.builtin.lineinfile:
path: /etc/sysctl.conf
regexp: '^#net\.ipv4\.ip_forward=1$'
line: net.ipv4.ip_forward=1
- name: Allow all access to ssh
become: true
community.general.ufw:

View file

@ -40,7 +40,7 @@
containers.podman.podman_container:
name: pi-hole
image: docker.io/pihole/pihole:2024.03.2
restart_policy: on-failure # TODO: Doesn't restart containers on reboot for some reason...
restart_policy: on-failure
publish:
# It seems we can't use authbind in combination with Podman, see: https://github.com/containers/podman/issues/13426.
# Instead we'll map to a higher port number and install and use the ufw firewall to forward packets to the local port.
@ -78,21 +78,14 @@
become: true
ansible.builtin.blockinfile:
path: /etc/ufw/before.rules
insertafter: "^COMMIT$"
block: |-
insertbefore: "^\\*filter$"
block: |
*nat
:PREROUTING ACCEPT [0:0]
-A PREROUTING -p tcp --dport 53 -j REDIRECT --to-port 5053
-A PREROUTING -p udp --dport 53 -j REDIRECT --to-port 5053
-A PREROUTING -p tcp -i eth0 --dport 53 -j DNAT \ --to-destination 127.0.0.1:5053
-A PREROUTING -p udp -i eth0 --dport 53 -j DNAT \ --to-destination 127.0.0.1:5053
COMMIT
notify: Restart ufw
- name: Allow all access to https
become: true
community.general.ufw:
rule: allow
port: https
proto: tcp
notify: Restart ufw
- name: Allow all access to port 53 (udp)
become: true
community.general.ufw: