Created
January 15, 2023 02:40
-
-
Save mxyq/dc703799e6f298b68b95e15ea8ae924f to your computer and use it in GitHub Desktop.
[Linux Firewall Configuration]
This file contains hidden or 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/sbin/nft -f | |
flush ruleset | |
table inet filter { | |
chain ports { | |
tcp dport 33333 counter accept | |
} | |
chain input { | |
type filter hook input priority filter; policy drop; | |
ct state established,related counter accept | |
ct state invalid counter drop | |
iif != lo ip6 daddr ::1/128 counter drop comment "drop connections to loopback not coming from loopback" | |
# ip protocol icmp accept | |
icmpv6 type { echo-request,nd-neighbor-solicit,nd-neighbor-advert,nd-router-solicit,nd-router-advert,mld-listener-query,destination-unreachable,packet-too-big,time-exceeded,parameter-problem } accept | |
iifname lo counter accept | |
ip protocol tcp jump ips | |
ip protocol tcp jump ports | |
} | |
chain ips { | |
} | |
chain forward { | |
type filter hook forward priority 0; policy drop; | |
counter drop comment "Drop forwarded packets since this isn't a router" | |
} | |
chain output { | |
type filter hook output priority 0; policy accept; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment