2020-06-11 14:44:46 +00:00
|
|
|
#!/usr/sbin/nft -f
|
|
|
|
|
|
|
|
flush ruleset
|
|
|
|
|
|
|
|
table inet filter {
|
|
|
|
chain input {
|
|
|
|
type filter hook input priority 0; policy accept;
|
|
|
|
|
|
|
|
# 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.
|
2020-08-06 12:07:38 +00:00
|
|
|
tcp dport 22 ct state new accept # SSH
|
|
|
|
tcp dport 5353 ct state new accept # Bonjour
|
|
|
|
udp dport 5353 ct state new accept # Bonjour
|
|
|
|
tcp dport 8000 ct state new accept # Python HTTP server.
|
2020-06-11 14:44:46 +00:00
|
|
|
|
|
|
|
# Accept neighbour discovery otherwise IPv6 connectivity breaks.
|
|
|
|
ip6 nexthdr icmpv6 icmpv6 type { nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert } accept
|
|
|
|
|
|
|
|
# Count and drop any other traffic.
|
|
|
|
counter drop
|
|
|
|
}
|
|
|
|
|
|
|
|
chain forward {
|
|
|
|
type filter hook forward priority 0; policy accept;
|
|
|
|
}
|
|
|
|
|
|
|
|
chain output {
|
|
|
|
type filter hook output priority 0; policy accept;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
table ip nat {
|
|
|
|
chain postrouting {
|
|
|
|
type nat hook postrouting priority 100;
|
|
|
|
|
|
|
|
# Masquerade NAT traffic (useful for VMs).
|
|
|
|
masquerade
|
|
|
|
}
|
|
|
|
}
|