[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [linux] q iptables/firewall (icmp,cisco)
Voici un extrait de ce que j'utilise personellement :
Il y a deux manieres d'autoriser/dropper (en specifiant ou non
chaque ICMP type, il suffit de mettre/retirer les # ;)
Je cree également des regles specifiques pour le logging,
vu que l'option -l n'existe plus..
Note sur le logging ICMP : précisons que garder un log des packets
rejettés par le firewall peut très bien engendrer un autre
probleme : /var/log full ! ;p
Celui qui te ping flood va donc non seulement malgré tout manger
toute ta bande passante jusqu'à ton firewall, mais peut aussi
très bien remplir ton disque ;p
Chacun son truc ;)
Bonne journée
Vincent
--
Vincent Luyckx - System Administrator - vincent@ops.skynet.be
IT & Network dept. / Operations Unit
Belgacom Skynet s.a.
Rue Colonel Bourg 124 - 1140 Brussels
# Setup DROP_LOG rule, as -l option does not more exist
#
iptables -N DROP_LOG
iptables -A DROP_LOG --proto tcp -j LOG --log-level info --log-prefix "FW_TCP_drop: "
iptables -A DROP_LOG --proto udp -j LOG --log-level info --log-prefix "FW_UDP_drop: "
iptables -A DROP_LOG --proto icmp -j LOG --log-level info --log-prefix "FW_ICMP_drop: "
iptables -A DROP_LOG --proto gre -j LOG --log-level info --log-prefix "FW_GRE_drop: "
iptables -A DROP_LOG -f -j LOG --log-level emerg --log-prefix "FW_FRAG_drop: "
iptables -A DROP_LOG -j DROP
# Setup ACCEPT_LOG rule
#
iptables -N ACCEPT_LOG
iptables -A ACCEPT_LOG -j LOG --log-level info --log-prefix "FW_OK: "
iptables -A ACCEPT_LOG -j ACCEPT
#
# ICMP RULES
#
# Allow outgoing ICMP
#
iptables -A OUTPUT -o eth0 -p icmp -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
#
# create a rule for ICMP
iptables -N ICMP
# send incoming icmp to ICMP rule
iptables -A INPUT --proto icmp -j ICMP
iptables -A ICMP -i eth0 -p icmp -m state --state ESTABLISHED,RELATED -j ACCEPT
#
# deny ping
iptables -A ICMP -p icmp --icmp-type ping -j DROP_LOG
iptables -A ICMP -p icmp --icmp-type pong -j DROP_LOG
# allow some ICMP types
iptables -A ICMP -p icmp --icmp-type destination-unreachable -j ACCEPT
iptables -A ICMP -p icmp --icmp-type source-quench -j ACCEPT_LOG
iptables -A ICMP -p icmp --icmp-type time-exceeded -j ACCEPT_LOG
iptables -A ICMP -p icmp --icmp-type parameter-problem -j ACCEPT_LOG
#
# another way to do it is to specify all icmp types..
#
#iptables -A ICMP -p icmp --icmp-type destination-unreachable -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type network-unreachable -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type host-unreachable -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type protocol-unreachable -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type port-unreachable -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type fragmentation-needed -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type source-route-failed -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type network-unknown -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type host-unknown -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type network-prohibited -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type host-prohibited -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type TOS-network-unreachable -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type TOS-host-unreachable -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type communication-prohibited -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type host-precedence-violation -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type precedence-cutoff -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type source-quench -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type redirect -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type network-redirect -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type host-redirect -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type TOS-network-redirect -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type TOS-host-redirect -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type router-advertisement -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type router-solicitation -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type time-exceeded -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type ttl-zero-during-transit -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type ttl-zero-during-reassembly -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type parameter-problem -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type ip-header-bad -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type required-option-missing -j ACCEPT_LOG
#iptables -A ICMP -p icmp --icmp-type timestamp-request -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type timestamp-reply -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type address-mask-request -j DROP_LOG
#iptables -A ICMP -p icmp --icmp-type address-mask-reply -j DROP_LOG
#
# default rule for ICMP is DROP
#
iptables -A ICMP -i eth0 -p icmp -j DROP_LOG
On Sun, 7 Oct 2001, Jean-Francois Dive wrote:
> Date: Sun, 7 Oct 2001 09:44:59 +1000
> From: Jean-Francois Dive <jef@linuxbe.org>
> To: linux@lists.unixtech.be
> Subject: Re: [linux] q iptables/firewall (icmp,cisco)
>
> Hello Pascal,
>
> Eh bien, le mieux est de les laisser passer. Laurent nous dis d'eviter un
> ping of death en faisant du rate limiting, mais si kkun te target, meme si
> tu drop les packets au niveau du firewall, ta ligne sera quand meme bouchee,
> zooo. Il faut laisser passer les ICMP generaux, par exemple, les stacks de
> windows utilisent un machin qui s'appelle Path MTU discovery: le stack
> envoie des segments TCP les plus gros possible (en fait le MTU local
> dabord), set le non fragment bit de IP et le diminuent la taille si ils
> recoive en retour un ICMP "devait fragmenter mais pouvais pas".. C'est un
> exemple. Parreil pour traceroute, etc.. donc, laisser les ICMP en general
> est une approche correcte a mon avis..
>
> JeF
> ----- Original Message -----
> From: "Pascal Bleser" <pascal.bleser@atosorigin.com>
> To: "lxbe/linux" <linux@lists.unixtech.be>
> Sent: Friday, October 05, 2001 7:38 PM
> Subject: [linux] q iptables/firewall (icmp,cisco)
>
>
> > Hep ;-)
> >
> > J'aurais qqes questions sur le firewalling (j'utilise
> > iptables sur une box Linux 2.4.x):
> >
> > - quels ICMP je dois autoriser (internet -> LAN/DMZ)
> > pour un bon fonctionnement ?
> >
> > - ça sert à qqe chose de dropper certains ICMP
> > LAN -> internet ? si oui, lesquels je dois accepter ?
> >
> > - il y a un petit routeur CISCO devant le firewall
> > (cf. topologie): est-ce que je dois autoriser certains
> > ICMP du CISCO -> firewall qu'il utilise pour le
> > routage (pour voir si le firewall est encore là, ou
> > qqe chose du genre) ?
> >
> > Topologie:
> > ----------
> > ISP
> > |
> > +------+
> > |CISCO |
> > +------+
> > |
> > +--------+ +---+
> > |firewall|------|DMZ|
> > +--------+ +---+
> > |
> > LAN
> >
> > - le routeur CISCO et le firewall vont du SNAT
> > - le firewall a un Squid et fait le DNS (BIND 8.2.3)
> > - c'est une connexion dialup (pour l'instant)
> >
> > merci pour toute info ;-)
> >
> > --
> > -o) / Pascal Bleser ATOS Origin|
> > /\\ \ e-Business Platform Aachen, Germany|
> > _\_v \<guru@linuxbe.org> <pbleser@atosorigin.com>|
> > ---------------------------------------------------|
> > rm -rf /bin/laden || cat usa >/dev/null :
> > ---------------------------------------------------'
> >
> > [ Soyez précis dans vos sujets svp afin de déterminer directement ]
> > [ le type de demande... ]
> > [ Pour vous (dés)inscrire, aller sur http://unixtech.be/ml.php ]
> > [ Archives de la mailing list: http://archives.unixtech.be/linux/ ]
> > [ http://unixtech.be Contact: listmaster@unixtech.be ]
> >
>
>
> [ Soyez précis dans vos sujets svp afin de déterminer directement ]
> [ le type de demande... ]
> [ Pour vous (dés)inscrire, aller sur http://unixtech.be/ml.php ]
> [ Archives de la mailing list: http://archives.unixtech.be/linux/ ]
> [ http://unixtech.be Contact: listmaster@unixtech.be ]
>
[ Soyez précis dans vos sujets svp afin de déterminer directement ]
[ le type de demande... ]
[ Pour vous (dés)inscrire, aller sur http://unixtech.be/ml.php ]
[ Archives de la mailing list: http://archives.unixtech.be/linux/ ]
[ http://unixtech.be Contact: listmaster@unixtech.be ]