siotp/sisr1/Tp06-Firewall/fw_part4.nft
2025-05-05 09:07:35 +02:00

70 lines
1.8 KiB
Plaintext

define netif = enp0s3
define lanif = enp0s8
define dmzif = enp0s9
define netip = 192.168.0.120
define lanip = 172.16.0.254
define dmzip = 172.17.0.254
define lan-ntw = 172.16.0.1-172.16.0.254
define dmz-ntw = 172.17.0.1-172.17.0.254
table ip ipfilter{
chain prerouting {
type filter hook prerouting priority filter; policy drop;
tcp dport 22 accept
icmp type echo-request iif $lanif accept
icmp type echo-reply iif {$lanif, $dmzif} accept
ct state established,related accept
}
chain system_in {
type filter hook input priority filter; policy drop;
tcp dport 22 accept
icmp type echo-request iif $lanif accept
icmp type echo-reply accept
ct state established,related accept
}
chain routing {
type filter hook forward priority filter; policy drop;
icmp type echo-request iif $lanif oif $dmzif accept
icmp type echo-reply iif $dmzif oif $lanif accept
}
chain system_out {
type filter hook output priority filter; policy drop;
ct state established,related accept
# SSH
tcp sport 22 accept
icmp type echo-request accept
icmp type echo-reply oif $lanif accept
#Proxy lycée
tcp dport 8080 accept
# Requêtes DNS sortantes (UDP et TCP)
udp dport 53 accept
tcp dport 53 accept
# Requêtes HTTP/HTTPS/FTP sortantes
tcp dport {80, 443, 20, 21} accept
}
chain postrouting {
type filter hook postrouting priority filter; policy drop;
ct state established,related accept
# SSH
tcp sport 22 accept
tcp dport 8080 accept
icmp type echo-request oif {$lanif, $dmzif} accept
icmp type echo-reply oif $lanif accept
# Requêtes DNS sortantes (UDP et TCP)
udp dport 53 accept
tcp dport 53 accept
# Requêtes HTTP/HTTPS/FTP sortantes
tcp dport {80, 443, 20, 21} accept
}
}