All pastes #287537 Raw Edit

Quelqu'un

public text v1 · immutable
#287537 ·published 2006-12-21 15:38 UTC
rendered paste body
#!/bin/bash
WHITELIST=/usr/local/etc/liste_blanche.txt
BLACKLIST=/usr/local/etc/liste_noire.txt
ALLOWED="80"

iptables -F

for x in `grep -v ^# $WHITELIST |awk '{print $1}'` ; do
echo "autorisation à $x..."
iptables -A INPUT -t filter -s $x -j ACCEPT
done

for x in `grep -v ^# $BLACKLIST |awk '{print $1}'`; do
echo "blocage de $x...."
iptables -A INPUT -t filter -s $x -j DROP
done

for port in $ALLOWED; do
echo "acceptation du port $port..."
iptables -A INPUT -t filter -p tcp --dport $port -j ACCEPT
done

iptables -A INPUT -t filter -p tcp --syn -j DROP
/etc/init.d/firewall.sh (END)