2020-06-11 14:44:46 +00:00
|
|
|
#!/usr/sbin/nft -f
|
|
|
|
|
|
|
|
flush ruleset
|
|
|
|
|
|
|
|
table inet filter {
|
|
|
|
chain input {
|
2023-10-12 08:25:11 +00:00
|
|
|
type filter hook input priority filter; policy accept;
|
2020-06-11 14:44:46 +00:00
|
|
|
|
|
|
|
# Accept any localhost and libvirt traffic.
|
|
|
|
iif "lo" accept
|
2020-06-18 07:33:36 +00:00
|
|
|
iifname "virbr0" accept
|
2020-06-11 14:44:46 +00:00
|
|
|
|
|
|
|
# Accept traffic originated from us.
|
|
|
|
ct state established,related accept
|
|
|
|
|
|
|
|
# Open ports for public services.
|
2023-10-12 08:25:11 +00:00
|
|
|
tcp dport 22 ct state new accept # SSH
|
2020-06-11 14:44:46 +00:00
|
|
|
|
2023-10-12 08:25:11 +00:00
|
|
|
# ICMPv6 packets which must not be dropped, see https://tools.ietf.org/html/rfc4890#section-4.4.1
|
|
|
|
icmpv6 type { destination-unreachable, packet-too-big, time-exceeded, parameter-problem, echo-request, echo-reply, nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert, 148, 149 } accept
|
|
|
|
ip6 saddr fe80::/10 icmpv6 type { mld-listener-query, mld-listener-report, mld-listener-done, mld2-listener-report, 151, 152, 153 } accept
|
2020-06-11 14:44:46 +00:00
|
|
|
|
|
|
|
# Count and drop any other traffic.
|
|
|
|
counter drop
|
|
|
|
}
|
|
|
|
|
|
|
|
chain forward {
|
2023-10-12 08:25:11 +00:00
|
|
|
type filter hook forward priority filter; policy accept;
|
2020-06-11 14:44:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
chain output {
|
2023-10-12 08:25:11 +00:00
|
|
|
type filter hook output priority filter; policy accept;
|
2020-06-11 14:44:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
table ip nat {
|
|
|
|
chain postrouting {
|
2023-10-12 08:25:11 +00:00
|
|
|
type nat hook postrouting priority srcnat; policy accept;
|
2020-06-11 14:44:46 +00:00
|
|
|
|
|
|
|
# Masquerade NAT traffic (useful for VMs).
|
|
|
|
masquerade
|
|
|
|
}
|
|
|
|
}
|