Autor Thema: Shorewall installieren und konfigurieren  (Gelesen 21190 mal)

Wolfgang Seiringer

  • Global Moderator
  • Voll drauf
  • *****
  • Beiträge: 271
  • Karma: +17/-0
    • Profil anzeigen
Shorewall installieren und konfigurieren
« am: Januar 12, 2008, 16:05:55 »
Hallo!

Ich habe mich die letzten paar Tage intensiv mit verschiedenen Firewalls und auch iptables auseinandergesetzt.

Letztendlich bin ich auf das Programm Shorewall (http://www.shorewall.net/) gestoßen.

Im Debian (und auch Ubuntu) ist es ganz einfach installiert mit

aptitude install shorewall
Die Default-Config muss erst in das richtige Verzeichnis (/etc/shorewall) kopiert werden. In Debian Lenny liegt die Config im Gegensatz zu Ubuntu und Debian Etch unter /usr/share/doc/shorewall-common/default-config/.

cd /usr/share/doc/shorewall/default-config/
cp interfaces rules zones policy /etc/shorewall

Anschließend müssen noch die folgenden Config-Files editiert werden:

In der Datei /etc/shorewall/interfaces wird die Netzwerkkarte und die Broadcast Adresse eingestellt.

###############################################################################
#ZONE INTERFACE BROADCAST       OPTIONS
net     eth0            192.168.0.255       tcpflags
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE

In der Datei /etc/shorewall/policy wird die grundlegende Konfiguration der einzelnen Verbindungen festgelegt. $FW bezeichnet den verwendeten PC selbst und net ist unsere Netzwerkkarte wie in /etc/shorewall/interfaces angegeben.
Die folgende Konfiguration erlaubt den PC auf allen Ports nach aussen zu senden, aber alle eingehenden Anfragen zu verwerfen.

###############################################################################
#SOURCE DEST POLICY LOG LIMIT:BURST
# LEVEL
$FW all ACCEPT info
net all DROP info
all all DROP          info
#LAST LINE -- DO NOT REMOVE

In der Datei /etc/shorewall/zones muss folgendes eingestellt werden.

###############################################################################
#ZONE TYPE OPTIONS IN OUT
# OPTIONS OPTIONS
fw firewall
net ipv4
#LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE

In der Datei /etc/shorewall/rules können dann einzelne Ports behandelt werden. Das folgende Beispiel zeigt auf 2 verschiedene Varianten wie der SSH-Port (Port 22) zugelassen werden kann.
#######################################################################################################
#ACTION SOURCE          DEST     PROTO   DEST    SOURCE          ORIGINAL        RATE            USER/
#                                        PORT(S) PORT(S)         DEST            LIMIT           GROUP
#SECTION ESTABLISHED
#SECTION RELATED
SECTION NEW

#Variante 1 mit Macros
SSH/ACCEPT  net     $FW

#Variante 2 mit der Portnummer
ACCEPT  net     $FW     tcp    22

#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE

Welche Macros zur Verfügung stehen kann man leicht mit folgendem Befehl herausfinden:

shorewall show macros
Danach muss noch die Firewall gestartet werden.

shorewall safe-start
Sollte sie bereits laufen, hilft der folgende Befehl.

shorewall safe-restart
Sobald die Firewall getestet ist, muss sie nur mehr beim Starten des PCs mitgestartet werden.
Dazu muss die Datei /etc/default/shorewall abgeändert weren:

startup=1
Das wars, damit sollten Sie sicherer sein, als zuvor.
Falls noch jemand Verbesserungsvorschläge hat, wäre ich sehr dankbar.

Wolfgang
Diese Message wurde erstellt mit freundlicher Unterstützung eines freilaufenden Pinguins aus artgerechter Haltung.

smuso

  • Neu hier
  • *
  • Beiträge: 1
  • Karma: +0/-0
    • Profil anzeigen
Re: Shorewall installieren und konfigurieren
« Antwort #1 am: Juni 07, 2010, 18:09:01 »
hy

habe deine Anleitung gesehen, und diese Ausprobiert. Funktioniert leider nicht bei mir.

root@dreamexchange /etc/shorewall > shorewall safe-start
Compiling...
Initializing...
Determining Zones...
   IPv4 Zones: net
   Firewall Zone: fw
Validating interfaces file...
Validating hosts file...
Pre-processing Actions...
   Pre-processing /usr/share/shorewall/action.Drop...
   Pre-processing /usr/share/shorewall/action.Reject...
Validating Policy file...
Determining Hosts in Zones...
   net Zone: veneto:0.0.0.0/0
Deleting user chains...
Compiling /etc/shorewall/routestopped ...
Creating Interface Chains...
Compiling Common Rules
Compiling TCP Flags checking...
Compiling Kernel Route Filtering...
Compiling Martian Logging...
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...
Compiling Rule Activation...
Compiling IP Forwarding...
Shorewall configuration compiled to /var/lib/shorewall/.start
Starting...
Starting Shorewall....
Initializing...
Clearing Traffic Control/QOS
Deleting user chains...
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
ip6tables v1.4.2: can't initialize ip6tables table `filter': iptables who? (do you need to insmod?)
Perhaps ip6tables or your kernel needs to be upgraded.
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
ip6tables v1.4.2: can't initialize ip6tables table `filter': iptables who? (do you need to insmod?)
Perhaps ip6tables or your kernel needs to be upgraded.
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
ip6tables v1.4.2: can't initialize ip6tables table `filter': iptables who? (do you need to insmod?)
Perhaps ip6tables or your kernel needs to be upgraded.
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
ip6tables v1.4.2: can't initialize ip6tables table `filter': iptables who? (do you need to insmod?)
Perhaps ip6tables or your kernel needs to be upgraded.
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
ip6tables v1.4.2: can't initialize ip6tables table `filter': iptables who? (do you need to insmod?)
Perhaps ip6tables or your kernel needs to be upgraded.
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
ip6tables v1.4.2: can't initialize ip6tables table `filter': iptables who? (do you need to insmod?)
Perhaps ip6tables or your kernel needs to be upgraded.
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
ip6tables v1.4.2: can't initialize ip6tables table `filter': iptables who? (do you need to insmod?)
Perhaps ip6tables or your kernel needs to be upgraded.
Enabling Loopback and DNS Lookups
Creating Interface Chains...
Setting up SMURF control...
Setting up Black List...
Setting up TCP Flags checking...
Setting up ARP filtering...
Setting up Route Filtering...
Setting up Martian Logging...
Setting up Accept Source Routing...
Setting up SYN Flood Protection...
Setting up Rules...
Setting up Actions...
Creating action chain Drop
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
Creating action chain Reject
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.7/modules.dep: No such file or directory
Creating action chain dropBcast
Creating action chain dropInvalid
Creating action chain dropNotSyn
Applying Policies...
Activating Rules...
done.
Do you want to accept the new firewall configuration? [y/n]

hat wer eine Idee wie ich die Shorwall zum läufen bringe?

Ist ein VPS Server

mfg