2 ################################################
3 ### Managed by someone's ansible provisioner ###
4 ################################################
5 # Part of: https://git.somenet.org/root/pub/somesible.git
6 # 2017-2025 by someone <someone@somenet.org>
12 # ct helper ftp-standard { type "ftp" protocol tcp; }
15 # type filter hook prerouting priority raw; policy accept;
17 # # accept any inside traffic.
18 # iifname "lo" counter accept
20 # # accept all other traffic, by policy.
24 type filter hook prerouting priority -150; policy accept;
26 # accept any inside traffic.
27 iifname "lo" counter accept
29 # incoming, public facing traffic.
30 counter jump PRE_outside
32 # accept any other traffic - should not happen.
33 counter log prefix "NFT:PRE:ACCEPT-unk; " accept
37 # mark outside-initiated incoming connections.
38 ct state new meta mark set 2 ct mark set meta mark
40 # accept neighbour discovery otherwise IPv6 connectivity breaks.
41 ip6 nexthdr icmpv6 icmpv6 type { nd-neighbor-advert, nd-neighbor-solicit, nd-router-advert} counter accept
42 ip6 nexthdr udp udp dport 546 counter accept
43 ip protocol icmp icmp type { echo-request} counter accept
45 # accept connections to these services.
46 tcp dport 2 counter accept
48 # switch to something better than ftp, ssh/sftp for example, but if you must, use the ftp conntrack helper.
49 # tcp dport 21 ct state new ct helper set "ftp-standard" counter accept
51 # accept traffic originated from us.
52 ct state established,related counter accept
54 # accept any other traffic.
56 # counter log prefix "NFT:PRE_outside:ACCEPT-all; " accept
60 # type filter hook input priority 0; policy accept;
64 # type filter hook forward priority 0; policy accept;
68 # type filter hook output priority 0; policy accept;
73 type filter hook postrouting priority 150; policy accept;
75 # accept any inside traffic.
76 oifname "lo" counter accept
78 # outgoing, public facing traffic.
79 counter jump POST_outside
81 # accept any other traffic - should not happen.
82 counter log prefix "NFT:POST:ACCEPT-unk; " accept
86 # mark inside-initiated outgoing traffic.
87 ct mark 0 meta mark set 1 ct mark set meta mark
91 # counter log prefix "NFT:POST_outside:ACCEPT-all; " accept
98 # type nat hook prerouting priority dstnat; policy accept;
99 # meta l4proto tcp ip daddr 127.0.0.1 tcp dport 80 counter redirect to :1080
100 # meta l4proto tcp ip daddr 127.0.0.1 tcp dport 443 counter redirect to :10443
103 # type nat hook postrouting priority 100; policy accept;
104 # oifname "eth0" counter masquerade fully-random,persistent