Created
May 25, 2016 02:16
-
-
Save meskarune/feda7588f763e7ef220be32b4b376145 to your computer and use it in GitHub Desktop.
nftables config for ipv4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/nft -f | |
# ipv4/ipv6 Simple & Safe Firewall | |
# you can find examples in /usr/share/nftables/ | |
flush ruleset | |
table firewall { | |
chain incoming { | |
type filter hook input priority 0; | |
# established/related connections | |
ct state established,related accept | |
# invalid connections | |
ct state invalid drop | |
# loopback interface | |
iifname lo accept | |
# icmp | |
ip protocol icmp limit rate 10/second accept | |
ip protocol icmp drop | |
# sshd (port 22) | |
tcp dport ssh limit rate 15/minute accept | |
# mosh | |
udp dport 60000-60100 limit rate 15/minute accept | |
# open webserver ports: http (80), https (443) | |
tcp dport {http, https} accept | |
# openvpn | |
udp dport 1194 limit rate 15/minute accept | |
#weechat relay | |
tcp dport 9009 accept | |
# Flask apps | |
tcp dport 5000 accept | |
# everything else | |
drop | |
} | |
} | |
# vim:set ts=2 sw=2 et: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment