Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 122377
Collapse All | Expand All

(-)FW_old.xml (-566 / +646 lines)
Lines 1-70 Link Here
1
<?xml version='1.0' encoding="UTF-8"?>
1
<?xml version='1.0' encoding="UTF-8"?>
2
<!-- $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo/xml/htdocs/doc/en/articles/linux-24-stateful-fw-design.xml,v 1.5 2005/10/09 17:13:23 rane Exp $ -->
2
<!-- $Header:
3
/var/www/viewcvs.gentoo.org/raw_cvs/gentoo/xml/htdocs/doc/en/articles/linux-24-
4
stateful-fw-design.xml,v 1.5 2005/10/09 17:13:23 rane Exp $ -->
3
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4
6
5
<guide link="/doc/en/articles/linux-24-stateful-fw-design.xml" disclaimer="articles">
7
<guide link="/doc/en/articles/linux-24-stateful-fw-design.xml"
6
<title>Linux 2.4 stateful firewall design</title>
8
disclaimer="articles">
9
<title>Firewall stateful sous Linux 2.4</title>
7
10
8
<author title="Author">
11
<author title="Auteur">
9
  <mail link="drobbins@gentoo.org">Daniel Robbins</mail>
12
  <mail link="drobbins@gentoo.org">Daniel Robbins</mail>
10
</author>
13
</author>
11
14
12
<abstract>
15
<abstract>
13
This tutorial shows you how to use netfilter to set up a powerful Linux stateful
16
Ce guide va vous apprendre à batir un puissant firewall stateful en utilisant
14
firewall.
17
NetFilter sous Linux.
15
</abstract>
18
</abstract>
16
19
17
<!-- The original version of this article was published on IBM developerWorks,
20
<!-- La version originale de ce document a été rendu publique sur IBM
18
and is property of Westtech Information Services. This document is an updated
21
developerWorks, et est la propriété de Westtech Information Services. Ce
19
version of the original article, and contains various improvements made by the
22
document est une version mise à jour de l'original, et contient plusieurs
20
Gentoo Linux Documentation team -->
23
améliorations apportées par l'équipe de Documentation de Gentoo Linux -->
21
24
22
<version>1.3</version>
25
<version>1.3</version>
23
<date>2005-10-09</date>
26
<date>2005-10-09</date>
24
27
25
<chapter>
28
<chapter>
26
<title>About this tutorial</title>
29
<title>A propos de ce guide</title>
27
<section>
30
<section>
28
<title>Should I take this tutorial?</title>
31
<title>A qui s'adresse ce guide ?</title>
29
<body>
32
<body>
30
33
31
<p>
34
<p>
32
This tutorial shows you how to use netfilter to set up a powerful Linux stateful
35
Ce guide vous montre comment utiliser NetFilter pour configurer un puissant
33
firewall. All you need is an existing Linux system that's currently using a
36
firewall stateful. Tout ce dont vous aurez besoin est d'un système Linux
34
Linux 2.4 kernel. A laptop, workstation, router or server with a Linux 2.4
37
existant utilisant une version 2.4 ou supérieure du noyau Linux. Un portable, PC
35
kernel will do.
38
de bureau, routeur ou serveur avec un Linux 2.4 ou plus fera l'affaire.
36
</p>
39
</p>
37
40
38
<p>
41
<p>
39
You should be reasonably familiar with standard network terminology like IP
42
Vous devez être assez familier avec le vocabulaire réseau, comme les adresses
40
addresses, source and destination port numbers, TCP, UDP and ICMP, etc. By the
43
IP, les ports source et destination, TCP, UDP ou ICMP, etc. Après avoir suivi
41
end of the tutorial, you'll understand how Linux stateful firewalls are put
44
ce guide jusqu'au bout, vous aurez compris le fonctionnement d'un firewall
42
together and you'll have several example configurations to use in your own
45
stateful sous Linux. De nombreux exemples de configurations vous seront
43
projects.
46
également exposés.
44
</p>
47
</p>
45
48
46
</body>
49
</body>
47
</section>
50
</section>
48
<section>
51
<section>
49
<title>About the author</title>
52
<title>A propos de l'auteur</title>
50
<body>
53
<body>
51
54
52
<p>
55
<p>
53
For technical questions about the content of this tutorial, contact the author,
56
Pour toute question technique sur le contenu de ce guide, contactez l'auteur,
54
Daniel Robbins, at <mail link="drobbins@gentoo.org">drobbins@gentoo.org</mail>.
57
Daniel Robbins, à l'adresse suivante: <mail link="drobbins@gentoo.org">
58
drobbins@gentoo.org</mail>.
55
</p>
59
</p>
56
60
57
<p>
61
<p>
58
Residing in Albuquerque, New Mexico, Daniel Robbins was the President/CEO of
62
Résidant à Albuquerque, dans le Nouveau Mexique, Daniel Robbins a été le PDG de
59
Gentoo Technologies, Inc., the creator of Gentoo Linux, an advanced Linux for
63
Gentoo Technologies, Inc., le créateur de Gentoo Linux, un système
60
the PC, and the Portage system, a next-generation ports system for Linux. He has
64
d'exploitation Linux moderne pour PC, et du système Portage, un gestionnaire de
61
also served as a contributing author for the Macmillan books Caldera OpenLinux
65
ports nouvelle génération pour Linux. Il a également été un des auteurs
62
Unleashed, SuSE Linux Unleashed, and Samba Unleashed. Daniel has been involved
66
contributeurs pour les livres Caldera OpenLinux Unleashed, SuSE Linux Unleashed,
63
with computers in some fashion since the second grade, when he was first exposed
67
et Samba Unleashed, parus aux éditions Macmillan. Daniel a été au contact de
64
to the Logo programming language as well as a potentially dangerous dose of Pac
68
l'informatique depuis l'école élémentaire, quand il fut confronté au langage de
65
Man. This probably explains why he has since served as a Lead Graphic Artist at
69
programmation Logo, ainsi qu'à une dose potentiellement dangereuse de Pac Man.
66
SONY Electronic Publishing/Psygnosis. Daniel enjoys spending time with his wife,
70
Celà explique sans doute pourquoi il a depuis été employé en tant que Chef
67
Mary, and his new baby daughter, Hadassah.
71
Infographiste chez SONY Electronic Publishing/Psygnosis. Daniel aime passer son
72
temps libre avec sa femme, Mary, et sa fille, Hadassah.
68
</p>
73
</p>
69
74
70
</body>
75
</body>
Lines 72-129 Link Here
72
</chapter>
77
</chapter>
73
78
74
<chapter>
79
<chapter>
75
<title>First steps</title>
80
<title>Premières étapes</title>
76
<section>
81
<section>
77
<title>Defining our goal</title>
82
<title>Le but du jeu</title>
78
<body>
83
<body>
79
84
80
<p>
85
<p>
81
In this tutorial, we're going to put together a Linux stateful firewall. Our
86
Dans ce guide, nous allons bâtir un firewall stateful Linux. Notre firewall va
82
firewall is going to run on a Linux laptop, workstation, server, or router; its
87
s'exécuter sur un ordinateur portable, de bureau, serveur ou routeur sous Linux;
83
primary goal is to allow only certain types of network traffic to pass through.
88
son but principal est d'autoriser seulement certains types de traffic réseau à
84
To increase security, we're going to configure the firewall to drop or reject
89
le traverser. Pour augmenter la sécurité, nous allons configurer le firewall
85
traffic that we're not interested in, as well as traffic that could pose a
90
pour ignorer ou rejeter le traffic qui ne nous interesse pas, ainsi que le
86
security threat.
91
traffic potentiellement dangereux pour la sécurité.
87
</p>
92
</p>
88
93
89
</body>
94
</body>
90
</section>
95
</section>
91
<section>
96
<section>
92
<title>Getting the tools</title>
97
<title>Les outils nécessaires</title>
93
<body>
98
<body>
94
99
95
<p>
100
<p>
96
Before we start designing a firewall, we need to do two things. First, we need
101
Avant de commencer à bâtir le firewall, il faut faire deux choses. Tout d'abord,
97
to make sure that the <c>iptables</c> command is available. As root, type
102
il faut s'assurer que la commande <c>iptables</c> est disponible sur la machine.
98
<c>iptables</c> and see if it exists. If it doesn't, then we'll need to get it
103
Pour celà, en tant que super-utilisateur, tapez <c>iptables</c> et vérifiez ce
99
installed first. Here's how we do that:
104
que vous répond le shell. Si la commande n'existe pas, alors il nous faut
105
l'installer. Voilà comment faire :
100
</p>
106
</p>
101
107
102
<pre caption="Installing necessary tools">
108
<pre caption="Installation de iptables">
103
# <i>emerge iptables</i>
109
# <i>emerge iptables</i>
104
</pre>
110
</pre>
105
111
106
</body>
112
</body>
107
</section>
113
</section>
108
<section>
114
<section>
109
<title>Kernel configuration</title>
115
<title>Configuration du noyau</title>
110
<body>
116
<body>
111
117
112
<p>
118
<p>
113
Once installed, you should have an <c>iptables</c> command available for use, as
119
Une fois installée, vous devez avoir une commande <c>iptables</c> disponible,
114
well as the handy iptables man page (<c>man iptables</c>). Great; now all we
120
ainsi que la page de manuel qui lui correspond (<c>man iptables</c>). Bien;
115
need is to make sure that we have the necessary functionality built into the
121
maintenant il faut nous assurer que les fonctionnalités nécessaires sont bien
116
kernel. This tutorial assumes that you compile your own kernels. Head over to
122
activées dans le noyau. Ce guide suppose que vous compilez vos propres noyaux.
117
<path>/usr/src/linux</path>, and type <c>make menuconfig</c> or <c>make
123
Dans le répertoire <path>/usr/src/linux</path>, tapez <c>make menuconfig</c> ou
118
xconfig</c>; we're going to enable some kernel network functionality.
124
<c>make xconfig</c>; nous allons choisir certaines fonctionnalités pour notre
125
noyau.
119
</p>
126
</p>
120
127
121
<p>
128
<p>
122
Under the "Networking options" section, make sure that you enable at least the
129
 Dans la section "Networking options" (dans le menu "Networking-&gt;Networking
123
following options:
130
Options" pour le noyau 2.6), assurez-vous d'activer au moins les options
131
suivantes:
124
</p>
132
</p>
125
133
126
<pre caption="Necessary kernel options">
134
<pre caption="Fonctionnalités noyaux nécessaires">
127
&lt;*&gt; Packet socket
135
&lt;*&gt; Packet socket
128
[*] Network packet filtering (replaces ipchains)
136
[*] Network packet filtering (replaces ipchains)
129
&lt;*&gt; Unix domain sockets
137
&lt;*&gt; Unix domain sockets
Lines 136-219 Link Here
136
</pre>
144
</pre>
137
145
138
<p>
146
<p>
139
Then, under the "IP: Netfilter Configuration -&gt;" menu, enable every option so
147
Ensuite, dans le menu "IP: Netfilter Configuration -&gt;", activez toutes les
140
that we'll have full netfilter functionality. We won't use all the netfilter
148
options, afin d'avoir toutes les fonctionnalités NetFilter disponibles pour
141
features, but it's good to enable them so that you can do some experimentation
149
votre firewall. Nous n'aurons pas besoin de toutes, mais vous pourrez ainsi plus
142
later on.
150
tard mener quelques expériences avec ces options.
143
</p>
151
</p>
144
152
145
<p>
153
<p>
146
There's one networking option under the "Networking options" category that you
154
Il y a une fonctionnalité dans la section "Networking options" que vous ne
147
<e>shouldn't</e> enable: explicit congestion notification. Leave this option
155
<e>devriez pas</e> activer: la notification explicite de congestion. Laissez
148
disabled:
156
cette option décochée.
149
</p>
157
</p>
150
158
151
<pre caption="Option we have to disable">
159
<pre caption="L'option à désactiver">
152
[ ]   IP: TCP Explicit Congestion Notification support
160
[ ]   IP: TCP Explicit Congestion Notification support
153
</pre>
161
</pre>
154
162
155
<p>
163
<p>
156
If this option is enabled, your Linux machine won't be able to carry on network
164
Si cette option est activée, votre machine Linux ne sera pas capable de
157
communications with 8% of the Internet. When ECN is enabled, some packets that
165
supporter des communications réseau avec environ 8% de l'Internet. Quand l'ECN
158
your Linux box sends out will have the ECN bit set; however, this bit freaks out
166
est activée, certains paquets envoyés par votre machine Linux auront le bit ECN
159
a number of Internet routers, so it's very important that ECN is disabled.
167
valué à 1. En pratique, ce bit engendre des comportements bizarres sur certains
168
routeurs Internet, aussi vaut-il mieux garder l'ECN désactivée.
160
</p>
169
</p>
161
170
162
<p>
171
<p>
163
OK, now that the kernel's configured correctly for our needs, compile a new one,
172
Maintenant que le noyau est configuré correctement, compilez-le, installez-le et
164
install it, and reboot. Time to start playing with netfilter :)
173
rebootez. Nous pouvons maintenant nous amuser avec NetFilter :)
165
</p>
174
</p>
166
175
167
</body>
176
</body>
168
</section>
177
</section>
169
<section>
178
<section>
170
<title>Firewall design basics</title>
179
<title>Premiers pas</title>
171
<body>
180
<body>
172
181
173
<p>
182
<p>
174
In putting together our firewall, the <c>iptables</c> command is our friend.
183
Pour construire un firewall, la commande <c>iptables</c> sera votre meilleure
175
It's what we use to interact with the network packet filtering rules in the
184
alliée. Elle permet d'interagir avec les règles de filtrage de paquets au niveau
176
kernel.  We'll use the <c>iptables</c> command to create new rules, list
185
du noyau. Nous utiliserons la commande <c>iptables</c> pour créer de nouvelles
177
existing rules, flush rules, and set default packet handling policies. This
186
règles, afficher les règles existantes, en supprimer, et choisir la politique de
178
means that to create our firewall, we're going to enter a series of iptables
187
filtrage par défaut. Ce qui signifie que la création d'un firewall se résume à
179
commands, and here's the first one we're going to take a look at (please don't
188
entrer une série de commandes iptables, comme par exemple (ATTENTION, ne pas la
180
type this in just yet!)...
189
taper tout de suite !)
181
</p>
190
</p>
182
191
183
<pre caption="Changing chain policy to DROP">
192
<pre caption="Choisir la politique par défaut DROP">
184
# <i>iptables -P INPUT DROP</i>
193
# <i>iptables -P INPUT DROP</i>
185
</pre>
194
</pre>
186
195
187
<p>
196
<p>
188
You're looking at an almost "perfect" firewall. If you type in this command,
197
Si vous voulez créer un firewall "quasiment" parfait, et que vous entrez cette
189
you'll be incredibly well protected against any form of incoming malicious
198
commande, vous serez absolument bien protégé contre toutes formes d'attaques
190
attack. That's because this command tells the kernel to drop all incoming
199
malicieuses. En effet, cette commande ordonne au noyau d'ignorer tous les
191
network packets. While this firewall is extremely secure, it's a bit silly. But
200
paquets réseau entrants. Cependant, même si ce firewall est extrêmement
192
before moving on, let's take a look at exactly how this command does what it
201
sécurisé, il est également un peu mauvais. Mais avant de continuer, essayons de
193
does.
202
comprendre comment cette commande peut faire ce qu'elle fait.
194
</p>
203
</p>
195
204
196
</body>
205
</body>
197
</section>
206
</section>
198
<section>
207
<section>
199
<title>Setting chain policy</title>
208
<title>Modifier la politique par défaut</title>
200
<body>
209
<body>
201
210
202
<p>
211
<p>
203
An <c>iptables -P</c> command is used to set the default policy for a chain of
212
La commande <c>iptables -P</c> est utilisée pour selectionner la politique par
204
packet filtering rules. In this example, <c>iptables -P</c> is used to set the
213
défaut pour une chaine de filtrage de paquets. Dans cet exemple, <c>iptables
205
default policy for the INPUT chain, a built-in chain of rules that's applied to
214
-P</c> est utilisée pour changer la politique par défaut de la chaine INPUT, une
206
every incoming packet. By setting the default policy to DROP, we tell the kernel
215
chaine préinstallée qui est appliquée à chaque paquet entrant. En sélectionnant
207
that any packets that reach the end of the INPUT rule chain should be dropped
216
la potique par défaut DROP, on indique au noyau que chaque paquet qui atteint la
208
(that is, discarded). And, since we haven't added any rules to the INPUT chain,
217
fin de la chaine INPUT doit être droppé (c'est à dire ignoré, supprimé de la
209
all packets reach the end of the chain, and all packets are dropped.
218
mémoire). Et comme nous n'avons pas encore ajouté de règles dans la chaine
219
INPUT, tous les paquets atteignent la fin de la chaine, et donc tous les paquets
220
sont ignorés.
210
</p>
221
</p>
211
222
212
<p>
223
<p>
213
Again, by itself this command is totally useless. However, it demonstrates a
224
Encore une fois, à elle seule, cette commande est totalement inutile. Cependant,
214
good strategy for firewall design. We'll start by dropping all packets by
225
elle montre une bonne stratégie pour la construction d'un firewall. On commence
215
default, and then gradually start opening up our firewall so that it meets our
226
par ignorer tous les paquets par défaut, puis on ouvre au fur et à mesure les
216
needs. This will ensure that our firewall is as secure as possible.
227
ports dont on a besoin. Celà garantit que le firewall est aussi sécurisé que
228
possible.
217
</p>
229
</p>
218
230
219
</body>
231
</body>
Lines 221-329 Link Here
221
</chapter>
233
</chapter>
222
234
223
<chapter>
235
<chapter>
224
<title>Defining rules</title>
236
<title>Definir ses règles</title>
225
<section>
237
<section>
226
<title>A (small) improvement</title>
238
<title>Une (petite) amélioration</title>
227
<body>
239
<body>
228
240
229
<p>
241
<p>
230
In this example, let's assume that we're designing a firewall for a machine with
242
Dans cet exemple, nous supposerons que nous construisons un firewall pour une
231
two network interfaces, eth0 and eth1. The eth0 network card is connected to our
243
machine avec deux interfaces réseau, nommées eth0 et eth1. L'interface eth0 est
232
LAN, while the eth1 network card is attached to our DSL router, our connection
244
connectée sur notre LAN, tandis que eth1 est branchée sur notre routeur DSL, qui
233
to the Internet. For such a situation, we could improve our "ultimate firewall"
245
mène vers Internet. Dans une telle situation, nous améliorerons notre "firewall
234
by adding one more line:
246
ultime" en rajoutant une ligne:
235
</p>
247
</p>
236
248
237
<pre caption="Improving our ultimate firewall">
249
<pre caption="Améliorons notre firewall ultime">
238
# <i>iptables -P INPUT DROP</i>
250
# <i>iptables -P INPUT DROP</i>
239
# <i>iptables -A INPUT -i ! eth1 -j ACCEPT</i>
251
# <i>iptables -A INPUT -i ! eth1 -j ACCEPT</i>
240
</pre>
252
</pre>
241
253
242
<p>
254
<p>
243
This additional <c>iptables -A</c> line adds a new packet filtering rule to the
255
Cette ligne supplémentaire <c>iptables -A</c> ajoute une nouvelle règle de
244
end of our INPUT chain. After this rule is added, our INPUT chain consists of a
256
filtrage de paquets à la fin de la chaine INPUT. Après avoir rajouté cette
245
single rule and a drop-by-default policy. Now, let's take a look at what our
257
règle, la chaine INPUT consiste en une règle unique et une règle DROP par
246
semi-complete firewall does.
258
défaut. Maintenant, voyons ce que fait notre firewall désormais à moitié
259
terminé.
247
</p>
260
</p>
248
261
249
</body>
262
</body>
250
</section>
263
</section>
251
<section>
264
<section>
252
<title>Following the INPUT chain</title>
265
<title>Le long de la chaine INPUT...</title>
253
<body>
266
<body>
254
267
255
<p>
268
<p>
256
When a packet comes in on any interface (lo, eth0, or eth1), the netfilter code
269
Quand un paquet arrive sur l'une des interfaces (lo, eth0, ou eth1), le code de
257
directs it to the INPUT chain and checks to see if the packet matches the first
270
NetFilter l'envoie sur la chaine INPUT et vérifie s'il correspond à la première
258
rule. If it does, the packet is accepted, and no further processing is
271
règle. Si c'est le cas, est accepté, et le traitement de ce paquet est terminé.
259
performed. If not, the INPUT chain's default policy is enforced, and the packet
272
Sinon, la règle par défaut de INPUT est appliquée, et le paquet est effacé
260
is discarded (dropped).
273
(DROP).
261
</p>
274
</p>
262
275
263
<p>
276
<p>
264
That's the conceptual overview. Specifically, our first rule matches all packets
277
Voilà pour le point de vue conceptuel. Plus concrétement, la première règle
265
coming in from eth0 and lo, immediately allowing them in. Any packets coming in
278
correspond à tous les paquets arrivant sur les interfaces eth0 et lo, et les
266
from eth1 are dropped. So, if we enable this firewall on our machine, it'll be
279
laisse passer. Tous les paquets arrivant sur l'interface eth1 sont droppés.
267
able to interact with our LAN but be effectively disconnected from the Internet.
280
Donc, si nous activons ce firewall sur notre machine, il pourra intéragir avec
268
Let's look at a couple of ways to enable Internet traffic.
281
notre LAN mais ne pourra pas communiquer avec Internet. Voyons comment autoriser
282
le traffic Internet, et ce de deux manières différentes.
269
</p>
283
</p>
270
284
271
</body>
285
</body>
272
</section>
286
</section>
273
<section>
287
<section>
274
<title>Traditional firewalls</title>
288
<title>Firewalls traditionnels</title>
275
<body>
289
<body>
276
290
277
<p>
291
<p>
278
Obviously, for our firewall to be useful, we need to selectively allow some
292
Evidemment, pour que notre firewall serve à quelque chose, il nous faut
279
incoming packets to reach our machine via the Internet. There are two approaches
293
sélectionner quels paquets seront autorisés à atteindre notre machine en passant
280
to opening up our firewall to the point where it is useful: one uses static
294
par Internet. Il y a deux approches pour faire celà: l'une utilise des règles
281
rules, and the other uses dynamic, stateful rules.
295
statiques, tandis que l'autre utilise des règles dynamiques, avec suivi d'état
296
(stateful).
282
</p>
297
</p>
283
298
284
<p>
299
<p>
285
Let's take downloading Web pages as an example. If we want our machine to be
300
Prenons pour exemple le cas du téléchargement de pages Web. Si nous voulons que
286
able to download Web pages from the Internet, we can add a static rule that will
301
notre machine soit capable de recevoir les paquets correspondants au
287
always be true for every incoming http packet, regardless of origin:
302
téléchargement, nous pouvons ajouter une règle statique qui sera toujours vraie
303
pour les paquets HTTP entrants, quelle que soit leur origine:
288
</p>
304
</p>
289
305
290
<pre caption="Accepting all the incoming http packets">
306
<pre caption="Acceptons tous les paquets HTTP entrants">
291
# <i>iptables -A INPUT --sport 80 -j ACCEPT</i>
307
# <i>iptables -A INPUT --sport 80 -j ACCEPT</i>
292
</pre>
308
</pre>
293
309
294
<p>
310
<p>
295
Since all standard Web traffic originates from a source port of 80, this rule
311
Comme tout le traffic Web standard provient d'un serveur avec port source 80,
296
effectively allows our machine to download Web pages. However, this traditional
312
cette règle permet effectivement à votre machine de télécharger des pages Web.
297
approach, while marginally acceptable, suffers from a bunch of problems.
313
Cependant, cette approche traditionnelle, bien qu'acceptable dans certains cas,
314
engendre de nombreux problèmes.
298
</p>
315
</p>
299
316
300
</body>
317
</body>
301
</section>
318
</section>
302
<section>
319
<section>
303
<title>Traditional firewall bummers</title>
320
<title>Problèmes des firewalls traditionnels</title>
304
<body>
321
<body>
305
322
306
<p>
323
<p>
307
Here's a problem: while most Web traffic originates from port 80, some doesn't.
324
Voilà le premier problème: bien que la plupart du traffic Web a pour origine un
308
So, while this rule would work most of the time, there would be rare instances
325
port 80, ce n'est quelquefois pas vrai. Donc, cette règle marche, mais seulement
309
where this rule wouldn't work. For example, maybe you've seen a URL that looks
326
la plupart du temps. Par exemple, vous avez peut-être déjà vu une URL du genre
310
like this: "http://www.foo.com:81". This example URL points to a Web
327
"http://www.foo.com:81". Cette URL pointe vers un serveur Web hébergé sur un
311
site on port 81 rather than the default port 80, and would be unviewable from
328
serveur écoutant sur le port 81 plutôt que le port 80 par défaut, et est donc
312
behind our current firewall. Taking into account all these special cases can
329
invisualisable derrière notre firewall. Prendre en compte toutes les exceptions
313
quickly turn a fairly secure firewall into swiss cheese and quickly fill our
330
de ce genre va vite faire de notre firewall sécurisé un sac de noeuds et
314
INPUT chain with a bunch of rules to handle the occasional oddball Web site.
331
remplira notre chaine INPUT avec un tas de règles pour gérer chaque cas
332
particulier.
315
</p>
333
</p>
316
334
317
<p>
335
<p>
318
However, the major problem with this rule is security related. Sure, it's true
336
Cependant, le problème majeur de ce genre de règle est lié à la sécurité.
319
that only traffic with a source port of 80 will be allowed through our firewall.
337
Evidemment, il est vrai que seulement le traffic avec un port source 80 sera
320
But the source port of a packet is not something that we have any control over,
338
autorisé à passer notre firewall. Mais le port source d'un paquet est un élément
321
and it can be easily altered by an intruder. For example, if an intruder knew
339
facilement manipulable par un attaquant. Par exemple, si un intrus connait la
322
how our firewall were designed, he could bypass our firewall by simply making
340
façon dont notre firewall est conçu, il peut le contourner simplement en
323
sure that all his incoming connections originated from port 80 on one of his
341
s'assurant que toutes ses connexions entrantes viennent d'un port 80 de l'une de
324
machines! Because this static firewall rule is so easy to exploit, a more secure
342
ses machines ! Puisque cette règle statique est trop facile à contourner, il
325
dynamic approach is needed. Thankfully, iptables and kernel 2.4 provide
343
nous faut une approche plus sécurisée et dynamique. Heureusement, iptables et le
326
everything we need to enable dynamic, stateful filtering.
344
noyau 2.4 et supérieurs incluent tout ce dont nous avons besoin pour construire
345
un firewall dynamique et à suivi d'états.
327
</p>
346
</p>
328
347
329
</body>
348
</body>
Lines 331-466 Link Here
331
</chapter>
350
</chapter>
332
351
333
<chapter>
352
<chapter>
334
<title>Stateful firewalls</title>
353
<title>Firewalls stateful</title>
335
<section>
354
<section>
336
<title>State basics</title>
355
<title>Quelques mots sur les états</title>
337
<body>
356
<body>
338
357
339
<p>
358
<p>
340
Rather than opening up holes in our firewall based on static protocol
359
Plutôt que de creuser des trous dans notre firewall en se basant sur des
341
characteristics, we can use Linux's new connection tracking functionality to
360
caractéristiques statiques des protocoles, on peut utiliser les nouvelles
342
make firewall decisions based on the dynamic connection state of packets.
361
fonctionnalités de suivi de connexion de Linux pour baser les décisions du
343
Conntrack works by associating every packet with an individual bidirectional
362
firewall sur l'état dynamique des paquets par rapport à la connexion. Conntrack
344
communications channel, or connection.
363
fonctionne en associant chaque paquet avec une et une seule communication
364
bidirectionnelle, ou connexion.
345
</p>
365
</p>
346
366
347
<p>
367
<p>
348
For example, consider what happens when you use telnet or ssh to connect to a
368
Par exemple, imaginons ce qui se passe lorsque vous utilisez telnet ou ssh pour
349
remote machine. If you view your network traffic at the packet level, all you
369
vous connecter sur une machine distante. Si vous regarder le traffic réseau au
350
see is a bunch of packets zipping from one machine to another. However, at a
370
niveau paquets, tout ce que vous verez sera un tas de paquets passant d'une
351
higher level, this exchange of packets is actually a bidirectional
371
machine sur l'autre. Cependant, à un niveau d'abstraction plus élevé, cette
352
communications channel between your local machine and a remote machine.
372
échange de paquets est en fait une communication bidirectionelle entre votre
353
Traditional (old-fashioned) firewalls only look at the individual packets, not
373
machine locale et la machine distante. Les firewalls traditionnels ne font que
354
recognizing that they're actually part of a larger whole, a connection.
374
regarder chaque paquet indépendemment les uns des autres, sans se soucier qu'ils
375
fassent en réalité partie d'un tout, d'une connexion.
355
</p>
376
</p>
356
377
357
</body>
378
</body>
358
</section>
379
</section>
359
<section>
380
<section>
360
<title>Inside conntrack</title>
381
<title>Conntrack en détails</title>
361
<body>
382
<body>
362
383
363
<p>
384
<p>
364
That's where connection tracking technology comes in. Linux's conntrack
385
C'est là que la technologie de suivi de connexion entre en jeu. La
365
functionality can "see" the higher-level connections that are taking place,
386
fonctionnalité conntrack de Linux peut "voir" les connexions de haut niveau
366
recognizing your ssh session as a single logical entity. Conntrack can even
387
lorsqu'elles ont lieu, reconnaissant votre session SSH comme une seule entité
367
recognize UDP and ICMP packet exchanges as logical "connections", even though
388
logique. Conntrack peut aussi reconnaître les échanges de paquets UDP et ICMP
368
UDP and ICMP are connectionless in nature; this is very helpful because it
389
comme des "connexions" logiques, même si UDP et ICMP sont sans connexion par
369
allows us to use conntrack to handle ICMP and UDP packet exchanges.
390
nature; celà est très utile puisque sela permet d'utiliser conntrack pour gérer
391
des échanges de paquets ICMP et UDP.
370
</p>
392
</p>
371
393
372
<p>
394
<p>
373
If you've already rebooted and are using your new netfilter-enabled kernel, you
395
Si vous avez déjà redémarré avec votre nouveau noyau avec NetFilter activé, vous
374
can view a list of active network connections that your machine is participating
396
pouvez voir une liste des connexions réseau actives auquelles votre machine
375
in by typing <c>cat /proc/net/ip_conntrack</c>. Even with no firewall
397
participe en entrant <c>cat /proc/net/ip_conntrack</c>. Même sans firewall
376
configured, Linux's conntrack functionality is working behind the scenes,
398
configuré, conntrack fonctionne en arrière-plan, en gardant trace des connexions
377
keeping track of the connections that your machine is participating in.
399
établies ou reçues par votre machine.
378
</p>
400
</p>
379
401
380
</body>
402
</body>
381
</section>
403
</section>
382
<section>
404
<section>
383
<title>The NEW connection state</title>
405
<title>Etat de connexion NEW</title>
384
<body>
406
<body>
385
407
386
<p>
408
<p>
387
Conntrack doesn't just recognize connections, it also classifies every packet
409
Conntrack ne fait pas que reconnaitre les connexions, il classe également chaque
388
that it sees into one of four connection states. The first state that we're
410
paquet qu'il voit dans l'un des quatres états de connexion. Le premier état dont
389
going to talk about is called NEW. When you type <c>ssh remote.host.com</c>, the
411
nous allons parler est appelé NEW (nouveau). Quand vous tapez <c>ssh
390
initial packet or burst of packets that originate from your machine and are
412
hote.distant.com</c>, le premier paquet ou la première rafale de paquets qui
391
destined for remote.host.com are in the NEW state. However, as soon as you
413
sortent de votre machine et sont destinés à hote.distant.com sont dans l'état
392
receive even just a single reply packet from remote.host.com, any further
414
NEW. Cependant, dès que vous aurez reçu ne serait-ce qu'un seul paquet de
393
packets you send to remote.host.com as part of this connection aren't considered
415
hote.distant.com, tous les futurs paquets que vous enverrez à hote.distant.com
394
NEW packets anymore. So, a packet is only considered NEW when it's involved in
416
dans cette connexion ne seront plus considérés comme des packets NEW. Pour
395
establishing a new connection, and no traffic has yet been received from the
417
résumer, un paquet est considéré NEW lorsqu'il sert à établir une nouvelle
396
remote host (as part of this particular connection, of course).
418
connexion, et qu'aucun trafic n'a été reçu de l'hôte distant en retour (dans le
419
cadre de cette connexion précise, évidemment).
397
</p>
420
</p>
398
421
399
<p>
422
<p>
400
I've described outgoing NEW packets, but it's also very possible (and common) to
423
J'ai décris les paquets NEW sortants, mais il est également tout à fait possible
401
have incoming NEW packets. Incoming NEW packets generally originate from a
424
(et normal) d'avoir des paquets NEW entrants. Les paquets NEW entrants viennent
402
remote machine, and are involved in initiating a connection with you. The
425
généralement d'une machine distante, et servent à établir une connexion avec
403
initial packet(s) your Web server receives as part of a HTTP request would be
426
vous. Le(s) premier(s) paquet(s) que votre serveur Web reçoit pour une requête
404
considered incoming NEW packets; however, once you reply to just a single
427
HTTP sont considérés comme des paquets NEW entrants; cependant, une fois que
405
incoming NEW packet, any additional packets you receive that are related to this
428
vous aurez répondu à un seul de ces paquets, tous les autres paquets que vous
406
particular connection are no longer in the NEW state.
429
recevrez ne seront plus considérés dans l'état NEW.
407
</p>
430
</p>
408
431
409
</body>
432
</body>
410
</section>
433
</section>
411
<section>
434
<section>
412
<title>The ESTABLISHED state</title>
435
<title>Etat de connexion ESTABLISHED</title>
413
<body>
436
<body>
414
437
415
<p>
438
<p>
416
Once a connection has seen traffic in both directions, additional packets
439
Une fois qu'une connexion a vue du trafic dans les deux sens, tous les nouveaux
417
relating to this connection are considered to be in an ESTABLISHED state. The
440
paquets de cette connexion sont considérés dans l'état ESTABLISHED (établi). La
418
distinction between NEW and ESTABLISHED is an important one, as we'll see in a
441
distinction entre les états NEW et ESTABLISHED est très importante, comme nous
419
minute.
442
le verrons dans un instant.
420
</p>
443
</p>
421
444
422
</body>
445
</body>
423
</section>
446
</section>
424
<section>
447
<section>
425
<title>The RELATED state</title>
448
<title>Etat de connexion RELATED</title>
426
<body>
449
<body>
427
450
428
<p>
451
<p>
429
The third connection state category is called RELATED. RELATED packets are those
452
Le troisième état de connexion est appelé RELATED (en rapport avec). Les paquets
430
that are starting a new connection, but are related to another currently
453
RELATED sont ceux qui établissent une nouvelle connexion, mais qui sont en
431
existing connection. The RELATED state can be used to regulate connections that
454
rapport avec une connexion déjà existante. L'état RELATED peut être utilisé pour
432
are part of a multi-connection protocol, such as ftp, as well as error packets
455
filtrer des connexions qui font partie d'un protocole multi-connexion, comme
433
related to existing connections (such as ICMP error packets related to an
456
FTP, ainsi que les paquets d'erreur en rapport avec des connexions existantes
434
existing connection).
457
(comme les paquets d'erreur ICMP).
435
</p>
458
</p>
436
459
437
</body>
460
</body>
438
</section>
461
</section>
439
<section>
462
<section>
440
<title>The INVALID state</title>
463
<title>Etat de connexion INVALID</title>
441
<body>
464
<body>
442
465
443
<p>
466
<p>
444
Finally, there are INVALID packets: those that can't be classified into one of
467
Pour terminer, il existe aussi les paquets INVALID: ce sont ceux qui ne peuvent
445
the above three categories. It's important to note that if a packet is
468
être classés dans aucune des trois précédentes catégories. Il est important de
446
considered INVALID, it isn't automatically discarded; it's still up to you to
469
noter qu'un paquet considéré comme INVALID n'est pas automatiquement ignoré;
447
insert the appropriate rules and set chain policy so that they're handled
470
c'est à vous de choisir les règles appropriées et d'ajuster les politiques pour
448
correctly.
471
que ces paquets soient gérés de la manière que vous préférez.
449
</p>
472
</p>
450
473
451
</body>
474
</body>
452
</section>
475
</section>
453
<section>
476
<section>
454
<title>Adding a stateful rule</title>
477
<title>Ajout d'une règle stateful</title>
455
<body>
478
<body>
456
479
457
<p>
480
<p>
458
OK, now that we have a good understanding of connection tracking, it's time to
481
Bien, maintenant que nous avons compris le suivi de connexion, il est temps de
459
take a look at a single additional rule that transforms our non-functional
482
jeter un oeil à une simple règle supplémentaire qui va transformer notre
460
firewall into something quite useful:
483
firewall non-fonctionnel en quelque chose de plutôt utile.
461
</p>
484
</p>
462
485
463
<pre caption="Adding a stateful rule">
486
<pre caption="Ajout d'une règle stateful">
464
# <i>iptables -P INPUT DROP</i>
487
# <i>iptables -P INPUT DROP</i>
465
# <i>iptables -A INPUT -i ! eth1 -j ACCEPT</i>
488
# <i>iptables -A INPUT -i ! eth1 -j ACCEPT</i>
466
# <i>iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</i>
489
# <i>iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</i>
Lines 469-563 Link Here
469
</body>
492
</body>
470
</section>
493
</section>
471
<section>
494
<section>
472
<title>How the rule works</title>
495
<title>Fonctionnement de cette règle</title>
473
<body>
496
<body>
474
497
475
<p>
498
<p>
476
This single rule, when inserted at the end of our existing INPUT chain, will
499
Cette simple règle, insérée à la fin de votre chaine INPUT existante, va nous
477
allow us to establish connections with remote machines. It works as follows.
500
permettre d'établir des connexions avec des machines distantes. Elle fonctionne
478
Let's say we want to ssh over to remote.host.com. After typing <c>ssh
501
comme ceci: disons que l'on veuille faire du ssh vers hote.distant.com. Après
479
remote.host.com</c>, our machine sends out a packet to initiate the connection.
502
avoir lancé <c>ssh hote.distant.com</c>, notre machine envoie un paquet pour
480
This particular packet is in the NEW state, and our firewall allows it out,
503
établir la connexion. Ce paquet particulier est dans l'état NEW, et notre
481
because we're only blocking packets coming in to our firewall, not going out.
504
firewall le laisse passer, puisque nous bloquons seulement les paquets qui
505
entrent dans notre firewall, pas qui en sortent.
482
</p>
506
</p>
483
507
484
<p>
508
<p>
485
When we get a reply packet from remote.host.com, this packet trickles through
509
Quand nous recevons une réponse de hote.distant.com, ce paquet passe par notre
486
our INPUT chain. It doesn't match our first rule (since it comes in on eth1), so
510
chaine INPUT. Il ne correspond pas à la première règle (puisqu'il arrive de
487
it moves on to our next, and final rule. If it matches this rule, it will be
511
eth1), donc il passe à la seconde et dernière règle. Si il correspond à cette
488
accepted, and if it doesn't, it will fall off the end of the INPUT chain and the
512
règle, il sera accepté, et sinon, il arrivera à la fin de la chaine INPUT et la
489
default policy will be applied to the packet (DROP). So, is this incoming reply
513
politique par défaut lui sera appliquée (DROP). Alors, ce paquet entrant
490
packet accepted or dropped on the floor?
514
sera-t'il accepté ou droppé ?
491
</p>
515
</p>
492
516
493
<p>
517
<p>
494
Answer: accepted. When the kernel inspects this incoming packet, it first
518
Réponse: accepté. Quand le noyau examine ce paquet entrant, il reconnait en
495
recognizes that it's part of an already existing connection. Then, the kernel
519
premier qu'il fait partie d'une connexion existante. Ensuite, le noyau doit
496
needs to decide whether this is a NEW or ESTABLISHED packet. Since this is an
520
décider s'il s'agit d'un paquet NEW ou ESTABLISHED. Puisqu'il s'agit d'un paquet
497
incoming packet, it checks to see if this connection has had any outgoing
521
entrant, il vérifie si cette connexion a déjà eu du trafic sortant, et trouve
498
traffic, and finds that it has (our initial NEW packet that we sent out).
522
que c'est le cas (le paquet NEW initial que nous avons envoyé). Ensuite, le
499
Therefore, this incoming packet is categorized as ESTABLISHED, as are any
523
paquet entrant est classé ESTABLISHED, comme le seront tous les futurs paquets
500
further packets we receive or send that are associated with this connection.
524
reçus ou envoyés qui seront associés avec cette connexion.
501
</p>
525
</p>
502
526
503
</body>
527
</body>
504
</section>
528
</section>
505
<section>
529
<section>
506
<title>Incoming NEW packets</title>
530
<title>Paquets NEW entrants</title>
507
<body>
531
<body>
508
532
509
<p>
533
<p>
510
Now, let's consider what happens if someone on a remote machine tries to ssh in
534
Maintenant, considérons ce qui ce passe si quelqu'un sur une machine distante
511
to us. The initial packet we receive is classified as NEW, and doesn't match
535
essaie de se connecter en ssh chez nous. Le premier paquet que nous recevons est
512
rule 1, so it advances to rule 2. Because this packet isn't in an ESTABLISHED or
536
marqué NEW, et ne correspond pas à la règle 1, donc il passe à la règle 2.
513
RELATED state, it falls off the end of the INPUT chain and the default policy,
537
Puisque ce paquet n'est pas dans l'état ESTABLISHED ou RELATED, il arrive à la
514
DROP, is applied. Our incoming ssh connection request is dropped to the floor
538
fin de la chaine INPUT et la politique par défaut, DROP, est appliquée. Notre
515
without so much as a reply (or TCP reset) from us.
539
demande d'établissement de connexion ssh entrante est donc ignorée sans même une
540
réponse (ou un paquet TCP reset) de notre part.
516
</p>
541
</p>
517
542
518
</body>
543
</body>
519
</section>
544
</section>
520
<section>
545
<section>
521
<title>A near-perfect firewall</title>
546
<title>Un firewall proche de la perfection</title>
522
<body>
547
<body>
523
548
524
<p>
549
<p>
525
So, what kind of firewall do we have so far? An excellent one for a laptop or a
550
Alors, quel genre de firewall avons-nous jusqu'à présent ? Un excellent choix
526
workstation where you don't want anyone from the Internet connecting to you, but
551
pour un portable ou un poste de travail si vous voulez que personne ne puisse se
527
where you need to connect to sites on the Internet. You'll be able to use
552
connecter depuis Internet vers vous, mais avec lequel vous pouvez quand même
528
Netscape, konqueror, ftp, ping, perform DNS lookups, and more. Any connection
553
vous connecter à des sites sur Internet. Vous pourrez utiliser Netscape,
529
that you initiate will get back in through the firewall. However, any
554
Konqueror, ftp, ping, faire des recherches DNS, et bien plus. Toutes les
530
unsolicited connection that comes in from the Internet will be dropped, unless
555
connexions dont vous êtes l'initiateur pourront passer votre firewall.
531
it's related to an existing connection that you initiated. As long as you don't
556
Cependant, les connexions non sollicitées qui viennent depuis Internet seront
532
need to provide any network services to the outside, this is a near-perfect
557
ignorées, à moins d'être en relation avec une connexion existante que vous avez
533
firewall.
558
initiée. Tant que vous ne devez pas fournir un service réseau vers l'extérieur,
559
c'est un firewall pratiquement parfait.
534
</p>
560
</p>
535
561
536
</body>
562
</body>
537
</section>
563
</section>
538
<section>
564
<section>
539
<title>A basic firewall script</title>
565
<title>Un script de firewall simple</title>
540
<body>
566
<body>
541
567
542
<p>
568
<p>
543
Here's a simple script that can be used to set up/tear down our first basic
569
Voilà un script simple qui peut être utilisé pour configurer notre premier
544
workstation firewall:
570
firewall de station de travail:
545
</p>
571
</p>
546
572
547
<pre caption="A basic firewall script">
573
<pre caption="Un script de firewall simple">
548
#!/bin/bash
574
#!/bin/bash
549
<comment># A basic stateful firewall for a workstation or laptop that isn't running any</comment>
575
<comment># Un script de firewall simple pour une station de travail ou un
550
<comment># network services like a web server, SMTP server, ftp server, etc.</comment>
576
portable</comment>
577
<comment># qui ne fournit aucun service réseau, comme un  serveur web, ftp,
578
smtp, etc.</comment>
551
579
552
if [ "$1" = "start" ]
580
if [ "$1" = "start" ]
553
then
581
then
554
        echo "Starting firewall..."
582
        echo "Démarrage du firewall..."
555
        iptables -P INPUT DROP
583
        iptables -P INPUT DROP
556
        iptables -A INPUT -i ! eth1 -j ACCEPT
584
        iptables -A INPUT -i ! eth1 -j ACCEPT
557
        iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
585
        iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
558
elif [ "$1" = "stop" ]
586
elif [ "$1" = "stop" ]
559
then
587
then
560
        echo "Stopping firewall..."
588
        echo "Arrêt du firewall..."
561
        iptables -F INPUT
589
        iptables -F INPUT
562
        iptables -P INPUT ACCEPT
590
        iptables -P INPUT ACCEPT
563
fi
591
fi
Lines 566-583 Link Here
566
</body>
594
</body>
567
</section>
595
</section>
568
<section>
596
<section>
569
<title>Using the script</title>
597
<title>Utilisation du script</title>
570
<body>
598
<body>
571
599
572
<p>
600
<p>
573
Using this script, you can bring down the firewall by typing <c>./firewall
601
En utilisant ce script, vous pouvez désactiver le firewall en tapant 
574
stop</c>, and bring it back up again by typing <c>./firewall start</c>. To bring
602
<c>./firewall stop</c>, et le relancer en tapant <c>./firewall start</c>. Pour
575
down the firewall, we flush our rules out of the INPUT chain with a <c>iptables
603
désactiver le firewall, on supprime les règles de la chaine INPUT en faisant 
576
-F INPUT</c>, and then switch the default INPUT policy back to ACCEPT with a
604
<c>iptables -F INPUT</c>, puis reprenons la politique par défaut de INPUT en
577
<c>iptables -P INPUT ACCEPT</c> command. Now, let's look at a bunch of
605
ACCEPT avec la commande <c>iptables -P INPUT ACCEPT</c>. Maintenant, voyons 
578
improvements that we can make to our existing workstation firewall. Once I've
606
tout un tas d'améliorations que nous pouvons faire sur notre firewall. Après
579
explained every improvement, I'll present a final workstation firewall script.
607
avoir expliqué chaque amélioration, je présenterai un script avancé pour un
580
Then, we'll start customizing our firewall for servers.
608
poste de travail. Ensuite, nous commencerons à modifier notre firewall pour des
609
serveurs.
581
</p>
610
</p>
582
611
583
</body>
612
</body>
Lines 585-605 Link Here
585
</chapter>
614
</chapter>
586
615
587
<chapter>
616
<chapter>
588
<title>Stateful improvements</title>
617
<title>Améliorations au suivi d'états</title>
589
<section>
618
<section>
590
<title>Explicitly turn off ECN</title>
619
<title>Désactication explicite de l'ECN</title>
591
<body>
620
<body>
592
621
593
<p>
622
<p>
594
I mentioned earlier that it's important to turn off ECN (explicit congestion
623
J'ai parlé plus haut de l'importance de désactiver l'ECN (explicit congestion
595
notification) so that Internet communications will work properly. While you may
624
notification) pour que les communications Internet fonctionnent correctement.
596
have disabled ECN in the kernel per my suggestion, it's possible that in the
625
Même si vous avez désactivé l'ECN dans le noyau en suivant ma suggestion, il
597
future, you'll forget to do so. Or, possibly, you'll pass your firewall script
626
est possible que vous l'oubliez dans le futur. Ou, comme c'est possible, vous
598
along to someone who has ECN enabled. For these reasons, it's a good idea to use
627
allez paser votre script de firewall à quelqu'un qui a l'ECN activé. Pour ces
599
the <path>/proc</path> interface to explicitly disable ECN, as follows:
628
raisons, c'est une bonne idée d'utiliser l'interface <path>/proc</path> pour
629
désactiver explicitement l'ECN, comme ceci:
600
</p>
630
</p>
601
631
602
<pre caption="Explicitly turn off ECN">
632
<pre caption="Désactivation explicite de l'ECN">
603
if [ -e /proc/sys/net/ipv4/tcp_ecn ]
633
if [ -e /proc/sys/net/ipv4/tcp_ecn ]
604
then
634
then
605
        echo 0 > /proc/sys/net/ipv4/tcp_ecn
635
        echo 0 > /proc/sys/net/ipv4/tcp_ecn
Lines 613-624 Link Here
613
<body>
643
<body>
614
644
615
<p>
645
<p>
616
If you're using your Linux machine as a router, then you'll want to enable IP
646
Si vous utilisez votre machine Linux comme un routeur, alors vous voudrez
617
forwarding, which will give the kernel permission to allow packets to travel
647
activer l'IP forwarding, ce qui donnera la permission au noyau de transmettre
618
between eth0 and eth1, and vice versa. In our example configuration, where eth0
648
des paquets de l'interface eth0 à eth1, et inversement. Dans notre exemple de
619
is connected to our LAN, and eth1 is connected to the Internet, enabling IP
649
configuration, ou eth0 est connectée à notre LAN, et eth1 à Internet, activer
620
forwarding is a necessary step in allowing our LAN to connect to the Internet
650
l'IP forwarding est une étape nécessaire pour permettre à notre LAN de se
621
via our Linux box. To enable IP forwarding, use this line:
651
connecter à Internet en passant par notre machine Linux. Pour activer l'IP
652
forwarding, utilisez cette ligne:
622
</p>
653
</p>
623
654
624
<pre caption="Forwarding">
655
<pre caption="Forwarding">
Lines 628-696 Link Here
628
</body>
659
</body>
629
</section>
660
</section>
630
<section>
661
<section>
631
<title>Handling rejection</title>
662
<title>Gestion des rejets</title>
632
<body>
663
<body>
633
664
634
<p>
665
<p>
635
So far, we've been dropping all unsolicited traffic coming in from the Internet.
666
Jusqu'à présent, nous avons ignoré tout le trafic non solicité venant
636
While this is an effective way to deter unwanted network activity, it does have
667
d'Internet. Bien que celà soit un moyen efficace pour contrer l'activité réseau
637
some drawbacks. The biggest problem with this approach is that it's easy for an
668
non désirable, celà engendre également quelques inconvénients. Le plus gros
638
intruder to detect that we're running a firewall, since our machine isn't
669
problème avec cette approche est qu'il est facile pour un intrus de détecter
639
replying with the standard TCP reset and ICMP port-unreachable responses: the
670
que nous utilisons un firewall, puisque notre machine ne répond pas avec les
640
responses that a normal machine would send back to indicate a failed connection
671
réponses standards TCP reset et ICMP port-unreachable, c'est à dire les
641
attempt to a non-existent service.
672
réponses qu'une machine normale devrait renvoyer pour indiquer une tentative de
673
connexion échouée vers un service non existant.
642
</p>
674
</p>
643
675
644
<p>
676
<p>
645
Rather than let potential intruders know that we're running a firewall (and thus
677
Plutôt que de laisser des intrus potentiels savoir que nous utilisons un
646
tip them off to the fact that we may be running some valuable services that they
678
firewall (ce qui peut leur laisser penser que nous fournissons des services
647
can't get to), it would be to our advantage to make it appear as if we aren't
679
précieux auquels ils ne peuvent pas accéder), il serait à notre avantage de
648
running any services at all. By adding these two rules to the end of our INPUT
680
faire croire que nous n'utilisons pas de firewall. En ajoutant ces deux règles
649
chain, we can successfully accomplish this task:
681
à la fin de la chaine INPUT, on peut facilement accomplir cette tâche:
650
</p>
682
</p>
651
683
652
<pre caption="Handling rejection">
684
<pre caption="Gestion des rejets">
653
# <i>iptables -A INPUT -p tcp -i eth1 -j REJECT --reject-with tcp-reset</i>
685
# <i>iptables -A INPUT -p tcp -i eth1 -j REJECT --reject-with tcp-reset</i>
654
# <i>iptables -A INPUT -p udp -i eth1 -j REJECT --reject-with icmp-port-unreachable</i>
686
# <i>iptables -A INPUT -p udp -i eth1 -j REJECT --reject-with
687
icmp-port-unreachable</i>
655
</pre>
688
</pre>
656
689
657
<p>
690
<p>
658
Our first rule takes care of correctly zapping TCP connections, while the second
691
La première règle s'occupe de rejeter correctement les connexions TCP, alors
659
handles UDP. With these two rules in place, it becomes very difficult for an
692
que la seconde s'occupe de l'UDP. Avec ces deux règles, il devient difficile
660
intruder to detect that we're actually running a firewall; hopefully, this will
693
pour un intrus de détecter que nous sommes derrière un firewall; avec de la
661
cause the intruder to leave our machine and search for other targets with more
694
chance, l'intrus se détournera de notre machine pour chercher d'autres cibles
662
potential for abuse.
695
potentiellement plus intérressantes.
663
</p>
696
</p>
664
697
665
<p>
698
<p>
666
In addition to making our firewall more "stealthy", these rules also eliminate
699
En plus de rendre notre firewall plus "discret", ces règles éliminent aussi le
667
the delay involved in connecting to certain ftp and irc servers. This delay is
700
délai lors de la connection à certains serveurs FTP et IRC. Ce délai est dû au
668
caused by the server performing an ident lookup to your machine (connecting to
701
serveur qui tente de faire une requête ident sur votre machine (en se
669
port 113) and eventually (after about 15 seconds) timing out. Now, our firewall
702
connectant sur le port 113), qui échoue après un timeout d'environ 15 secondes.
670
will return a TCP reset and the ident lookup will fail immediately instead of
703
Maintenant, notre firewall va renvoyer un TCP reset et la requête ident va
671
retrying for 15 seconds (while you're patiently waiting for a response from the
704
échouer immédiatement plutôt que de réssayer pendant 15 secondes (alors que
672
server).
705
vous attendez patiemment une réponse du serveur).
673
</p>
706
</p>
674
707
675
</body>
708
</body>
676
</section>
709
</section>
677
<section>
710
<section>
678
<title>Spoof protection</title>
711
<title>Protection contre le Spoof</title>
679
<body>
712
<body>
680
713
681
<p>
714
<p>
682
In many distributions, when the network interface(s) are brought up, several old
715
Dans plusieurs distributions, quand une interface réseau est activée, plusieurs
683
ipchains rules are also added to the system. These special rules were added by
716
vieilles règles ipchains sont également ajoutées au système. Ces règles
684
the creators of the distribution to deal with a problem called spoofing, in
717
spéciales avaient été ajoutées par les créateurs de la distribution pour
685
which the source address of packets have been tweaked so that they contains an
718
contrer un problème appelé spoofing, dans lequel les adresses sources des
686
invalid value (something that script kiddies do). While we can create similar
719
paquets ont été traffiqués pour contenir une valeur invalide (c'est une des
687
iptables rules that will also block spoofed packets, there's an easier way.
720
choses que les script kiddies font). Bien que l'on pourrait créer des règles
688
These days, the kernel has the built-in ability to dropped spoofed packets; all
721
iptables similaires pour bloquer ces paquets spoofés, il y a une manière de
689
we need to do is enable it via a simple <path>/proc</path> interface. Here's
722
faire plus facile. De nos jours, le noyau a la fonctionnalité intégrée
690
how.
723
d'ignorer les paquets spoofés; il suffit de l'activer par le biais de
724
l'interface <path>/proc</path>. Voilà comment.
691
</p>
725
</p>
692
726
693
<pre caption="Spoof protection">
727
<pre caption="Protection contre le spoofing">
694
for x in lo eth0 eth1
728
for x in lo eth0 eth1
695
do
729
do
696
        echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
730
        echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
Lines 698-706 Link Here
698
</pre>
732
</pre>
699
733
700
<p>
734
<p>
701
This shell script will tell the kernel to drop any spoofed packets on interfaces
735
Ce script shell va indiquer au noyau d'ignorer tous les paquets spoofés sur les
702
lo, eth0, and eth1. You can either add these lines to your firewall script, or
736
interfaces lo, eth0 et eth1. Vous pouvez soit ajouter ces lignes à votre script
703
add them to the script that brings up your lo, eth0, and eth1 interfaces.
737
de firewall, soit dans le script qui active vos interfaces lo, eth0, et eth1.
704
</p>
738
</p>
705
739
706
</body>
740
</body>
Lines 710-720 Link Here
710
<body>
744
<body>
711
745
712
<p>
746
<p>
713
NAT (network address translation) and IP masquerading, while not directly
747
Le NAT (network address translation) et l'IP masquerading, bien que non
714
related to firewalls, are often used in conjunction with them. We're going to
748
directement en rapport avec les firewalls, sont souvent utilisés en complément.
715
look at two common NAT/masquerading configurations that you may need to use.
749
Nous allons voir deux configurations répandues de NAT/Masquerading que vous
716
This first rule would take care of situations where you have a dialup link to
750
pourrez avoir à utiliser. La première règle servira dans les situations où vous
717
the Internet (ppp0) that uses a dynamic IP:
751
utilisez un lien non permanent vers Internet (ppp0) avec une adresse IP
752
dynamique.
718
</p>
753
</p>
719
754
720
<pre caption="Masquerading">
755
<pre caption="Masquerading">
Lines 722-732 Link Here
722
</pre>
757
</pre>
723
758
724
<p>
759
<p>
725
If you're in this situation, you'll also want to convert my firewall scripts so
760
Si vous êtes dans cette situation, vous voudrez également convertir mes scripts
726
that all references to "eth1" (our example DSL router) are changed to "ppp0".
761
de firewall pour que les références à "eth1" (le routeur DSL dans notre
727
And it's perfectly fine to add firewalling rules that refer to "ppp0" when the
762
exemple) soient changées en "ppp0". Et il est tout à fait possible d'ajouter
728
ppp0 interface doesn't yet exist. As soon as ppp0 is up, everything will work
763
des règles qui font références à "ppp0" alors que cette interface n'existe pas
729
perfectly. Make sure you enable IP forwarding as well.
764
encore. Dès que ppp0 est activée, tout fonctionnera à merveille. Vérifiez
765
quannd même que vous avez activé l'IP forwarding.
730
</p>
766
</p>
731
767
732
</body>
768
</body>
Lines 736-762 Link Here
736
<body>
772
<body>
737
773
738
<p>
774
<p>
739
If you're using DSL to connect to the Internet, you probably have one of two
775
Si vous utilisez une ligne DSL pour vous connecter à Internet, vous avez
740
possible configurations. One possibility is that your DSL router or modem has
776
probablement une des deux configurations suivantes. Dans la première, votre
741
its own IP number and performs network address translation for you. If you're in
777
routeur DSL ou modem a sa propre adresse IP et s'occupe de la translation
742
this situation, you don't need Linux to perform NAT for you since your DSL
778
d'adresse pour vous. Si vous êtes dans cette situation, vous n'avez pas besoin
743
router is taking care of it already.
779
de faire du NAT puisque votre routeur DSL le fait déjà.
744
</p>
780
</p>
745
781
746
<p>
782
<p>
747
However, if you want to have more control over your NAT functionality, you may
783
Cependant, si vous voulez avoir plus de contrôle sur vos fonctionnalités NAT,
748
want to talk to your ISP about configuring your DSL connection so that your DSL
784
vous pouvez eventuellement, si votre fournisseur d'accès le permet, configurer
749
router is in "bridged mode". In bridged mode, your firewall becomes an official
785
votre routeur DSL en mode "bridge" (pont). Dans ce mode, votre firewall devient
750
part of your ISP's network, and your DSL router transparently forwards IP
786
un élément officiel du réseau de votre fournisseur d'accès, et le routeur DSL
751
traffic back and forth between your ISP and your Linux box without letting
787
s'occupe de relayer le trafic de et vers votre machine Linux de manière
752
anyone know that it's there. It no longer has an IP number; instead, eth1 (in
788
transparente. Il n'a plus besoin d'une adresse IP; à la place, eth1 (dans notre
753
our example) sports the IP. If someone pings your IP from the Internet, they get
789
exemple) en a une. Si quelqu'un pingue votre adresse IP depuis Internet, il
754
a reply back from your Linux box, rather than your router.
790
recevra une réponse de votre machine Linux, et pas de votre routeur.
755
</p>
791
</p>
756
792
757
<p>
793
<p>
758
With this kind of setup, you'll want to use SNAT (source NAT) rather than
794
Avec ce genre de configuration, vous aurez à utiliser SNAT (source NAT)
759
masquerading. Here's the line you should add to your firewall:
795
plutôt que le Masquerading. Voici la ligne que vous devriez rajouter à votre
796
firewall:
760
</p>
797
</p>
761
798
762
<pre caption="SNAT">
799
<pre caption="SNAT">
Lines 764-864 Link Here
764
</pre>
801
</pre>
765
802
766
<p>
803
<p>
767
In this example, eth1 should be changed to the ethernet interface connected
804
Dans cet exemple, remplacez eth1 par l'interface Ethernet connectée sur votre
768
directly to your DSL router, and 1.2.3.4 should be changed to your static IP
805
routeur DSL, ainsi que 1.2.3.4 par votre adresse IP statique (l'IP de votre
769
(the IP of your ethernet interface). Again, remember to enable IP forwarding.
806
interface Ethernet). Encore une fois, n'oubliez pas l'IP forwarding.
770
</p>
807
</p>
771
808
772
</body>
809
</body>
773
</section>
810
</section>
774
<section>
811
<section>
775
<title>NAT issues</title>
812
<title>Problèmes avec le NAT</title>
776
<body>
813
<body>
777
814
778
<p>
815
<p>
779
Fortunately for us, NAT and masquerading get along just fine with a firewall.
816
Heureusement pour nous, le NAT et le masquerading s'entendent bien sur notre
780
When writing your firewall filtering rules, just ignore the fact that you're
817
firewall. Quand vous écrivez vos règles de firewall, ignorez simplement que vous
781
using NAT. Your rules should accept, drop, or reject packets based on their
818
utilisez du NAT. Vos règles doivent accepter, ignorer ou rejeter les paquets en
782
"real" source and destination addresses. The firewall filtering code sees the
819
se basant sur leur "véritables" adresses source et destination. Le code de
783
original source address for a packet, and the final destination address. This is
820
filtrage du firewall prend en compte l'adresse source d'origine et l'adresse de
784
great for us, because it allows our firewall to continue working properly even
821
destination finale. C'est tant mieux pour nous, puisque celà permet à notre
785
if we temporarily disable NAT or masquerading.
822
firewall de fonctionner correctement même si on désactive temporairement le NAT
823
ou le masquerading.
786
</p>
824
</p>
787
825
788
</body>
826
</body>
789
</section>
827
</section>
790
<section>
828
<section>
791
<title>Understanding tables</title>
829
<title>Comprendre les tables</title>
792
<body>
830
<body>
793
831
794
<p>
832
<p>
795
In the above NAT/masquerading examples, we're appending rules to a chain, but
833
Dans les exemples de NAT/masquerading précédents, on a ajouté des règles à une
796
we're also doing something a bit different. Notice the "-t" option. The "-t"
834
chaine, mais nous avons également fait des choses un peu différemment. Remarquez
797
option allows us to specify the table that our chain belongs to. When omitted,
835
l'option "-t". L'option "-t" permet de choisir la table à laquelle appartient
798
the default table defaults to "filter". So, all our previous non-NAT related
836
notre chaine. Quand cette option n'est pas spécifiée, la table par défaut est la
799
commands were modifying the INPUT chain that's part of the "filter" table. The
837
table "filter". Par conséquent, toutes les commandes précédentes sans rapport
800
"filter" table contains all the rules associated with accepting or rejecting
838
avec le NAT ont modifié la chaine INPUT qui fait partie de la table "filter". La
801
packets, while the "nat" table (as you would assume) contains rules relating to
839
table "filter" contient toutes les règles associées à l'acceptation/rejet de
802
network address translation. There are also other built-in iptables chains and
840
paquets, tandis que la table "nat" (comme vous pouvez le deviner) contient les
803
they are described in detail in the iptables man page, as well as in Rusty's
841
règles concernant la translation d'adresse. Il existe d'autres chaines iptables
804
HOWTOs (see the <uri link="#resources">Resources</uri> section at the end of
842
qui sont décrites en détail dans la page de manuel iptables, ainsi que dans les
805
this tutorial for links).
843
HOWTO de Rusty Russel (cf. dans la section <uri link="#ressources">Ressources
844
</uri> plus bas pour les liens).
806
</p>
845
</p>
807
846
808
</body>
847
</body>
809
</section>
848
</section>
810
<section>
849
<section>
811
<title>Our enhanced script</title>
850
<title>Notre script amélioré</title>
812
<body>
851
<body>
813
852
814
<p>
853
<p>
815
Now that we've taken a look at a bunch of possible enhancements, it's time to
854
Maintenant que nous avons vu tout un tas d'améliorations possibles, il est temps
816
take a look at a second more flexible firewall up/down script:
855
de voir un second script plus souple d'activation/désactivation du firewall:
817
</p>
856
</p>
818
857
819
<pre caption="Our enhanced script">
858
<pre caption="Notre script amélioré">
820
859
821
#!/bin/bash
860
#!/bin/bash
822
861
823
<comment># An enhanced stateful firewall for a workstation, laptop or router that isn't</comment>
862
<comment># Un firewall statefull amélioré pour une station de travail, portable
824
<comment># running any network services like a web server, SMTP server, ftp server, etc.</comment>
863
ou routeur</comment>
825
864
<comment># qui ne fourni aucun service réseau (comme serveur web, smtp, ftp,
826
<comment># Change this to the name of the interface that provides your "uplink"</comment>
865
etc.)</comment>
827
<comment># (connection to the Internet)</comment>
866
867
<comment># Changez cette variable pour le nom de l'interface qui sert d'"uplink"
868
</comment>
869
<comment># (connexion à Internet)</comment>
828
870
829
UPLINK="eth1"
871
UPLINK="eth1"
830
872
831
<comment># If you're a router (and thus should forward IP packets between interfaces),</comment>
873
<comment># Si vous êtes un routeur, (et donc souhaitez forwarder les paquets IP
832
<comment># you want ROUTER="yes"; otherwise, ROUTER="no"</comment>
874
entre les interfaces),</comment>
875
<comment># mettez ROUTER="yes"; sinon, ROUTER="no"</comment>
833
876
834
ROUTER="yes"
877
ROUTER="yes"
835
878
836
<comment># Change this next line to the static IP of your uplink interface for static SNAT, or</comment>
879
<comment># Changez la prochaine ligne pour mettre l'adresse IP statique de votre
837
<comment># "dynamic" if you have a dynamic IP.  If you don't need any NAT, set NAT to "" to</comment>
880
interface
838
<comment># disable it.</comment>
881
<comment># uplink pour faire du SNAT statique, ou "dynamic" si vous avez une IP
882
dynamique</comment>
883
<comment># Si vous n'avez pas besoin de NAT, laissez NAT="" pour le désactiver.
884
</comment>
839
885
840
NAT="1.2.3.4"
886
NAT="1.2.3.4"
841
887
842
<comment># Change this next line so it lists all your network interfaces, including lo</comment>
888
<comment># Changez cette variable pour lister toutes vos interfaces réseau, y
889
compris lo</comment>
843
890
844
INTERFACES="lo eth0 eth1"
891
INTERFACES="lo eth0 eth1"
845
892
846
if [ "$1" = "start" ]
893
if [ "$1" = "start" ]
847
then
894
then
848
        echo "Starting firewall..."
895
        echo "Demarrage du firewall..."
849
        iptables -P INPUT DROP
896
        iptables -P INPUT DROP
850
        iptables -A INPUT -i ! ${UPLINK} -j ACCEPT
897
        iptables -A INPUT -i ! ${UPLINK} -j ACCEPT
851
        iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
898
        iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
852
        iptables -A INPUT -p tcp -i ${UPLINK} -j REJECT --reject-with tcp-reset
899
        iptables -A INPUT -p tcp -i ${UPLINK} -j REJECT --reject-with tcp-reset
853
        iptables -A INPUT -p udp -i ${UPLINK} -j REJECT --reject-with icmp-port-unreachable
900
        iptables -A INPUT -p udp -i ${UPLINK} -j REJECT --reject-with
901
icmp-port-unreachable
854
902
855
        <comment># Explicitly disable ECN</comment>
903
        <comment># Desactivation explicite de l'ECN</comment>
856
        if [ -e /proc/sys/net/ipv4/tcp_ecn ]
904
        if [ -e /proc/sys/net/ipv4/tcp_ecn ]
857
        then
905
        then
858
                echo 0 > /proc/sys/net/ipv4/tcp_ecn
906
                echo 0 > /proc/sys/net/ipv4/tcp_ecn
859
        fi
907
        fi
860
908
861
        <comment># Disable spoofing on all interfaces</comment>
909
        <comment># Désactiver le spoofing sur toutes les interfaces</comment>
862
        for x in ${INTERFACES}
910
        for x in ${INTERFACES}
863
        do
911
        do
864
                echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
912
                echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
Lines 866-892 Link Here
866
914
867
        if [ "$ROUTER" = "yes" ]
915
        if [ "$ROUTER" = "yes" ]
868
        then
916
        then
869
                <comment># We're a router of some kind, enable IP forwarding</comment>
917
                <comment># Activation de l'IP forwarding pour le routage
918
</comment>
870
                echo 1 > /proc/sys/net/ipv4/ip_forward
919
                echo 1 > /proc/sys/net/ipv4/ip_forward
871
                if [ "$NAT" = "dynamic" ]
920
                if [ "$NAT" = "dynamic" ]
872
                then
921
                then
873
                        <comment># Dynamic IP address, use masquerading</comment>
922
                        <comment># Adresse IP dynamique, utilisation du
874
                        echo "Enabling masquerading (dynamic ip)..."
923
masquerading</comment>
875
                        iptables -t nat -A POSTROUTING -o ${UPLINK} -j MASQUERADE
924
                        echo "Activation du masquerading (IP dynamique)..."
925
                        iptables -t nat -A POSTROUTING -o ${UPLINK} -j
926
MASQUERADE
876
                elif [ "$NAT" != "" ]
927
                elif [ "$NAT" != "" ]
877
                then
928
                then
878
                        <comment># Static IP, use SNAT</comment>
929
                        <comment># IP statique, utilisation du SNAT</comment>
879
                        echo "Enabling SNAT (static ip)..."
930
                        echo "Activation SNAT (IP statique)..."
880
                        iptables -t nat -A POSTROUTING -o ${UPLINK} -j SNAT --to ${UPIP}
931
                        iptables -t nat -A POSTROUTING -o ${UPLINK} -j SNAT --to
932
${UPIP}
881
                fi
933
                fi
882
        fi
934
        fi
883
935
884
elif [ "$1" = "stop" ]
936
elif [ "$1" = "stop" ]
885
then
937
then
886
        echo "Stopping firewall..."
938
        echo "Arret du firewall..."
887
        iptables -F INPUT
939
        iptables -F INPUT
888
        iptables -P INPUT ACCEPT
940
        iptables -P INPUT ACCEPT
889
        <comment># Turn off NAT/masquerading, if any</comment>
941
        <comment># Désactive le NAT/masquerading</comment>
890
        iptables -t nat -F POSTROUTING
942
        iptables -t nat -F POSTROUTING
891
fi
943
fi
892
</pre>
944
</pre>
Lines 896-923 Link Here
896
</chapter>
948
</chapter>
897
949
898
<chapter>
950
<chapter>
899
<title>Stateful servers</title>
951
<title>Servers statefuls</title>
900
<section>
952
<section>
901
<title>Viewing rules</title>
953
<title>Voir ses règles</title>
902
<body>
954
<body>
903
955
904
<p>
956
<p>
905
Before we start making customizations to our firewall so that it can be used on
957
Avant de commencer à modifier notre firewall pour pouvoir l'utiliser sur un
906
a server, I need to show you how to list your currently active firewall rules.
958
serveur, je dois vous montrer comment afficher les règles actives sur votre
907
To view the rules in the filter table's INPUT chain, type:
959
firewall. Pour voir les règles dans la chaine INPUT de la table filter, tapez:
908
</p>
960
</p>
909
961
910
<pre caption="Viewing rules">
962
<pre caption="Voir les règles">
911
# <i>iptables -v -L INPUT</i>
963
# <i>iptables -v -L INPUT</i>
912
</pre>
964
</pre>
913
965
914
<p>
966
<p>
915
The -v option gives us a verbose output, so that we can see the total packets
967
L'option -v nous donne une sortie verbeuse, afin que l'on puisse voir le nombre
916
and bytes transferred per rule. We can also look at our nat POSTROUTING table
968
total de paquets et d'octets transférés par règle. On peut aussi voir la chaine
917
with the following command:
969
POSTROUTING de la table nat avec la commande suivante:
918
</p>
970
</p>
919
971
920
<pre caption="Viewing POSTROUTING table rules">
972
<pre caption="Voir les règles de la chaine POSTROUTING de la table nat">
921
# <i>iptables -t nat -v -L POSTROUTING</i>
973
# <i>iptables -t nat -v -L POSTROUTING</i>
922
Chain POSTROUTING (policy ACCEPT 399 packets, 48418 bytes)
974
Chain POSTROUTING (policy ACCEPT 399 packets, 48418 bytes)
923
pkts bytes target     prot opt in     out     source               destination
975
pkts bytes target     prot opt in     out     source               destination
Lines 928-979 Link Here
928
</body>
980
</body>
929
</section>
981
</section>
930
<section>
982
<section>
931
<title>Getting ready for service</title>
983
<title>Prêts pour le service</title>
932
<body>
984
<body>
933
985
934
<p>
986
<p>
935
Right now, our firewall doesn't allow the general public to connect to services
987
A l'heure actuelle, notre firewall ne permet pas au "public" de se connecter aux
936
on our machine because it only accepts incoming ESTABLISHED or RELATED packets.
988
services sur notre machine car il accepte seulement les paquets entrants dans
937
Because it drops any incoming NEW packets, any connection attempt is rejected
989
l'état ESTABLISHED ou RELATED. Comme il ignore tous les paquets NEW entrants,
938
unconditionally. However, by selectively allowing some incoming traffic to cross
990
toutes les tentatives de connexion sont systématiquement rejetées. Cependant, en
939
our firewall, we can allow the general public to connect to the services that we
991
autorisant sélectivement certains paquets à traverser notre firewall, on peut
940
specify.
992
permettre au "public" de se connecter aux services que nous voudrons.
941
</p>
993
</p>
942
994
943
</body>
995
</body>
944
</section>
996
</section>
945
<section>
997
<section>
946
<title>Stateful HTTP</title>
998
<title>HTTP stateful</title>
947
<body>
999
<body>
948
1000
949
<p>
1001
<p>
950
While we want to accept some incoming connections, we probably don't want to
1002
Bien que l'on veuille accepter quelques connexions entrantes, on ne souhaite
951
accept every kind of incoming connection. It makes sense to start with a "deny
1003
tout de même pas les accepter toutes. Il est préférable de partir d'une
952
by default" policy (as we have now) and begin opening up access to those
1004
politique "rejet par défaut" (comme nous l'avons configuré actuellement) et
953
services that we'd like people to be able to connect to. For example, if we're
1005
d'ouvrir l'accès aux seuls services que l'on souhaite rendre publics. Par
954
running a Web server, we'll allow NEW packets into our machine, as long as they
1006
exemple, si nous avons un serveur Web, nous allons autoriser les paquets NEW
955
are headed for port 80 (HTTP). That's all we need to do. Once we allow the NEW
1007
vers notre machine, mais seulement s'ils sont destinés au port 80 (HTTP). C'est
956
packets in, we've allowed a connection to be established. Once the connection is
1008
tout ce qu'il suffit de faire. Dès que nous autorisons le paquet NEW à passer,
957
established, our existing rule allowing incoming ESTABLISHED and RELATED packets
1009
on autorise l'établissement de connexion. Une fois la connexion établie, la
958
kicks in, allowing the HTTP connection to proceed unhindered.
1010
règle existante qui autorise les paquets entrants ESTABLISHED et RELATED entre
1011
en scène, laissant se dérouler la connexion HTTP sans accrocs.
959
</p>
1012
</p>
960
1013
961
</body>
1014
</body>
962
</section>
1015
</section>
963
<section>
1016
<section>
964
<title>Stateful HTTP example</title>
1017
<title>Exemple d'HTTP stateful</title>
965
<body>
1018
<body>
966
1019
967
<p>
1020
<p>
968
Let's take a look at the "heart" of our firewall and the new rule that allows
1021
Jetons un oeil au "coeur" de notre firewall et à la nouvelle règle qui autorise
969
incoming HTTP connections:
1022
les connexion HTTP entrantes:
970
</p>
1023
</p>
971
1024
972
<pre caption="Stateful HTTP example">
1025
<pre caption="Exemple d'HTTP stateful">
973
iptables -P INPUT DROP
1026
iptables -P INPUT DROP
974
iptables -A INPUT -i ! ${UPLINK} -j ACCEPT
1027
iptables -A INPUT -i ! ${UPLINK} -j ACCEPT
975
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
1028
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
976
<comment># Our new rule follows</comment>
1029
<comment># Notre nouvelle règle</comment>
977
iptables -A INPUT -p tcp --dport http -m state --state NEW -j ACCEPT
1030
iptables -A INPUT -p tcp --dport http -m state --state NEW -j ACCEPT
978
iptables -A INPUT -p tcp -i ${UPLINK} -j REJECT --reject-with tcp-reset
1031
iptables -A INPUT -p tcp -i ${UPLINK} -j REJECT --reject-with tcp-reset
979
iptables -A INPUT -p udp -i ${UPLINK} -j REJECT --reject-with
1032
iptables -A INPUT -p udp -i ${UPLINK} -j REJECT --reject-with
Lines 981-1059 Link Here
981
</pre>
1034
</pre>
982
1035
983
<p>
1036
<p>
984
This new rule allows incoming NEW TCP packets destined for our machine's port 80
1037
Cette nouvelle règle autorise les paquets TCP NEW entrants destinés au port
985
(http) to come in. Notice the placement of this rule. It's important that it
1038
80 (HTTP) de notre machine à entrer. Remarquez la place de cette règle. Il est
986
appears before our REJECT rules. Since iptables will apply the first matching
1039
important qu'elle soit placée avant notre règle REJECT. Comme iptables applique
987
rule, putting it after our REJECT lines would cause this rule to have no effect.
1040
seulement la première règle qui correspond, la mettre derrière les lignes REJECT
1041
engendrerai qu'elle n'ai aucun effet.
988
</p>
1042
</p>
989
1043
990
</body>
1044
</body>
991
</section>
1045
</section>
992
<section>
1046
<section>
993
<title>Our final firewall script</title>
1047
<title>Notre script de firewall avancé</title>
994
<body>
1048
<body>
995
1049
996
<p>
1050
<p>
997
Now, let's take a look at our final firewall script, one that can be used on a
1051
Maintenant, voyons notre dernier script de firewall, qui peut être utilisé
998
laptop, workstation, router, or server (or some combination thereof!).
1052
sur un portable, station de travail, routeur ou serveur (ou une quelconque
1053
combinaison&nbsp;!)
999
</p>
1054
</p>
1000
1055
1001
<pre caption="Our final firewall script">
1056
<pre caption="Notre script de firewall avancé">
1002
1057
1003
#!/bin/bash
1058
#!/bin/bash
1004
1059
1005
<comment># Our complete stateful firewall script.  This firewall can be customized for</comment>
1060
<comment># Notre script de firewall complement stateful. Ce firewall peut
1006
<comment># a laptop, workstation, router or even a server. :)</comment>
1061
être adapté</comment>
1062
<comment># pour un portable, station de travail, routeur ou même un serveur. :)
1063
</comment>
1007
1064
1008
<comment># Change this to the name of the interface that provides your "uplink"</comment>
1065
<comment># Changez cette variable pour le no de l'interface "uplink"</comment>
1009
<comment># (connection to the Internet)</comment>
1066
<comment># (connexion vers Internet)</comment>
1010
1067
1011
UPLINK="eth1"
1068
UPLINK="eth1"
1012
1069
1013
<comment># If you're a router (and thus should forward IP packets between interfaces),</comment>
1070
<comment># Si vous êtes routeur (et donc souhaitez forwarder les paquets IP
1014
<comment># you want ROUTER="yes"; otherwise, ROUTER="no"</comment>
1071
entre les</comment>
1072
<comment># interfaces), mettez ROUTER="yes"; sinon, ROUTER="no"</comment>
1015
1073
1016
ROUTER="yes"
1074
ROUTER="yes"
1017
1075
1018
<comment># Change this next line to the static IP of your uplink interface for static SNAT, or</comment>
1076
<comment># Changez la prochaine ligne vers l'adresse IP statique de votre
1019
<comment># "dynamic" if you have a dynamic IP.  If you don't need any NAT, set NAT to "" to</comment>
1077
interface</comment>
1020
<comment># disable it.</comment>
1078
<comment># uplink pour du SNAT statique, ou "dynamic" si vous avez une IP
1079
dynamique.</comment>
1080
<comment># Si vous ne voulez pas de NAT, mettez NAT="" pour le désactiver.
1081
</comment>
1021
1082
1022
NAT="1.2.3.4"
1083
NAT="1.2.3.4"
1023
1084
1024
<comment># Change this next line so it lists all your network interfaces, including lo</comment>
1085
<comment># Changez cette ligne pour lister toutes vos interfaces réseaux, y
1086
compris lo</comment>
1025
1087
1026
INTERFACES="lo eth0 eth1"
1088
INTERFACES="lo eth0 eth1"
1027
1089
1028
<comment># Change this line so that it lists the assigned numbers or symbolic names (from</comment>
1090
<comment># Changez cette ligne pour lister les numéros de ports ou noms
1029
<comment># /etc/services) of all the services that you'd like to provide to the general</comment>
1091
symboliques</comment>
1030
<comment># public. If you don't want any services enabled, set it to ""</comment>
1092
<comment># (de /etc/services) de tous les services que vous souhaiter rendre
1093
publics.</comment>
1094
<comment># Si vous ne souhaitez publiez aucun service, laissez ""</comment>
1031
1095
1032
SERVICES="http ftp smtp ssh rsync"
1096
SERVICES="http ftp smtp ssh rsync"
1033
1097
1034
if [ "$1" = "start" ]
1098
if [ "$1" = "start" ]
1035
then
1099
then
1036
        echo "Starting firewall..."
1100
        echo "Démarrage du firewall..."
1037
        iptables -P INPUT DROP
1101
        iptables -P INPUT DROP
1038
        iptables -A INPUT -i ! ${UPLINK} -j ACCEPT
1102
        iptables -A INPUT -i ! ${UPLINK} -j ACCEPT
1039
        iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
1103
        iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
1040
1104
1041
        <comment># Enable public access to certain services</comment>
1105
        <comment># Activer l'accès publics aux services</comment>
1042
        for x in ${SERVICES}
1106
        for x in ${SERVICES}
1043
        do
1107
        do
1044
                iptables -A INPUT -p tcp --dport ${x} -m state --state NEW -j ACCEPT
1108
                iptables -A INPUT -p tcp --dport ${x} -m state --state NEW -j
1109
ACCEPT
1045
        done
1110
        done
1046
1111
1047
        iptables -A INPUT -p tcp -i ${UPLINK} -j REJECT --reject-with tcp-reset
1112
        iptables -A INPUT -p tcp -i ${UPLINK} -j REJECT --reject-with tcp-reset
1048
        iptables -A INPUT -p udp -i ${UPLINK} -j REJECT --reject-with icmp-port-unreachable
1113
        iptables -A INPUT -p udp -i ${UPLINK} -j REJECT --reject-with
1114
icmp-port-unreachable
1049
1115
1050
        <comment># Explicitly disable ECN</comment>
1116
        <comment># Désactivation explicite de l'ECN</comment>
1051
        if [ -e /proc/sys/net/ipv4/tcp_ecn ]
1117
        if [ -e /proc/sys/net/ipv4/tcp_ecn ]
1052
        then
1118
        then
1053
                echo 0 > /proc/sys/net/ipv4/tcp_ecn
1119
                echo 0 > /proc/sys/net/ipv4/tcp_ecn
1054
        fi
1120
        fi
1055
1121
1056
        <comment># Disable spoofing on all interfaces</comment>
1122
        <comment># Protection anti-spoofing</comment>
1057
        for x in ${INTERFACES}
1123
        for x in ${INTERFACES}
1058
        do
1124
        do
1059
        echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
1125
        echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
Lines 1061-1087 Link Here
1061
1127
1062
        if [ "$ROUTER" = "yes" ]
1128
        if [ "$ROUTER" = "yes" ]
1063
        then
1129
        then
1064
                <comment># We're a router of some kind, enable IP forwarding</comment>
1130
                <comment># Activation de l'IP forwarding</comment>
1065
                echo 1 > /proc/sys/net/ipv4/ip_forward
1131
                echo 1 > /proc/sys/net/ipv4/ip_forward
1066
                if [ "$NAT" = "dynamic" ]
1132
                if [ "$NAT" = "dynamic" ]
1067
                then
1133
                then
1068
                <comment># Dynamic IP address, use masquerading</comment>
1134
                <comment># IP dynamique => masquerading</comment>
1069
                echo "Enabling masquerading (dynamic ip)..."
1135
                echo "Activation du masquerading (ip dynamique)..."
1070
                        iptables -t nat -A POSTROUTING -o ${UPLINK} -j MASQUERADE
1136
                        iptables -t nat -A POSTROUTING -o ${UPLINK} -j
1137
MASQUERADE
1071
                elif [ "$NAT" != "" ]
1138
                elif [ "$NAT" != "" ]
1072
                then
1139
                then
1073
                        <comment># Static IP, use SNAT</comment>
1140
                        <comment># IP statique => SNAT</comment>
1074
                        echo "Enabling SNAT (static ip)..."
1141
                        echo "Activation du SNAT (ip statique)..."
1075
                        iptables -t nat -A POSTROUTING -o ${UPLINK} -j SNAT --to ${UPIP}
1142
                        iptables -t nat -A POSTROUTING -o ${UPLINK} -j SNAT --to
1143
${UPIP}
1076
                fi
1144
                fi
1077
        fi
1145
        fi
1078
1146
1079
elif [ "$1" = "stop" ]
1147
elif [ "$1" = "stop" ]
1080
then
1148
then
1081
        echo "Stopping firewall..."
1149
        echo "Arrêt du firewall..."
1082
        iptables -F INPUT
1150
        iptables -F INPUT
1083
        iptables -P INPUT ACCEPT
1151
        iptables -P INPUT ACCEPT
1084
        <comment># Turn off NAT/masquerading, if any</comment>
1152
        <comment># Arrêt du masquerading</comment>
1085
        iptables -t nat -F POSTROUTING
1153
        iptables -t nat -F POSTROUTING
1086
fi
1154
fi
1087
</pre>
1155
</pre>
Lines 1091-1217 Link Here
1091
</chapter>
1159
</chapter>
1092
1160
1093
<chapter>
1161
<chapter>
1094
<title>Building a better server firewall</title>
1162
<title>Construire un meilleur firewall pour serveur</title>
1095
<section>
1163
<section>
1096
<title>Server improvements</title>
1164
<title>Améliorations</title>
1097
<body>
1165
<body>
1098
1166
1099
<p>
1167
<p>
1100
It's often possible to make a firewall just an eensy bit "better". Of course,
1168
Il est souvent possible de rendre son firewall toujours un peu "mieux". Bien
1101
what "better" means depends on your specific needs. Our existing script could
1169
sûr, la signification de "mieux" dépend de vos besoins spécifiques. Notre script
1102
meet yours exactly, or maybe some additional tweaking is in order. This section
1170
existant peu combler exactement les vôtres, ou peut-être que quelques retouches
1103
is intended to serve as a cookbook of ideas, demonstrating ways to enhance your
1171
seront nécessaires. Cette section est sensée servir de livre à idées, pour vous
1104
existing stateful firewall.
1172
montrer plusieurs moyens d'améliorer notre firewall stateful existant.
1105
</p>
1173
</p>
1106
1174
1107
</body>
1175
</body>
1108
</section>
1176
</section>
1109
<section>
1177
<section>
1110
<title>Logging techniques</title>
1178
<title>Techniques de log</title>
1111
<body>
1179
<body>
1112
1180
1113
<p>
1181
<p>
1114
So far, we haven't discussed how to go about logging anything. There's a special
1182
Jusqu'à présent, nous n'avons pas vu comment logger des evenements. Il y a une
1115
target called LOG that you can use to log things. Along with LOG, there's a
1183
cible spéciale appelée LOG que vous pouvez utiliser pour celà. Associée à LOG,
1116
special option called <c>--log-prefix</c> that allows you to specify some text
1184
il y a une option spéciale appelée <c>--log-prefix</c> qui permet de choisir le
1117
that will appear alongside the packet dump in the system logs. Here's an example
1185
texte qui apparaîtra devant le descriptif du paquet dans les logs du système.
1118
log rule:
1186
Voilà un exemple de règle LOG:
1119
</p>
1187
</p>
1120
1188
1121
<pre caption="Example log rule">
1189
<pre caption="Exemple de règle LOG">
1122
# <i> iptables -A INPUT -j LOG --log-prefix "bad input:"</i>
1190
# <i> iptables -A INPUT -j LOG --log-prefix "Anomalie INPUT:"</i>
1123
</pre>
1191
</pre>
1124
1192
1125
<p>
1193
<p>
1126
You wouldn't want to add this as the first rule in your INPUT chain, as it would
1194
Vous ne voudrez certainement pas ajouter cette règle en premier dans votre
1127
cause a log entry to be recorded for every packet that you receive! Instead,
1195
chaine INPUT, car celà entraînerait qu'une entrée dans les logs soit créée pour
1128
place log rules further down in your INPUT chain with the intention of logging
1196
chaque paquet que vous recevez ! A la place, placez cette règle assez bas dans
1129
strange packets and other anomalies.
1197
la chaine INPUT pour logguer uniquement les paquets bizarres et autres
1198
anomalies.
1130
</p>
1199
</p>
1131
1200
1132
<p>
1201
<p>
1133
Here's an important note about the LOG target. Normally, when a rule matches, a
1202
Une remarque importante sur la cible LOG. Normalement, quand une règle
1134
packet is either accepted, rejected, or dropped, and no further rules are
1203
correspond à un paquet, ce paquet est soit accepté, rejeté ou ignoré, et les
1135
processed. However, when a log rule matches, the packet is logged. However, it
1204
règles suivantes ne sont pas vérifiées. Cependant, quand une règle LOG
1136
is not accepted, rejected, or dropped. Instead, the packet continues on to the
1205
correspond, ce paquet est loggué. Il n'est ni accepté, ni rejeté, ni ignoré. A
1137
next rule, or the default chain policy is applied if the log rule is the last on
1206
la place, le paquet est confronté à la règle suivante, ou bien la règle par
1138
the chain.
1207
défaut est appliquée s'il n'y a pas de règle suivante.
1139
</p>
1208
</p>
1140
1209
1141
<p>
1210
<p>
1142
The LOG target can also be combined with the "limit" module (described in the
1211
La cible LOG peut également être combinée avec le module "limit" (décrit dans
1143
iptables man page) to minimize duplicate log entries. Here's an example:
1212
la page de manuel iptables) pour éviter d'avoir trop d'entrées dupliquées.
1213
Voilà un exemple:
1144
</p>
1214
</p>
1145
1215
1146
<pre caption="Limiting log entries">
1216
<pre caption="Limiter la taille des logs">
1147
# <i>iptables -A INPUT -m state --state INVALID -m limit --limit 5/minute -j LOG --log-prefix "INVALID STATE:"</i>
1217
# <i>iptables -A INPUT -m state --state INVALID -m limit --limit 5/minute -j LOG
1218
--log-prefix "Etat INVALID:"</i>
1148
</pre>
1219
</pre>
1149
1220
1150
</body>
1221
</body>
1151
</section>
1222
</section>
1152
<section>
1223
<section>
1153
<title>Creating your own chains</title>
1224
<title>Créer vos propres chaines</title>
1154
<body>
1225
<body>
1155
1226
1156
<p>
1227
<p>
1157
<c>iptables</c> allows you to create your own user-defined chains that can be specified
1228
<c>iptables</c> vous permet de créer vos propres chaines qui peuvent être
1158
as targets in your rules. If you want to learn how to do this, spend some time
1229
ensuite spécifiée comme cibles dans vos règles. Pour en apprendre plus à ce
1159
going through the Packet filtering HOWTO at the netfilter/iptables project home
1230
sujet, étudiez le Packet filtering HOWTO hebergé sur le site du projet 
1160
page (<uri>http://www.netfilter.org/</uri>).
1231
netfilter/iptables (<uri>http://www.netfilter.org/</uri>).
1161
</p>
1232
</p>
1162
1233
1163
</body>
1234
</body>
1164
</section>
1235
</section>
1165
<section>
1236
<section>
1166
<title>Enforcing network usage policy</title>
1237
<title>Politique de restriction d'usages</title>
1167
<body>
1238
<body>
1168
1239
1169
<p>
1240
<p>
1170
Firewalls offer a lot of power for those who want to enforce a network usage
1241
Les firewalls offrent une grande puissance à ceux qui veulent restreindre les
1171
policy for a corporate or academic LAN. You can control what packets your
1242
usages d'un réseau dans une entreprise ou un réseau académique. Vous pouvez
1172
machine forwards by adding rules to and setting policy for the FORWARD chain. By
1243
contrôler quels paquets votre machine relait en ajoutant des règles dans la
1173
adding rules to the OUTPUT chain, you can also control what happens to packets
1244
chaine FORWARD. En ajoutant des règles à la chaine OUTPUT, vous pouvez
1174
that are generated locally, by users on the Linux box itself. iptables also has
1245
également contrôler ce qui arrive aux paquets générés localement, par les
1175
the incredible ability to filter locally-created packets based on owner (uid or
1246
utilisateurs sur la machine Linux elle-même. iptables a aussi l'incroyable
1176
gid). For more information on this, search for "owner" in the iptables man page.
1247
capacité de filtrer les paquets générés localement en fonction de leur
1248
propriétaire (UID ou GID). Pour plus d'informations à ce sujet, cherchez
1249
"owner" (propriétaire) dans la page de manuel iptables.
1177
</p>
1250
</p>
1178
1251
1179
</body>
1252
</body>
1180
</section>
1253
</section>
1181
<section>
1254
<section>
1182
<title>Other security angles</title>
1255
<title>Autres angles de la sécurité</title>
1183
<body>
1256
<body>
1184
1257
1185
<p>
1258
<p>
1186
In our example firewall, we've assumed that all internal LAN traffic is
1259
Dans notre exemple de firewall, nous avons supposé que tout le trafic du LAN
1187
trustworthy, and that only incoming Internet traffic must be carefully
1260
interne est digne de confiance, et que seul le trafic Internet devait être
1188
monitored. Depending on your particular network, that may or may not be the
1261
filtré avec soin. Selon votre réseau interne, celà peut être ou ne pas être le
1189
case. There's certainly nothing stopping you from configuring your firewall to
1262
cas. Rien ne vous empêche de configurer votre firewall pour se protéger
1190
provide protection from incoming LAN traffic. Consider other "angles" of your
1263
également du coté du LAN. Envisagez les autres "angles" de votre réseau que
1191
network that you may want to protect. It may also be appropriate to configure
1264
vous voulez protéger. Il peut être aussi approprié de configurer deux zones
1192
two separate LAN security "zones", each with its own security policy.
1265
de sécurité différentes dans votre LAN, chacune avec sa propre politique de
1266
sécurité.
1193
</p>
1267
</p>
1194
1268
1195
</body>
1269
</body>
1196
</section>
1270
</section>
1197
</chapter>
1271
</chapter>
1198
1272
1199
<chapter id="resources">
1273
<chapter id="ressources">
1200
<title>Resources</title>
1274
<title>Ressources</title>
1201
<section>
1275
<section>
1202
<title>tcpdump</title>
1276
<title>tcpdump</title>
1203
<body>
1277
<body>
1204
1278
1205
<p>
1279
<p>
1206
In this section, I'll point out a number of resources that you'll find helpful
1280
Dans cette section, je vous mets des pointeurs vers des ressources variées que
1207
as you put together your own stateful firewall. Let's start with an important
1281
vous trouverez certainement utiles pour vous aider à mettre au point votre
1208
tool...
1282
firewall. Commençons par un outil important...
1209
</p>
1283
</p>
1210
1284
1211
<p>
1285
<p>
1212
<uri link="http://www.tcpdump.org/">tcpdump</uri> is an essential tool for
1286
<uri link="http://www.tcpdump.org/">tcpdump</uri> est un outil essentiel pour
1213
exploring low-level packet exchanges and verifying that your firewall is working
1287
l'exploration bas niveau des echanges de paquets et pour vérifier que votre
1214
correctly. If you don't have it, get it. If you've got it, start using it.
1288
firewall fonctionne correctement. Si vous ne l'avez pas, téléchargez le. Si 
1289
vous l'avez, commencez à l'utiliser.
1215
</p>
1290
</p>
1216
1291
1217
</body>
1292
</body>
Lines 1221-1230 Link Here
1221
<body>
1296
<body>
1222
1297
1223
<p>
1298
<p>
1224
Visit the netfilter/iptables project home page
1299
Visitez le site web du projet netfilter/iptables 
1225
(<uri>http://www.netfilter.org</uri>).  You'll find many resources at this site,
1300
(<uri>http://www.netfilter.org</uri>). You'll find many resources at this site,
1226
including the iptables sources and a <uri
1301
including the iptables sources and a <uri
1227
link="http://www.netfilter.org/documentation/index.html#documentation-faq">netfilter
1302
link="http://www.netfilter.org/documentation/index.html#documentation-faq">
1303
netfilter
1228
FAQ</uri>. Also <uri
1304
FAQ</uri>. Also <uri
1229
link="http://people.netfilter.org/~rusty/unreliable-guides/index.html">Rusty's
1305
link="http://people.netfilter.org/~rusty/unreliable-guides/index.html">Rusty's
1230
Remarkably Guides</uri> are excellent, and include a basic networking concepts
1306
Remarkably Guides</uri> are excellent, and include a basic networking concepts
Lines 1235-1247 Link Here
1235
</body>
1311
</body>
1236
</section>
1312
</section>
1237
<section>
1313
<section>
1238
<title>iptables man page</title>
1314
<title>La page de manuel iptables</title>
1239
<body>
1315
<body>
1240
1316
1241
<p>
1317
<p>
1242
Thankfully, there are a lot of good online netfilter resources; however, don't
1318
Heureusement, il y a beaucoup de ressources disponibles en ligne sur Netfilter;
1243
forget the basics. The iptables man page is very detailed and is a shining
1319
cependant, n'oubliez pas les bases. La page de manuel iptables est très
1244
example of what a man page should be. It's actually an enjoyable read.
1320
détaillée et est un excellent exemple de ce à quoi une page de manuel devrait
1321
ressembler. C'est une lecture passionnante.
1245
</p>
1322
</p>
1246
1323
1247
</body>
1324
</body>
Lines 1251-1267 Link Here
1251
<body>
1328
<body>
1252
1329
1253
<p>
1330
<p>
1254
There's now an <uri link="http://www.ds9a.nl/2.4Routing/">Advanced Linux Routing
1331
Le <uri link="http://www.ds9a.nl/2.4Routing/">Advanced Linux Routing and
1255
and Traffic Control HOWTO</uri> available.  There's a good section that shows
1332
Traffic Control HOWTO</uri> est disponible (également
1256
how to use iptables to mark packets, and then use Linux routing functionality to
1333
<uri link="http://www.linux-france.org/prj/inetdoc/guides/lartc/">
1257
route the packets based on these marks.
1334
en français</uri>). Il contient tout un chapitre sur l'utilisation d'iptables
1335
pour le marquage de paquets, puis sur l'utilisation des fonctionnalités de
1336
routage de Linux pour router les paquets en fonction de ces marques.
1258
</p>
1337
</p>
1259
1338
1260
<note>
1339
<note>
1261
This HOWTO contains references to Linux's traffic control (quality of service)
1340
Ce guide contient des références vers la fonction de contrôle de trafic
1262
functionality (accessed through the new <c>tc</c> command). This new functionality,
1341
(qualité de service) de Linux (accessible via la commande <c>tc</c>). Cette
1263
although very cool, is very poorly documented, and attempting to figure out all
1342
nouvelle fonctionnalité, bien que très puissante, est très peu documentée, et
1264
aspects of Linux traffic control can be a very frustrating task at this point.
1343
essayer de cerner tous les aspects du contrôle de trafic peut être une tache
1344
très frustrante pour le moment.
1265
</note>
1345
</note>
1266
1346
1267
</body>
1347
</body>
Lines 1271-1292 Link Here
1271
<body>
1351
<body>
1272
1352
1273
<p>
1353
<p>
1274
Users who have questions on netfilter/iptables usage, setup, or configuration,
1354
Les utilisateurs qui ont des questions sur l'utilisation, l'installation ou la
1275
or who want to help other users by sharing their experience and knowledge, can
1355
configuration de Netfilter/iptables, ou qui veulent aider les autres
1276
contact the <uri
1356
utilisateurs en partageant leurs experience et connaissances, peuvent contacter 
1277
link="http://www.netfilter.org/mailinglists.html#ml-user">netfilter user mailing
1357
<uri link="http://www.netfilter.org/mailinglists.html#ml-user">la mailing-list
1278
list</uri>.
1358
des utilisateurs de Netfilter</uri>.
1279
</p>
1359
</p>
1280
1360
1281
<p>
1361
<p>
1282
Netfilter/iptables developers who have questions, suggestions, or contributions
1362
Les développeurs Netfilter/iptables qui ont des questions, suggestions ou
1283
to netfilter/iptables development can contact the <uri
1363
contributions pour le developpement de Netfilter/iptables peuvent contacter <uri
1284
link="http://www.netfilter.org/mailinglists.html#ml-devel">netfilter developer
1364
link="http://www.netfilter.org/mailinglists.html#ml-devel">la mailing-list des
1285
mailing list</uri>.
1365
développeurs de Netfilter</uri>.
1286
</p>
1366
</p>
1287
1367
1288
<p>
1368
<p>
1289
You can also browse the list archives at these URLs.
1369
Vous pouvez aussi parcourir les archives de mailing-list sur ces URLs.
1290
</p>
1370
</p>
1291
1371
1292
</body>
1372
</body>
Lines 1296-1322 Link Here
1296
<body>
1376
<body>
1297
1377
1298
<p>
1378
<p>
1299
In June 2000, O'Reilly released an excellent book -- <uri
1379
En juin 2000, O'Reilly a publié un excellent livre -- <uri
1300
link="http://www.oreilly.com/catalog/fire2/">Building Internet Firewalls, Second
1380
link="http://www.oreilly.com/catalog/fire2/">Building Internet Firewalls,
1301
Edition</uri>. It's great reference book, especially for those times when you
1381
Second Edition</uri>. C'est un bon manuel de référence, en particulier dans les
1302
want to configure your firewall to accept (or flat-out reject) a little-known
1382
cas où vous voulez configurer votre firewall pour accepter (ou rejeter) un
1303
protocol that you're unfamiliar with.
1383
protocole peu connu avec lequel vous n'êtes pas familier.
1304
</p>
1384
</p>
1305
1385
1306
<p>
1386
<p>
1307
Well, that's it for our resources list, and our tutorial is complete. I hope
1387
Voilà, c'était la liste de nos ressources, et ce guide est terminé. J'espère
1308
that this tutorial has been helpful to you, and I look forward to your feedback.
1388
qu'il vous a été utile, et j'attends vos remarques.
1309
</p>
1389
</p>
1310
1390
1311
</body>
1391
</body>
1312
</section>
1392
</section>
1313
<section>
1393
<section>
1314
<title>Your feedback</title>
1394
<title>Vos remarques</title>
1315
<body>
1395
<body>
1316
1396
1317
<p>
1397
<p>
1318
We look forward to getting your feedback on this tutorial. Additionally, you are
1398
Nous acceptons volontier vos remarques sur ce tutorial. De plus, n'hésitez pas
1319
welcome to contact the author, Daniel Robbins, at <mail
1399
à contacter l'auteur, Daniel Robbins, à l'adresse <mail
1320
link="drobbins@gentoo.org">drobbins@gentoo.org</mail>.
1400
link="drobbins@gentoo.org">drobbins@gentoo.org</mail>.
1321
</p>
1401
</p>
1322
1402

Return to bug 122377