# Installation et configuration de shorewall

**URL:** <https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813>\
**Category:** Support Debian\
**Created:** [Février 20, 2016, 3:40 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813 "2016-02-20T15:40:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nc4d](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/n/4da419/32.png) [@nc4d](https://www.debian-fr.org/u/nc4d)\
**Post date:** [Février 20, 2016, 3:40 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/1 "2016-02-20T15:40:07Z")

</div>

Installation et configuration de shorewall par nc4d.

Contexte : ordinateur de bureau, avec une seule carte réseau (“one-interface”).

Ce tutoriel est destiné aux personnes cherchant à mettre en place un pare-feu efficace sans se plonger dans la documentation iptables.  
Objectif : configuration pour une utilisation standard, avec tous les ports masqués et requêtes icmp (ping) ignorées.

# Commande à exécuter en root

$ Commande à exécuter en simple utilisateur

Sommaire

1- Introduction  
2- Installation  
3- Configuration  
\_3.1- /etc/shorewall/interfaces  
\_3.2- /etc/shorewall/zones  
\_3.3- /etc/shorewall/policy  
\_3.4- /etc/shorewall/rules  
4- Lancement automatique au démarrage  
5- Démarrage  
6- Commandes utiles  
7- Tester son firewall  
8- Plus d’infos sur shorewall

1\_Introduction

Shorewall (The Shoreline Firewall) est un outil puissant en ligne de commandes.  
Il permet de configurer [netfilter](http://www.netfilter.org/), le pare-feu intégré au noyau linux.  
C’est un programme libre, disponible dans les dépôts “main” de debian, qui est à mon avis plus abordable que l’écriture d’un script [iptables](http://www.netfilter.org/).

2\_Installation

- Désinstallez éventuellement firestarter:

```auto

```

- Installation de shorewall (disponible dans synaptic):

```auto

```

3\_Configuration

La configuration de shorewall passe essentiellement par quatre fichiers : interfaces, policy, zones et rules.

- Copiez provisoirement les fichiers d’exemple de configuration dans votre home:

```auto

```

```auto

```

```auto

```

Vous pouvez jeter un coup d’oeil au README.txt

- Copiez interfaces, policy, zones et rules dans le répertoire de shorewall:

```auto

```

- Effaçez le répertoire créé provisoirement dans votre home:

```auto

```

```auto

```

- Editez les fichiers de configuration pour les adapter à vos besoins:  
Il sont très commentés et contiennent de nombreuses informations, je conseille de s’y attarder.  
J’utilise [vim](http://www.vim.org/), modifiez pour utiliser votre éditeur de texte préféré.

3.1- /etc/shorewall/interfaces

```auto

```

```auto

```

(carte réseau sur laquelle shorewall filtre les paquets)  
Si votre ordinateur possède une adresse IP statique, supprimez l’option “norfc1918”.  
Sinon ne rien modifier, enregistrez / quittez.

3.2- /etc/shorewall/zones

```auto

```

(il y à deux zones, le firewall et internet)  
Ne rien modifier, enregistrez / quittez.

3.3- /etc/shorewall/policy

```auto

```

(politique par défaut du pare-feu)  
Ne rien modifier, enregistrez / quittez.  
Par défaut, shorewall ignore les paquets provenant du net a destination du firewall (connexions entrantes); et accepte les paquets provenant du firewall a destination du net (connexions sortantes).  
Cette politique convient pour un ordinateur de bureau, pour un serveur il est judicieux de bloquer également les connexions sortantes et de n’autoriser que le trafic désiré grâce au fichier rules que nous allons voir.

3.4- /etc/shorewall/rules

```auto

```

(fichier contenant les exceptions à la politique par défaut)  
Le fichier rules est le plus important. Après avoir établi une politique par défaut dans le fichier policy, le fichier rules permet de lister les exceptions vis à vis de cette politique par défaut, c’est à dire les ports que l’on souhaite ouvrir.  
A savoir avant de modifier :  
On a deux zones le “net” et le “$FW” (firewall)  
Trois actions (pour faire simple):  
ACCEPT = accepter  
REJECT = refuser  
DROP = ignorer (preferez-le à reject)  
La politique par défaut est d’ignorer toutes les connexions entrantes / d’accepter toutes les connexions sortantes.  
Une fois les modifications effectuées, enregistrez / quittez.

Exemple de configuration du fichier rules:

[code]#############################################################################################################  
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/

# PORT PORT(S) DEST LIMIT GROUP

## Ping

DROP net $FW icmp  
ACCEPT $FW net icmp

## Masquer identité

DROP net $FW tcp 113

## aMule (exemple)

#ACCEPT net $FW tcp 4662  
#ACCEPT net $FW udp 4672

## Ftp en mode passif (exemple)

#ACCEPT net $FW tcp 21  
#ACCEPT $FW net tcp 21  
#ACCEPT net $FW tcp 50000:50100  
#ACCEPT $FW net tcp 50000:50100

#LAST LINE – ADD YOUR ENTRIES BEFORE THIS ONE – DO NOT REMOVE[/code]

Explications :

- On rejette le ping venant du net a destination du firewall, et on autorise l’inverse.
- Masquer identité, permet de masquer le port 113.  
On peut aussi éditer le fichier /etc/inetd.conf et commenter la ligne suivante:  
#ident stream tcp wait identd /usr/sbin/identd identd
- aMule avec les ports par défaut.
- Ouvrir une plage de port avec l’exemple du ftp passif:  
pour ouvrir un plage de ports utilisez le symbole “:”, ici la plage de ports 50000 à 50100 est ouverte. Pour ouvrir deux ports ou plus utilisez “,” (20,21,80 par exemple).
- A la place du numéro de port vous pouvez écrire le nom du service (ftp,www par exemple).
- Vous trouverez une liste des ports et des applications qui les utilisent dans le fichier /etc/services.

4\_Activez shorewall au démarrage du système

```auto

```

et remplacez “startup=0” par “startup=1”

5\_Lancez shorewall

… 'tention les yeux, ça va démarrer ![:smt035](https://www.debian-fr.org/uploads/default/original/1X/f1c053f147b2fc1b9bea83dd822525160fa994b2.gif) , surveillez bien le log de démarrage pour vérifier l’absence d’erreur(s) lors de l’activation des règles.

```auto

```

6\_Commandes utiles

- Vérifier état de shorewall:

```auto

```

- Relancer shorewall après une modification:

```auto

```

- Afficher les 20 derniers paquets loggués:

```auto

```

- Afficher les connexions IP en cours:

```auto

```

- Remettre à zéro le conteur des bytes / paquets:

```auto

```

- Monitoring des paquets rejetés / ignorés:

```auto

```

7\_Tester son firewall

- Depuis un autre poste à l’aide de [nmap](http://insecure.org/nmap/):

```auto

```

[https://www.grc.com/x/ne.dll?bh0bkyd2](https://www.grc.com/x/ne.dll?bh0bkyd2)  
[http://probe.hackerwatch.org/probe/probe.asp](http://probe.hackerwatch.org/probe/probe.asp)

8\_Plus d’infos sur shorewall

man shorewall  
/usr/share/doc/shorewall  
/usr/share/doc/shorewall/default-config/  
[http://www.shorewall.net/](http://www.shorewall.net/)  
[http://www.shorewall.net/Documentation.htm#Rules](http://www.shorewall.net/Documentation.htm#Rules)

N’hésitez pas à apporter votre contribution à ce document.  
Vos suggestions / commentaires / corrections (insultes… 😮) sont les bienvenus.  
nc4d : nc4d(point)negundo(A)gmail(point)com

edit: correction fautes d’orthographe / de frappe.

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/2 "2016-02-20T15:44:01Z")

</div>

petit probleme avec les commande

3\_Configuration

La configuration de shorewall passe essentiellement par quatre fichiers : interfaces, policy, zones et rules.

- Copiez provisoirement les fichiers d’exemple de configuration dans votre home:

```auto
$ cp -r /usr/share/doc/shorewall/examples/one-interface ~
$ cd one-interface/
$ gzip -d interfaces.gz rules.gz

```

No such file or directory

---

<div class="post-metadata">

**Author:** ![nc4d](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/n/4da419/32.png) [@nc4d](https://www.debian-fr.org/u/nc4d)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/3 "2016-02-20T15:44:01Z")

</div>

Bonjour,  
je n’ai pas accès à mon ordinateur pour le moment, je peut pas vérifier le chemin.  
Je peut te conseiller de bien comprendre les commandes pour savoir ce que tu fait, et de vérifier “a la main” le chemin du fichier d’exemple.

Si rien n’y fait, une copie de dépannage assez ancienne de ces quatre fichiers est disponible sur mon premier tuto shorewall ici;  
[http://forum.ubuntu-fr.org/viewtopic.php?id=43496](http://forum.ubuntu-fr.org/viewtopic.php?id=43496)

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/4 "2016-02-20T15:44:03Z")

</div>

ok je lai install le seul probleme et la

`debian:~# shorewall start
Loading /usr/share/shorewall/functions...
Processing /etc/shorewall/shorewall.conf...
Loading Modules...
Starting Shorewall...
Initializing...
Shorewall has detected the following iptables/netfilter capabilities:
   NAT: Available
   Packet Mangling: Available
   Multi-port Match: Available
   Extended Multi-port Match: Not available
   Connection Tracking Match: Available
   Packet Type Match: Available
   Policy Match: Not available
   Physdev Match: Available
   IP range Match: Available
   Recent Match: Available
Determining Zones...
   Warning: Reserved zone name "fw" in zones file ignored
   Zones: net
Validating interfaces file...
Validating hosts file...
Validating Policy file...
Determining Hosts in Zones...
   ipv4 Zone: eth0:0.0.0.0/0
Pre-processing Actions...
   Pre-processing /usr/share/shorewall/action.DropSMB...
   Pre-processing /usr/share/shorewall/action.RejectSMB...
   Pre-processing /usr/share/shorewall/action.DropUPnP...
   Pre-processing /usr/share/shorewall/action.RejectAuth...
   Pre-processing /usr/share/shorewall/action.DropPing...
   Pre-processing /usr/share/shorewall/action.DropDNSrep...
   Pre-processing /usr/share/shorewall/action.AllowPing...
   Pre-processing /usr/share/shorewall/action.AllowFTP...
   Pre-processing /usr/share/shorewall/action.AllowDNS...
   Pre-processing /usr/share/shorewall/action.AllowSSH...
   Pre-processing /usr/share/shorewall/action.AllowWeb...
   Pre-processing /usr/share/shorewall/action.AllowSMB...
   Pre-processing /usr/share/shorewall/action.AllowAuth...
   Pre-processing /usr/share/shorewall/action.AllowSMTP...
   Pre-processing /usr/share/shorewall/action.AllowPOP3...
   Pre-processing /usr/share/shorewall/action.AllowICMPs...
   Pre-processing /usr/share/shorewall/action.AllowIMAP...
   Pre-processing /usr/share/shorewall/action.AllowTelnet...
   Pre-processing /usr/share/shorewall/action.AllowVNC...
   Pre-processing /usr/share/shorewall/action.AllowVNCL...
   Pre-processing /usr/share/shorewall/action.AllowNTP...
   Pre-processing /usr/share/shorewall/action.AllowRdate...
   Pre-processing /usr/share/shorewall/action.AllowNNTP...
   Pre-processing /usr/share/shorewall/action.AllowTrcrt...
   Pre-processing /usr/share/shorewall/action.AllowSNMP...
   Pre-processing /usr/share/shorewall/action.AllowPCA...
   Pre-processing /usr/share/shorewall/action.AllowSPAMD...
   Pre-processing /usr/share/shorewall/action.AllowSyslog...
   Pre-processing /usr/share/shorewall/action.AllowAmanda...
   Pre-processing /usr/share/shorewall/action.AllowLDAP...
   Pre-processing /usr/share/shorewall/action.AllowICQ...
   Pre-processing /usr/share/shorewall/action.AllowBitTorrent...
   Pre-processing /usr/share/shorewall/action.AllowSMBswat...
   Pre-processing /usr/share/shorewall/action.DropSMTP...
   Pre-processing /usr/share/shorewall/action.AllowCVS...
   Pre-processing /usr/share/shorewall/action.AllowSVN...
   Pre-processing /usr/share/shorewall/action.AllowMySQL...
   Pre-processing /usr/share/shorewall/action.AllowPostgreSQL...
   Pre-processing /usr/share/shorewall/action.AllowRsync...
   Pre-processing /usr/share/shorewall/action.AllowDistcc...
   Pre-processing /usr/share/shorewall/action.Drop...
   Pre-processing /usr/share/shorewall/action.Reject...
Deleting user chains...
Processing /etc/shorewall/routestopped ...
Creating Interface Chains...
Configuring Proxy ARP
Setting up NAT...
Setting up NETMAP...
Adding Common Rules
Adding Anti-smurf Rules
Adding rules for DHCP
Enabling RFC1918 Filtering
Setting up TCP Flags checking...
Setting up Kernel Route Filtering...
Setting up Martian Logging...
Processing /etc/shorewall/rules...
   Error: Invalid Action in rule "Ping/REJECT net $FW"
Terminated
debian:~#
`voila merci 😉

---

<div class="post-metadata">

**Author:** ![nc4d](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/n/4da419/32.png) [@nc4d](https://www.debian-fr.org/u/nc4d)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/5 "2016-02-20T15:44:05Z")

</div>

Salut,  
Cette erreur vient de la syntaxe de la règle du ping dans le fichier rules.  
Editer le fichier /etc/shorewall/rules:

```auto

```

et remplacer:

[code]# Reject Ping from the “bad” net zone… and prevent your log from being flooded…  
Ping/REJECT net $FW

# Permit all ICMP traffic FROM the firewall TO the net zone

ACCEPT $FW net icmp[/code]  
par:

`## Ping
DROP net $FW icmp
ACCEPT $FW net icmp
`  
et tout devrait rentrer dans l’ordre.

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/6 "2016-02-20T15:44:06Z")

</div>

ok sa marche

`debian:~# shorewall restart
Loading /usr/share/shorewall/functions...
Processing /etc/shorewall/shorewall.conf...
Loading Modules...
Shorewall Not Currently Running
Starting Shorewall...
Initializing...
Shorewall has detected the following iptables/netfilter capabilities:
   NAT: Available
   Packet Mangling: Available
   Multi-port Match: Available
   Extended Multi-port Match: Not available
   Connection Tracking Match: Available
   Packet Type Match: Available
   Policy Match: Not available
   Physdev Match: Available
   IP range Match: Available
   Recent Match: Available
Determining Zones...
   Warning: Reserved zone name "fw" in zones file ignored
   Zones: net
Validating interfaces file...
Validating hosts file...
Validating Policy file...
Determining Hosts in Zones...
   ipv4 Zone: eth0:0.0.0.0/0
Pre-processing Actions...
   Pre-processing /usr/share/shorewall/action.DropSMB...
   Pre-processing /usr/share/shorewall/action.RejectSMB...
   Pre-processing /usr/share/shorewall/action.DropUPnP...
   Pre-processing /usr/share/shorewall/action.RejectAuth...
   Pre-processing /usr/share/shorewall/action.DropPing...
   Pre-processing /usr/share/shorewall/action.DropDNSrep...
   Pre-processing /usr/share/shorewall/action.AllowPing...
   Pre-processing /usr/share/shorewall/action.AllowFTP...
   Pre-processing /usr/share/shorewall/action.AllowDNS...
   Pre-processing /usr/share/shorewall/action.AllowSSH...
   Pre-processing /usr/share/shorewall/action.AllowWeb...
   Pre-processing /usr/share/shorewall/action.AllowSMB...
   Pre-processing /usr/share/shorewall/action.AllowAuth...
   Pre-processing /usr/share/shorewall/action.AllowSMTP...
   Pre-processing /usr/share/shorewall/action.AllowPOP3...
   Pre-processing /usr/share/shorewall/action.AllowICMPs...
   Pre-processing /usr/share/shorewall/action.AllowIMAP...
   Pre-processing /usr/share/shorewall/action.AllowTelnet...
   Pre-processing /usr/share/shorewall/action.AllowVNC...
   Pre-processing /usr/share/shorewall/action.AllowVNCL...
   Pre-processing /usr/share/shorewall/action.AllowNTP...
   Pre-processing /usr/share/shorewall/action.AllowRdate...
   Pre-processing /usr/share/shorewall/action.AllowNNTP...
   Pre-processing /usr/share/shorewall/action.AllowTrcrt...
   Pre-processing /usr/share/shorewall/action.AllowSNMP...
   Pre-processing /usr/share/shorewall/action.AllowPCA...
   Pre-processing /usr/share/shorewall/action.AllowSPAMD...
   Pre-processing /usr/share/shorewall/action.AllowSyslog...
   Pre-processing /usr/share/shorewall/action.AllowAmanda...
   Pre-processing /usr/share/shorewall/action.AllowLDAP...
   Pre-processing /usr/share/shorewall/action.AllowICQ...
   Pre-processing /usr/share/shorewall/action.AllowBitTorrent...
   Pre-processing /usr/share/shorewall/action.AllowSMBswat...
   Pre-processing /usr/share/shorewall/action.DropSMTP...
   Pre-processing /usr/share/shorewall/action.AllowCVS...
   Pre-processing /usr/share/shorewall/action.AllowSVN...
   Pre-processing /usr/share/shorewall/action.AllowMySQL...
   Pre-processing /usr/share/shorewall/action.AllowPostgreSQL...
   Pre-processing /usr/share/shorewall/action.AllowRsync...
   Pre-processing /usr/share/shorewall/action.AllowDistcc...
   Pre-processing /usr/share/shorewall/action.Drop...
   Pre-processing /usr/share/shorewall/action.Reject...
Deleting user chains...
Processing /etc/shorewall/routestopped ...
Creating Interface Chains...
Configuring Proxy ARP
Setting up NAT...
Setting up NETMAP...
Adding Common Rules
Adding Anti-smurf Rules
Adding rules for DHCP
Enabling RFC1918 Filtering
Setting up TCP Flags checking...
Setting up Kernel Route Filtering...
Setting up Martian Logging...
Processing /etc/shorewall/rules...
   Rule "DROP net fw icmp" added.
   Rule "ACCEPT fw net icmp" added.
   Rule "DROP net fw tcp 113" added.
Processing Actions...
   Generating Transitive Closure of Used-action List...
Processing /usr/share/shorewall/action.Drop for Chain Drop...
   Rule "RejectAuth" added.
   Rule "dropBcast" added.
   Rule "AllowICMPs - - icmp" added.
   Rule "dropInvalid" added.
   Rule "DropSMB" added.
   Rule "DropUPnP" added.
   Rule "dropNotSyn - - tcp" added.
   Rule "DropDNSrep" added.
Processing /usr/share/shorewall/action.Reject for Chain Reject...
   Rule "RejectAuth" added.
   Rule "dropBcast" added.
   Rule "AllowICMPs - - icmp" added.
   Rule "dropInvalid" added.
   Rule "RejectSMB" added.
   Rule "DropUPnP" added.
   Rule "dropNotSyn - - tcp" added.
   Rule "DropDNSrep" added.
Processing /usr/share/shorewall/action.RejectAuth for Chain RejectAuth...
   Rule "REJECT - - tcp 113" added.
Processing /usr/share/shorewall/action.AllowICMPs for Chain AllowICMPs...
   Rule "ACCEPT - - icmp fragmentation-needed" added.
   Rule "ACCEPT - - icmp time-exceeded" added.
Processing /usr/share/shorewall/action.DropSMB for Chain DropSMB...
   Rule "DROP - - udp 135" added.
   Rule "DROP - - udp 137:139" added.
   Rule "DROP - - udp 445" added.
   Rule "DROP - - tcp 135" added.
   Rule "DROP - - tcp 139" added.
   Rule "DROP - - tcp 445" added.
Processing /usr/share/shorewall/action.DropUPnP for Chain DropUPnP...
   Rule "DROP - - udp 1900" added.
Processing /usr/share/shorewall/action.DropDNSrep for Chain DropDNSrep...
   Rule "DROP - - udp - 53" added.
Processing /usr/share/shorewall/action.RejectSMB for Chain RejectSMB...
   Rule "REJECT - - udp 135" added.
   Rule "REJECT - - udp 137:139" added.
   Rule "REJECT - - udp 445" added.
   Rule "REJECT - - tcp 135" added.
   Rule "REJECT - - tcp 139" added.
   Rule "REJECT - - tcp 445" added.
Processing /etc/shorewall/policy...
   Policy ACCEPT for fw to net using chain fw2net
   Policy DROP for net to fw using chain net2all
Activating Rules...
Shorewall Started
`

merci tu peux dit si les regle la son corect

je viens de fait un teste

[code]Secure  
21 (FTP)

This port is completely invisible to the outside world.

Secure  
23 (Telnet)

This port is completely invisible to the outside world.

Secure  
25 (SMTP Mail Server Port)

This port is completely invisible to the outside world.

Secure  
79 (Finger)

This port is completely invisible to the outside world.

Secure  
80 (HTTP)

This port is completely invisible to the outside world.

Secure  
110 (POP3 Mail Server Port)

This port is completely invisible to the outside world.

Secure  
139 (Net BIOS)

This port is completely invisible to the outside world.

Secure  
143 (IMAP)

This port is completely invisible to the outside world.

Secure  
443 (HTTPS)

This port is completely invisible to the outside world.

Test complete.  
No open ports were found.  
[/code]

---

<div class="post-metadata">

**Author:** ![nc4d](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/n/4da419/32.png) [@nc4d](https://www.debian-fr.org/u/nc4d)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/7 "2016-02-20T15:44:06Z")

</div>

oui, le fichier rules et le log de démarrage ont l’air corrects.

[quote]Test complete.  
No open ports were found. [/quote]  
Tout est dit, on appele cela un firewall 🙂

---

<div class="post-metadata">

**Author:** ![Yoko](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/y/58956e/32.png) [@Yoko](https://www.debian-fr.org/u/Yoko)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/8 "2016-02-20T15:44:07Z")

</div>

Quel est l’avantage de cette solution par rapport à du netfilter pur et brut?  
D’ailleurs c’est une surcouche de netfilter ou un concurent?

---

<div class="post-metadata">

**Author:** ![nc4d](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/n/4da419/32.png) [@nc4d](https://www.debian-fr.org/u/nc4d)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/9 "2016-02-20T15:44:07Z")

</div>

Bonjour,  
Ca devient trop compliqué pour moi.  
Ce que je peut dire c’est que personne n’utilise netfilter comme ca, on passe au moins par les règles iptables pour le configurer. Netfilter est le firewall linux intergré au noyau.

Donc shorewall se place plutôt en concurrent de iptables, en surcouche d’ailleurs puisque finallement la configuration de shorewall et son lancement permettent la génération de règles iptables. ( qui elles configurent netfilter 😛 )

L’avantage principal est une syntaxe plus facile que les règles iptables.

Personnellement je ne suis pas à l’aise avec iptables, pas à cause de la syntaxe, il y a pleins de tutos sur le net (qui a dit trop…), mais par rapport à ce script que personne ne place au même endroit selon les tutos, je ne connais pas assez bash pour être sur du bout de script permettant arrêt / redémarrage.  
Dans ce sens je trouve shorewall plus accessible.

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/10 "2016-02-20T15:44:09Z")

</div>

donc si j ai bien compris pour moi ajouter le port 80 443 je fait bien comme sa

```auto
## HTTPS (exemple) 
#ACCEPT net $FW tcp 443 
#ACCEPT $FW net tcp 443

 ## HTTP (exemple) 
#ACCEPT net $FW tcp 80 
#ACCEPT $FW net tcp 80

```

---

<div class="post-metadata">

**Author:** ![nc4d](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/n/4da419/32.png) [@nc4d](https://www.debian-fr.org/u/nc4d)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/11 "2016-02-20T15:44:11Z")

</div>

Bonjour,  
Non apparement cela ne va pas.  
Les lignes des fichiers de configuration linux commençant par # ne sont pas prises en compte (comme les commentaires par ex.).

Ensuite la politique par défaut de shorewall autorise tous les paquets sortants (pour faire simple), donc en génnéral les lignes autorisant traffic du firewall vers le net ne sont pas utiles, cela permet juste de mieux “visualiser” l’etat du parefeu en regardant le fichier rules.

Ce que je te conseille comme /etc/shorewall/rules selon ton exemple:

[code]## HTTP (exemple)  
ACCEPT net $FW tcp 80  
ACCEPT $FW net tcp 80

## HTTPS (exemple)

ACCEPT net $FW tcp 443  
ACCEPT $FW net tcp 443[/code]

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:44 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/12 "2016-02-20T15:44:54Z")

</div>

jai fait une nouvelle installation de debian tous marche bien sauf le firewall erreur

`debian:~# shorewall restart
Compiling...
Determining Zones...
   IPv4 Zones: net
   Firewall Zone: fw
Validating interfaces file...
Validating hosts file...
Validating Policy file...
Determining Hosts in Zones...
   net Zone: eth0:0.0.0.0/0
Pre-processing Actions...
   Pre-processing /usr/share/shorewall/action.Drop...
   Pre-processing /usr/share/shorewall/action.Reject...
   Pre-processing /usr/share/shorewall/action.Limit...
Deleting user chains...
Compiling /etc/shorewall/routestopped ...
Creating Interface Chains...
Compiling Proxy ARP
Compiling NAT...
Compiling NETMAP...
Compiling Common Rules
Adding Anti-smurf Rules
Adding rules for DHCP
Compiling TCP Flags checking...
Compiling Kernel Route Filtering...
Compiling Martian Logging...
Compiling IP Forwarding...
Compiling /etc/shorewall/rules...
Compiling Actions...
Compiling /usr/share/shorewall/action.Drop for Chain Drop...
Compiling /usr/share/shorewall/action.Reject for Chain Reject...
Compiling /etc/shorewall/policy...
Compiling Traffic Control Rules...
Validating /etc/shorewall/tcdevices...
Validating /etc/shorewall/tcclasses...
Compiling Rule Activation...
Compiling Refresh of Black List...
Validating /etc/shorewall/tcdevices...
Validating /etc/shorewall/tcclasses...
Shorewall configuration compiled to /var/lib/shorewall/.restart
   Shorewall is not running
Starting Shorewall....
Initializing...
Clearing Traffic Control/QOS
Deleting user chains...
Enabling Loopback and DNS Lookups
Creating Interface Chains...
Setting up Proxy ARP...
Setting up one-to-one NAT...
Setting up SMURF control...
Setting up Black List...
Adding Anti-smurf Jumps...
Setting up rules for DHCP...
Setting up TCP Flags checking...
Setting up ARP filtering...
Setting up Route Filtering...
   WARNING: Cannot set route filtering on eth0
Setting up Martian Logging...
   WARNING: Cannot set Martian logging on eth0
Setting up Accept Source Routing...
Setting up SYN Flood Protection...
Setting up IPSEC management...
Setting up Rules...
Setting up Actions...
Creating action chain Drop
Creating action chain Reject
Creating action chain dropBcast
Creating action chain dropInvalid
Creating action chain dropNotSyn
Applying Policies...
Setting up TC Rules...
Activating Rules...
done.
debian:~# `

connection 100 mega + routeur 😉

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:45 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/13 "2016-02-20T15:45:36Z")

</div>

quand astive le firewall e peux plus avoir le net

qui peux m aide merci nouvelle installation debian etch

tous propre depuis hier soir 😉

`debian:~# shorewall start
Compiling...
Initializing...
Determining Zones...
   IPv4 Zones: net
   Firewall Zone: fw
Validating interfaces file...
Validating hosts file...
Validating Policy file...
Determining Hosts in Zones...
   net Zone: eth0:0.0.0.0/0
Pre-processing Actions...
   Pre-processing /usr/share/shorewall/action.Drop...
   Pre-processing /usr/share/shorewall/action.Reject...
   Pre-processing /usr/share/shorewall/action.Limit...
Deleting user chains...
Compiling /etc/shorewall/routestopped ...
Creating Interface Chains...
Compiling Proxy ARP
Compiling NAT...
Compiling NETMAP...
Compiling Common Rules
Adding Anti-smurf Rules
Adding rules for DHCP
Enabling RFC1918 Filtering
Compiling TCP Flags checking...
Compiling Kernel Route Filtering...
Compiling Martian Logging...
Compiling IP Forwarding...
Compiling /etc/shorewall/rules...
Compiling Actions...
Compiling /usr/share/shorewall/action.Drop for Chain Drop...
Compiling /usr/share/shorewall/action.Reject for Chain Reject...
Compiling /etc/shorewall/policy...
Compiling Traffic Control Rules...
Validating /etc/shorewall/tcdevices...
Validating /etc/shorewall/tcclasses...
Compiling Rule Activation...
Compiling Refresh of Black List...
Validating /etc/shorewall/tcdevices...
Validating /etc/shorewall/tcclasses...
Shorewall configuration compiled to /var/lib/shorewall/.start
Starting Shorewall....
Initializing...
Clearing Traffic Control/QOS
Deleting user chains...
Enabling Loopback and DNS Lookups
Creating Interface Chains...
Setting up Proxy ARP...
Setting up one-to-one NAT...
Setting up SMURF control...
Setting up Black List...
Adding Anti-smurf Jumps...
Setting up rules for DHCP...
Setting up RFC1918 Filtering...
Setting up TCP Flags checking...
Setting up ARP filtering...
Setting up Route Filtering...
   WARNING: Cannot set route filtering on eth0
Setting up Martian Logging...
   WARNING: Cannot set Martian logging on eth0
Setting up Accept Source Routing...
Setting up SYN Flood Protection...
Setting up IPSEC management...
Setting up Rules...
Setting up Actions...
Creating action chain Drop
Creating action chain Reject
Creating action chain dropBcast
Creating action chain dropInvalid
Creating action chain dropNotSyn
Applying Policies...
Setting up TC Rules...
Activating Rules...
done.
debian:~# `

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:46 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/14 "2016-02-20T15:46:28Z")

</div>

je fait comment merci 😉

---

<div class="post-metadata">

**Author:** ![mattotop](https://www.debian-fr.org/user_avatar/www.debian-fr.org/mattotop/32/3942_2.png) [@mattotop](https://www.debian-fr.org/u/mattotop)\
**Post date:** [Février 20, 2016, 3:46 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/15 "2016-02-20T15:46:59Z")

</div>

tu as refait ce qui a fait marcher ta première installation ?

---

<div class="post-metadata">

**Author:** ![coldroom](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/c/50afbb/32.png) [@coldroom](https://www.debian-fr.org/u/coldroom)\
**Post date:** [Février 20, 2016, 3:47 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/16 "2016-02-20T15:47:11Z")

</div>

Question : Mettons que j’ai une machine qui fasse office de firewall et que derrière j’en ai une autre qui fasse office de serveur, comment, dans le cas où j’ai un serveur web, je redirige les demandes de connexions venant de l’exterieur vers la machine serveur ?

Parceque là on accèpte ou on refuse les connexion sur la machine, on ne redirige en aucun cas les paquets vers d’autre postes… y-a-t-il moyen de mettre ça en place avec shorewall ?

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:54 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/17 "2016-02-20T15:54:43Z")

</div>

re faut il ajouter une commande pour le routeur 😉

---

<div class="post-metadata">

**Author:** ![mattotop](https://www.debian-fr.org/user_avatar/www.debian-fr.org/mattotop/32/3942_2.png) [@mattotop](https://www.debian-fr.org/u/mattotop)\
**Post date:** [Février 20, 2016, 3:54 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/18 "2016-02-20T15:54:43Z")

</div>

quote="coldroom"  
Parceque là on accèpte ou on refuse les connexion sur la machine, on ne redirige en aucun cas les paquets vers d’autre postes…[/quote]Non. C’est aussi avec le “parefeu” qu’on redirige.[quote=“coldroom”] y-a-t-il moyen de mettre ça en place avec shorewall ?[/quote]Sans doutes, mais shorewall est basé sur iptables, et il vaut mieux comprendre et maitriser iptables.

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:54 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/19 "2016-02-20T15:54:46Z")

</div>

pour css 1.6 c est bon comme cela les regles

UDP 1200  
UDP 27000 à 27015  
UDP 27020 TCP 27030 à 27039  
TCP 27015

##ccs ()  
ACCEPT net $FW udp 1200  
ACCEPT $FW net udp 1200

##css ()  
ACCEPT net $FW udp 27020  
ACCEPT $FW net udp 27020

##css ()  
ACCEPT net $FW tcp 27015  
ACCEPT $FW net tcp 27015

##css ()  
ACCEPT net $FW udp 27000:27015  
ACCEPT $FW net udp 27000:27015

##css ()  
ACCEPT net $FW tcp 27030:27039  
ACCEPT $FW net tcp 27030:27039 😉😉

---

<div class="post-metadata">

**Author:** ![mafia](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@mafia](https://www.debian-fr.org/u/mafia)\
**Post date:** [Février 20, 2016, 3:56 UTC](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813/20 "2016-02-20T15:56:03Z")

</div>

personne 😢

[Page suivante](https://www.debian-fr.org/t/installation-et-configuration-de-shorewall/6813.md?page=2)
