49 lines
1.3 KiB
Text
Executable file
49 lines
1.3 KiB
Text
Executable file
#!/usr/sbin/nft -f
|
|
|
|
flush ruleset
|
|
|
|
# Forward Syncthing relay traffic from port {{ ports['syncthing_relaysrv'] }} to 22067
|
|
table inet nat {
|
|
chain prerouting {
|
|
type nat hook prerouting priority dstnat;
|
|
iif eth0 tcp dport {{ ports['syncthing_relaysrv'] }} redirect to :22067
|
|
}
|
|
}
|
|
|
|
table inet filter {
|
|
chain input {
|
|
type filter hook input priority 0; policy drop;
|
|
|
|
iif lo accept
|
|
|
|
ct state invalid drop
|
|
ct state { established, related } accept
|
|
|
|
# Allow ICMP
|
|
meta l4proto icmp limit rate 1/second accept
|
|
meta l4proto ipv6-icmp limit rate 1/second accept
|
|
|
|
# HTTP/S
|
|
tcp dport { http, https } limit rate 5/second accept
|
|
|
|
# SSH
|
|
tcp dport 995 limit rate 15/minute accept
|
|
|
|
# Syncthing
|
|
tcp dport { {{ ports['syncthing_tcp'] }}, 22067 } limit rate 5/second accept
|
|
udp dport {{ ports['syncthing_udp'] }} limit rate 5/second accept
|
|
|
|
# Coturn
|
|
tcp dport { {{ ports['coturn_listening'] }}, {{ ports['coturn_tls_listening'] }} } limit rate 5/second accept
|
|
udp dport { {{ ports['coturn_listening'] }}, {{ ports['coturn_tls_listening'] }}, {{ ports['coturn_relay_min'] }}-{{ ports['coturn_relay_max'] }} } limit rate 5/second accept
|
|
|
|
}
|
|
|
|
chain forward {
|
|
type filter hook forward priority 0; policy accept;
|
|
}
|
|
|
|
chain output {
|
|
type filter hook output priority 0; policy accept;
|
|
}
|
|
}
|