Add failing firewall configuration
This commit is contained in:
parent
e06547e25c
commit
2502d034d9
3 changed files with 20 additions and 20 deletions
16
playbook.yml
16
playbook.yml
|
|
@ -9,15 +9,15 @@
|
||||||
roles:
|
roles:
|
||||||
# These roles are disabled after they have being applied once for performance reasons, it should be safe to enable them again.
|
# These roles are disabled after they have being applied once for performance reasons, it should be safe to enable them again.
|
||||||
# Notice that this role changes some settings on reruns (on the "Change various sysctl-settings" task), doesn't seem problematic though.
|
# Notice that this role changes some settings on reruns (on the "Change various sysctl-settings" task), doesn't seem problematic though.
|
||||||
- role: devsec.hardening.ssh_hardening
|
# - role: devsec.hardening.ssh_hardening
|
||||||
become: true
|
# become: true
|
||||||
- role: hostname
|
# - role: hostname
|
||||||
- role: basic-intalls
|
- role: basic-intalls
|
||||||
- role: user
|
# - role: user
|
||||||
- role: cloudflare-ddns
|
# - role: cloudflare-ddns
|
||||||
- role: reverse-proxy
|
# - role: reverse-proxy
|
||||||
- role: actual
|
# - role: actual
|
||||||
# - role: pi-hole
|
- role: pi-hole
|
||||||
vars:
|
vars:
|
||||||
# devsec.hardening.ssh_hardening vars:
|
# devsec.hardening.ssh_hardening vars:
|
||||||
ssh_allow_users: 'thomas'
|
ssh_allow_users: 'thomas'
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
pkg:
|
pkg:
|
||||||
- git
|
- git
|
||||||
- vim
|
- vim
|
||||||
|
- dnsutils
|
||||||
- ufw
|
- ufw
|
||||||
- podman
|
- podman
|
||||||
- snapd
|
- snapd
|
||||||
|
|
@ -39,6 +40,12 @@
|
||||||
regexp: '^#net/ipv4/ip_forward=1$'
|
regexp: '^#net/ipv4/ip_forward=1$'
|
||||||
line: 'net/ipv4/ip_forward=1'
|
line: 'net/ipv4/ip_forward=1'
|
||||||
notify: Restart ufw
|
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
|
- name: Allow all access to ssh
|
||||||
become: true
|
become: true
|
||||||
community.general.ufw:
|
community.general.ufw:
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
containers.podman.podman_container:
|
containers.podman.podman_container:
|
||||||
name: pi-hole
|
name: pi-hole
|
||||||
image: docker.io/pihole/pihole:2024.03.2
|
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:
|
publish:
|
||||||
# It seems we can't use authbind in combination with Podman, see: https://github.com/containers/podman/issues/13426.
|
# 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.
|
# 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
|
become: true
|
||||||
ansible.builtin.blockinfile:
|
ansible.builtin.blockinfile:
|
||||||
path: /etc/ufw/before.rules
|
path: /etc/ufw/before.rules
|
||||||
insertafter: "^COMMIT$"
|
insertbefore: "^\\*filter$"
|
||||||
block: |-
|
block: |
|
||||||
*nat
|
*nat
|
||||||
:PREROUTING ACCEPT [0:0]
|
:PREROUTING ACCEPT [0:0]
|
||||||
-A PREROUTING -p tcp --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 --dport 53 -j REDIRECT --to-port 5053
|
-A PREROUTING -p udp -i eth0 --dport 53 -j DNAT \ --to-destination 127.0.0.1:5053
|
||||||
COMMIT
|
COMMIT
|
||||||
notify: Restart ufw
|
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)
|
- name: Allow all access to port 53 (udp)
|
||||||
become: true
|
become: true
|
||||||
community.general.ufw:
|
community.general.ufw:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue