URL: https://linuxfr.org/users/tay/journaux/firewall-sur-mandrake-92 Title: Firewall sur Mandrake 9.2 Authors: Tay Date: 2004年02月11日T19:52:02+01:00 Tags: Score: 0 Bonjour les amis! J'ai un petit soucis avec ma Mandrake 9.2 fraichement installée: le pare feu. Etape 1 une installation avec les options par défaut: niveau de sécurité standard. Petit tour dans les menus de configuration et là surprise: DrakFirewall est désactivé ( services accessible depuis internet: tous pas de firewall). Niveau sécurité c'est pas top. J'active le pare feux et là ça marche tellement bien que je n'ai pas accès à internet! Je fouille dans les fichier shorewall et sur internet chou blanc je ne trouve rien de concluant. Etape 2: qu'à cela ne tienne en fouinant sur Léa et un forum je trouve un script de firewall basé sur iptables. Après quelques bidouilles j'arrive à ça: #!/bin/sh #Change the part after the = to the where you IPTABLES is on your system IPTABLES=/sbin/iptables #flush existing rules $IPTABLES -F INPUT #This allows all data that has been sent out for the computer running the firewall # to come back #(for all of ICMP/TCP/UDP). #For example, if a ping request is made it will allow the reply back $IPTABLES -A INPUT -j ACCEPT -m state --state ESTABLISHED -i eth0 -p icmp $IPTABLES -A INPUT -j ACCEPT -m state --state ESTABLISHED -i eth0 -p tcp $IPTABLES -A INPUT -j ACCEPT -m state --state ESTABLISHED -i eth0 -p udp #Allow traffic from ethernet adapter eth1 to pass through if #you have a network, or #as using linux as a router for internet etc. #Your first ethernet card is eth0 and the second would be eth1 etc. #$IPTABLES -A INPUT -i eth1 -j ACCEPT #Allow incoming FTP requests $IPTABLES -A INPUT -p tcp --dport 20 -j ACCEPT $IPTABLES -A INPUT -p tcp --dport 21 -j ACCEPT #Allow incoming SSH requests $IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT #Allow incoming Mail SMPT requests $IPTABLES -A INPUT -p tcp --dport 25 -j ACCEPT #Allow incoming HTTP requests (to Web server) $IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT #Allow incoming Domain requests (to Web server) $IPTABLES -A INPUT -p udp -s 213.36.80.1 --sport 53 -d 0/0 -j ACCEPT #Allow Ping echo #I have commented this line, so ping from an outside machine will not work. #Uncomment the next line to make ping from outside work. #$IPTABLES -A INPUT -p icmp -j ACCEPT #Drop and log all other data #The logging is set so if more than 5 packets are dropped in #three seconds they will be ignored. This helps to prevent a DOS attack #Crashing the computer the firewall is running on $IPTABLES -A INPUT -m limit --limit 3/second --limit-burst 5 -i ! lo -j LOG $IPTABLES -A INPUT -i ! lo -j DROP #The logs from the firewall are put into your system log file, which can be found at #/var/log/syslog Maintenant mes questions: - Quelqu'un a t il une meilleur solution (faire marcher DrakFirewall par exemple...)? - A par ça le script ci dessus fonctionne t il (en tout cas j'ai accès à internet)? # iptables --list donne ça avec le script: Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination Sans le script j'avais en gros la même chose mais avec une dizaine de ligne... En tout cas merci à tous par avance pour votre aide! Tay