ajout du firewall et fail2ban
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
[DEFAULT]
|
||||
|
||||
backend = systemd
|
||||
banaction = nftables-multiport
|
||||
|
||||
# 92.154.111.181 - IP des bureaux de nereide
|
||||
# 86.244.5.54 - IP maison Antoine
|
||||
ignoreip = 127.0.0.1 92.154.111.181 86.244.5.54
|
||||
findtime = 1h
|
||||
bantime = 1d
|
||||
maxretry = 3
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
#!/usr/sbin/nftables -f
|
||||
|
||||
flush ruleset
|
||||
|
||||
# family `inet` c'est pour ipv4/ipv6
|
||||
table inet myfilter {
|
||||
chain myglobal {
|
||||
# par défaut on accepte tous les paquets entrant
|
||||
type filter hook input priority 0; policy accept;
|
||||
# accepte les ping (mais pas plus de 1 par seconde)
|
||||
ip protocol icmp icmp type { echo-request, echo-reply } limit rate 1/second accept
|
||||
ip protocol icmp icmp type { echo-request, echo-reply } drop
|
||||
ip6 nexthdr icmpv6 icmpv6 type { echo-request, echo-reply } limit rate 1/second accept
|
||||
ip6 nexthdr icmpv6 icmpv6 type { echo-request, echo-reply } drop
|
||||
# on accepte tout le reste du traffic icmp
|
||||
ip protocol icmp accept
|
||||
ip6 nexthdr icmpv6 accept
|
||||
# accepte le traffic qui vient de nous
|
||||
ct state established,related accept
|
||||
ct state invalid drop
|
||||
# accepte le traffic localhost
|
||||
iif lo accept
|
||||
# accepte tout le traffic ssh peut importe l'origine
|
||||
tcp dport 22 accept
|
||||
# abandonne le traffic depuis le réseau local
|
||||
ip saddr 10.0.0.0/8 drop
|
||||
ip6 saddr { fe80::/10, fc00::/7 } drop
|
||||
# accepte le traffic tcp depuis le reste du monde si la cible est un des ports http, https, smtp
|
||||
tcp dport {25, 80, 443} accept
|
||||
|
||||
# count and drop any other traffic
|
||||
counter drop
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
[Service]
|
||||
ExecStartPre=nft add table inet filter
|
||||
ExecStartPre=nft add chain inet filter input { type filter hook input priority 0; policy accept; }
|
||||
Reference in New Issue
Block a user