durcit le serveur : pare-feu nftables, SSH par clé, fail2ban, chrony, mises à jour de sécurité
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
b7e866f868
commit
f5a5e8d8a9
13 changed files with 377 additions and 0 deletions
29
ansible/roles/durcissement/templates/nftables.conf.j2
Normal file
29
ansible/roles/durcissement/templates/nftables.conf.j2
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/sbin/nft -f
|
||||
# Géré par Ansible (rôle durcissement) — ne pas modifier à la main.
|
||||
# Politique : tout est refusé en entrée sauf loopback, trafic déjà établi,
|
||||
# ICMP, et les ports {{ durcissement_ports_ouverts | join(', ') }}.
|
||||
|
||||
flush ruleset
|
||||
|
||||
table inet filter {
|
||||
chain input {
|
||||
type filter hook input priority 0; policy drop;
|
||||
|
||||
iif lo accept
|
||||
ct state established,related accept
|
||||
ct state invalid drop
|
||||
|
||||
ip protocol icmp accept
|
||||
meta l4proto ipv6-icmp accept
|
||||
|
||||
tcp dport { {{ durcissement_ports_ouverts | join(', ') }} } accept
|
||||
}
|
||||
|
||||
chain forward {
|
||||
type filter hook forward priority 0; policy drop;
|
||||
}
|
||||
|
||||
chain output {
|
||||
type filter hook output priority 0; policy accept;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue