This commit is contained in:
2024-07-03 19:35:21 +00:00
parent b8348de27a
commit 5ac7e482ea
12 changed files with 106 additions and 12 deletions

View File

@@ -1,5 +1,10 @@
---
# tasks file for Debian_firewall
- name: Copy nftables configuration template
template:
src: "nftables.conf.j2"
dest: /etc/nftables.con
- name: Enable nftables
service:
name: nftables

View File

@@ -0,0 +1,18 @@
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
chain input {
type filter hook input priority filter;
{% for port in open_ports %}
iifname "{{ port.interface }}" {{ port.protocol }} dport {{ port.port }} accept
{% endfor %}
}
chain forward {
type filter hook forward priority filter;
}
chain output {
type filter hook output priority filter;
}
}