Ci-dessous, les différences entre deux révisions de la page.
netadmin:nftables:exemples:nft_configuration_serveur_ftp [2024/07/12 16:29] – créée yoann | netadmin:nftables:exemples:nft_configuration_serveur_ftp [2024/07/13 09:15] (Version actuelle) – yoann | ||
---|---|---|---|
Ligne 6: | Ligne 6: | ||
Pour que le service FTP puisse correctement fonctionner derrière un pare-feu restrictif, il faut mettre en place un dispositif particulier de suivi du protocole (un **helper**). | Pour que le service FTP puisse correctement fonctionner derrière un pare-feu restrictif, il faut mettre en place un dispositif particulier de suivi du protocole (un **helper**). | ||
- | L' exemple de configuration ci-dessous utilise une politique **restrictive** pour les trafics entrants et sortants. On restreint l' | + | L' exemple de configuration ci-dessous utilise une politique **restrictive** pour les trafics entrants et sortants. On restreint l' |
<file conf nftables.conf> | <file conf nftables.conf> | ||
Ligne 15: | Ligne 15: | ||
table ip ipfilter { | table ip ipfilter { | ||
- | | + | |
ct helper ftp-standard { | ct helper ftp-standard { | ||
Ligne 23: | Ligne 23: | ||
- | set allowed_ftp_clients { | + | |
- | type ipv4_addr | + | type ipv4_addr |
- | comment " | + | comment " |
- | elements = { | + | elements = { |
- | 192.168.33.10, | + | |
- | 192.168.10.1, | + | |
- | 172.16.1.33 | + | 192.168.10.1, |
- | } | + | 172.16.1.33 |
- | } | + | } |
+ | } | ||
chain PRE { | chain PRE { | ||
Ligne 41: | Ligne 42: | ||
} | } | ||
- | | + | |
- | comment " | + | comment " |
- | type filter hook input priority filter; policy drop; | + | type filter hook input priority filter; policy drop; |
- | | + | |
- | ct state invalid counter drop | + | ct state invalid counter drop |
- | | + | |
- | ct state established, | + | ct state established, |
- | | + | |
- | iif " | + | iif " |
- | | + | |
- | iif " | + | iif " |
- | | + | |
- | iif " | + | iif " |
- | | + | |
iif " | iif " | ||
- | | + | |
- | icmp type echo-request limit rate 5/second log prefix "[FW] [ACCEPT] [RID=17] " level notice counter accept comment " | + | icmp type echo-request limit rate 5/second log prefix "[FW] [ACCEPT] [RID=17] " level notice counter accept comment " |
- | | + | |
- | log prefix "[FW] [REJECT] [RID=666] " counter packets 0 bytes 0 reject comment " | + | log prefix "[FW] [REJECT] [RID=666] " counter packets 0 bytes 0 reject comment " |
- | } | + | } |
| | ||
- | | + | |
- | comment " | + | comment " |
- | type filter hook output priority filter; policy drop; | + | type filter hook output priority filter; policy drop; |
- | | + | |
- | ct state established, | + | ct state established, |
- | | + | |
- | oif " | + | oif " |
- | | + | |
- | icmp type echo-request limit rate 5/second log prefix "[FW] [ACCCEPT] [RID=61] " level notice counter accept comment " | + | icmp type echo-request limit rate 5/second log prefix "[FW] [ACCCEPT] [RID=61] " level notice counter accept comment " |
- | | + | |
- | log prefix "[FW] [REJECT] [RID=667] " counter packets 0 bytes 0 reject comment " | + | log prefix "[FW] [REJECT] [RID=667] " counter packets 0 bytes 0 reject comment " |
- | } | + | } |
- | | + | |
- | type filter hook forward priority filter; policy drop; | + | type filter hook forward priority filter; policy drop; |
- | | + | |
- | ct state established, | + | ct state established, |
- | | + | |
- | log prefix "[FW] [REJECT] [RID=668] " counter reject comment " | + | log prefix "[FW] [REJECT] [RID=668] " counter reject comment " |
- | } | + | } |
} | } | ||
</ | </ | ||