2022-10-03 16:15:12 +00:00
|
|
|
#!/usr/sbin/nft -f
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
|
|
|
flush ruleset
|
|
|
|
|
|
|
|
table inet filter {
|
|
|
|
chain input {
|
|
|
|
type filter hook input priority 0;
|
|
|
|
|
|
|
|
# accept any localhost traffic
|
|
|
|
iif lo accept
|
|
|
|
|
|
|
|
# accept traffic originated from us
|
|
|
|
ct state established,related accept
|
|
|
|
|
|
|
|
# accept neighbour discovery otherwise IPv6 connectivity breaks.
|
|
|
|
ip6 nexthdr icmpv6 icmpv6 type {nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert} accept
|
|
|
|
|
2023-12-29 10:12:41 +00:00
|
|
|
{% if nftables_rules | length > 0 %}
|
2023-12-28 16:39:20 +00:00
|
|
|
# include specific rules
|
|
|
|
include "/srv/nftables/rules.conf"
|
2023-12-29 10:12:41 +00:00
|
|
|
{% endif %}
|
2022-10-03 16:15:12 +00:00
|
|
|
|
|
|
|
# count and drop any other traffic
|
|
|
|
counter drop
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-29 10:12:41 +00:00
|
|
|
{% if nftables_tables | length > 0 %}
|
2022-10-03 16:15:12 +00:00
|
|
|
# include more tables
|
2023-12-29 10:07:51 +00:00
|
|
|
include "/srv/nftables/tables.conf"
|
2023-12-29 10:12:41 +00:00
|
|
|
{% endif %}
|