-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
henglinli
committed
May 22, 2018
1 parent
701aa2a
commit e1253db
Showing
4 changed files
with
43 additions
and
51,807 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/sbin/nft -f | ||
flush ruleset | ||
# inet filter | ||
table inet filter { | ||
chain output { | ||
type filter hook output priority 0; policy accept; | ||
counter comment "count accepted packets" | ||
} | ||
chain forward { | ||
type filter hook forward priority 0; policy drop; | ||
counter comment "count dropped packets" | ||
} | ||
chain input { | ||
type filter hook input priority 0; policy drop; | ||
ct state invalid counter drop comment "drop invalid packets" | ||
ct state {established, related} counter accept comment "accept all connections related to connections made by self" | ||
iifname lo accept comment "accept loopback" | ||
iifname != lo ip daddr 127.0.0.1/8 counter drop comment "drop connections to loopback nto comming from loopback" | ||
iifname != lo ip6 daddr ::1/128 counter drop comment "drop connections to loopback not comming from loopback" | ||
ip protocol icmp counter accept comment "accept all icmp types" | ||
ip6 nexthdr icmpv6 counter accept comment "accept all icmpv6 types" | ||
tcp dport 22 counter accept comment "accept ssh(port 22)" | ||
counter comment "count accepted packets" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=nft | ||
Documentation=man:ntf(8) | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/usr/sbin/nft -f /etc/firewall/%I.nft | ||
ExecStop=/usr/sbin/nft flush ruleset | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
DefaultInstance=filter |
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
Oops, something went wrong.