Snakeeater
Lt. Commander
- Registriert
- Aug. 2004
- Beiträge
- 1.815
Interessanter Thread, ich stehe aufgrund von Arbeit und auch generellem Interesse davor mich in nftables einarbeiten zu müssen. Dabei bin ich kaum in der iptables Syntax vertraut.
Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
#!/usr/bin/nft -f
# https://www.procustodibus.com/blog/2021/11/wireguard-nftables/
table inet filter {
chain input {
type filter hook input priority 0; policy drop
# allow established/related connections
ct state {established, related} accept
# early drop of invalid connections
ct state invalid drop
# allow from loopback
iifname lo accept
# allow from wg0
iifname wg0 accept
# allow icmp
ip protocol icmp accept
ip6 nexthdr icmpv6 accept
# allow ssh
#tcp dport ssh accept
tcp dport 222 accept
# allow Wireguard
udp dport 55555 accept
# everything else
reject with icmp type port-unreachable
}
chain forward {
type filter hook forward priority 0; policy drop
# Wireguard unrestricted Access
iifname wg0 accept
oifname wg0 accept
reject with icmpx type host-unreachable
}
chain output {
type filter hook output priority 0; policy accept
}
}
table ip nat {
chain postrouting {
# SNAT Proxy for certain devices
type nat hook postrouting priority 100; policy accept;
ip saddr 192.168.2.128 oif eth0 masquerade
ip saddr 192.168.2.131 oif eth0 masquerade
}
}
# vim:set ts=2 sw=2 et:
[DEFAULT]
ignoreip = 127.0.0.1/8 192.168.0.0/16
banaction = nftables-multiport
banaction_allports = nftables-allports
chain = input
[recidive]
banaction = nftables-allports
[sshd]
enabled = true
backend = systemd
port = 222
#port = ssh
filter = sshd
#logpath = /var/log/auth.log
maxretry = 3
bantime = 2h