reorder nftables rules for remote access preservation
This commit is contained in:
parent
5e1c3d6ea1
commit
0b9a0382f8
2 changed files with 8 additions and 4 deletions
|
@ -205,17 +205,19 @@ systemctl start nftables
|
||||||
```shell
|
```shell
|
||||||
nft flush ruleset
|
nft flush ruleset
|
||||||
nft add table ip firewall
|
nft add table ip firewall
|
||||||
nft add chain ip firewall input { type filter hook input priority 0 \; policy drop \; }
|
nft add chain ip firewall input { type filter hook input priority 0 \; }
|
||||||
nft add rule ip firewall input iif lo accept
|
nft add rule ip firewall input iif lo accept
|
||||||
nft add rule ip firewall input iif != lo ip daddr 127.0.0.0/8 drop
|
nft add rule ip firewall input iif != lo ip daddr 127.0.0.0/8 drop
|
||||||
nft add rule ip firewall input tcp dport ssh accept
|
nft add rule ip firewall input tcp dport ssh accept
|
||||||
nft add rule ip firewall input ct state established,related accept
|
nft add rule ip firewall input ct state established,related accept
|
||||||
|
nft add chain ip firewall input { type filter hook input priority 0 \; policy drop \; }
|
||||||
nft add chain ip firewall forward { type filter hook forward priority 0 \; policy drop \; }
|
nft add chain ip firewall forward { type filter hook forward priority 0 \; policy drop \; }
|
||||||
nft add chain ip firewall output { type filter hook output priority 0 \; policy drop \; }
|
nft add chain ip firewall output { type filter hook output priority 0 \; }
|
||||||
nft add rule ip firewall output oif lo accept
|
nft add rule ip firewall output oif lo accept
|
||||||
nft add rule ip firewall output tcp dport { http, https } accept
|
nft add rule ip firewall output tcp dport { http, https } accept
|
||||||
nft add rule ip firewall output udp dport { domain, ntp } accept
|
nft add rule ip firewall output udp dport { domain, ntp } accept
|
||||||
nft add rule ip firewall output ct state established,related accept
|
nft add rule ip firewall output ct state established,related accept
|
||||||
|
nft add chain ip firewall output { type filter hook output priority 0 \; policy drop \; }
|
||||||
```
|
```
|
||||||
|
|
||||||
If network is IPv4-only, run:
|
If network is IPv4-only, run:
|
||||||
|
|
|
@ -302,17 +302,19 @@ systemctl start nftables
|
||||||
```shell
|
```shell
|
||||||
nft flush ruleset
|
nft flush ruleset
|
||||||
nft add table ip firewall
|
nft add table ip firewall
|
||||||
nft add chain ip firewall input { type filter hook input priority 0 \; policy drop \; }
|
nft add chain ip firewall input { type filter hook input priority 0 \; }
|
||||||
nft add rule ip firewall input iif lo accept
|
nft add rule ip firewall input iif lo accept
|
||||||
nft add rule ip firewall input iif != lo ip daddr 127.0.0.0/8 drop
|
nft add rule ip firewall input iif != lo ip daddr 127.0.0.0/8 drop
|
||||||
nft add rule ip firewall input tcp dport ssh accept
|
nft add rule ip firewall input tcp dport ssh accept
|
||||||
nft add rule ip firewall input ct state established,related accept
|
nft add rule ip firewall input ct state established,related accept
|
||||||
|
nft add chain ip firewall input { type filter hook input priority 0 \; policy drop \; }
|
||||||
nft add chain ip firewall forward { type filter hook forward priority 0 \; policy drop \; }
|
nft add chain ip firewall forward { type filter hook forward priority 0 \; policy drop \; }
|
||||||
nft add chain ip firewall output { type filter hook output priority 0 \; policy drop \; }
|
nft add chain ip firewall output { type filter hook output priority 0 \; }
|
||||||
nft add rule ip firewall output oif lo accept
|
nft add rule ip firewall output oif lo accept
|
||||||
nft add rule ip firewall output tcp dport { http, https } accept
|
nft add rule ip firewall output tcp dport { http, https } accept
|
||||||
nft add rule ip firewall output udp dport { domain, ntp } accept
|
nft add rule ip firewall output udp dport { domain, ntp } accept
|
||||||
nft add rule ip firewall output ct state established,related accept
|
nft add rule ip firewall output ct state established,related accept
|
||||||
|
nft add chain ip firewall output { type filter hook output priority 0 \; policy drop \; }
|
||||||
```
|
```
|
||||||
|
|
||||||
If network is IPv4-only, run:
|
If network is IPv4-only, run:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue