|
| |
Firewalling mit Iptables unter GNU/Linux
Administration : Firewalling :
Iptables : Übersicht
20-Nov-2004/09-Jan-07
Übersicht
Betreiben einer Firewall mit Iptables unter GNU/Linux.
Beispielskript
Dieses Beispielskript kann aus Ausgangsbasis für eigene Firewallregeln
genutzt werden. Es muss unter /etc/init.d
abgelegt werden; zusätzlich müssen noch Symlinks im Verzeichnis des
benutzten Runlevels angelegt werden.
#!/bin/sh
# Schnittstelle zum lokalen Netzwerk
IFACE_INT=eth0
# Internetschnittstelle - "ippp+" für ISDN
IFACE_EXT=ppp+
# Loopback device - bedraf keiner Anpassung
IFACE_LO=lo
# ************
# * POLICIES *
# ************
# Zurücksetzen der Konfiguration
iptables -F
iptables -t nat -F
iptables -X
iptables -t nat -X
# Default-Policies setzen - alles fliegt raus
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
# Einschalten von ip-Forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
# *********
# * INPUT *
# *********
# Soll nicht sein
iptables -A INPUT -p TCP ! --syn -m state --state NEW -j DROP
# Vom internen Netz alles erlauben
iptables -A INPUT -i $IFACE_INT -j ACCEPT
# Vom Loopback Alles erlauben
iptables -A INPUT -i $IFACE_LO -j ACCEPT
# Vom Internet: Darf nicht sein
iptables -A INPUT -i $IFACE_EXT -s 10.0.0.0/8 -j DROP
iptables -A INPUT -i $IFACE_EXT -s 172.16.0.0/12 -j DROP
iptables -A INPUT -i $IFACE_EXT -s 192.168.0.0/24 -j DROP
# Vom Internet Erlauben von bereits initialisierten Verbindungen
iptables -A INPUT -i $IFACE_EXT -m state \
--state ESTABLISHED,RELATED -j ACCEPT
# ***********
# * FORWARD *
# ***********
# Wegen der Telekom
iptables -I FORWARD -p TCP --tcp-flags SYN,RST SYN -j TCPMSS
--clamp-mss-to-pmtu
# Lokal -> Internet: Alles erlauben
iptables -A FORWARD -i $IFACE_INT -o $IFACE_EXT -j ACCEPT
# Internet -> Lokales: Nur Verkehr über bereits bestehende Verbindungen
erlauben
iptables -A FORWARD -i $IFACE_EXT -o $IFACE_INT -m state \
--state ESTABLISHED,RELATED -j ACCEPT
# **********
# * OUTPUT *
# **********
# Ins lokale Netzwerk: Alles erlauben
iptables -A OUTPUT -o $IFACE_INT -j ACCEPT
# Ans Loopback: Alles erlauben
iptables -A OUTPUT -o $IFACE_LO -j ACCEPT
# Ins Internet : Alles erlauben
iptables -A OUTPUT -o $IFACE_EXT -j ACCEPT
# Masquerading
iptables -A POSTROUTING -o $IFACE_EXT -t nat -j MASQUERADE
# Den Rest mitprotokollieren
iptables -A OUTPUT -j LOG --log-prefix "Nicht raus: "
iptables -A FORWARD -j LOG --log-prefix "Nicht durch: "
iptables -A INPUT -j LOG --log-prefix "Nicht rein: "
Quelle: Benutzer glatzor (Debianforum.de)
Literatur
Linux iptables Pocket Reference
von Gregor N. Purdy
Sprache: Englisch
Broschiert - 91 Seiten - O'Reilly & Associates
Erscheinungsdatum: 1. August 2004
ISBN: 0596005695
Preis: EUR 8,49
Synopsis: Firewalls, Network Address Translation (NAT), and
network logging and accounting are all provided by Linux's Netfilter
system, also known by the name of the command used to administer it,
iptables. The iptables interface is the most sophisticated ever
offered on Linux and makes Linux an extremely flexible system for
any kind of network filtering you might do. Large sets of filtering
rules can be grouped in ways that makes it easy to test them and
turn them on and off. Do you watch for all types of ICMP
traffic--some of them quite dangerous? Can you take advantage of
stateful filtering to simplify the management of TCP connections?
Would you like to track how much traffic of various types you get?
This pocket reference will help you at those critical moments when
someone asks you to open or close a port in a hurry, either to
enable some important traffic or to block an attack. The book will
keep the subtle syntax straight and help you remember all the values
you have to enter in order to be as secure as possible. The listings
of all iptables options are divided into those suitable for
firewalling, accounting, and NAT.
Netmarks
Krnlpanic.com: How to use IP Tables (Linux Help),
krnlpanic.com/tutorials/iptables.php.
UnixReview.com: Using iptables, April 2001, von Joe
"Zonker" Brockmeier,
www.unixreview.com/documents/s=1236/urm0104l/0104l.htm.
JustLinux.com: Help File Library: Iptables Basics, von
Prince_Kenshi,
www.justlinux.com/nhf/Security/IPtables_Basics.html.
Debianforum.de: Firewallscripts,
www.debianforum.de/forum/viewtopic.php?t=3419.
Forum mit kommentierten, Debian-spezifischen Beispielsskripts und
Diskussion.
James C. Stephens: Iptables,
www.sns.ias.edu/~jns/security/iptables.
Einige kommentierte Beispielskripts.
James C. Stephens: Connection tracking,
www.sns.ias.edu/~jns/security/iptables/iptables_conntrack.html.
»Connection tracking refers to the ability to maintain
state information about a connection in memory tables, such as
source and destination ip address and port number pairs (known as
socket pairs), protocol types, connection state and timeouts.
Firewalls that do this are known as stateful. Stateful firewalling
is inherently more secure than its "stateless" counterpart ....
simple packet filtering. Connection tracking is accomplished with
the state option in iptables«.
Harald Welte: Netfilter connection tracking and nat helper
modules, Version 1.2, 2000/10/14 20:37:53,
gnumonks.org/ftp/pub/doc/conntrack+nat.html.
Anmerkungen
| |
Iptables: |
|
Name: Besucher.
Online: 8 aktive User.
|
| Login |
Logout
|
|
|
Benachrichtigen bei Änderungen: |
|
|
|
|
Debian GNU/Linux 3.1 »Sarge«,
mit Debian-Anwenderhandbuch.

DVD-ROM +
Bonus-DVD
EUR
49,90
(versandkostenfrei)
|
Debian GNU/Linux Power Pack.
von
Peter H. Ganten und
Wulf Alex.

946 Seiten, zwei DVDs
EUR 69,95
(versandkostenfrei) |
Ubuntu: |
Ubuntu/Kubuntu 5.10,
mit Handbuch.

EUR
29,90
(versandkostenfrei)
|
SuSE
Linux: |
SUSE
Linux 10.0 deutsch.
von Novell

EUR
48,95
(versandkostenfrei)
|
SuSE
Linux 9.3 Professional
von Novell.

EUR
82,99
(versandkostenfrei)
|
SuSE
Linux 9.3 Professional Update.
von Novell

EUR 59,95
(versandkostenfrei) |
Red
Hat Linux: |
|
Red Hat Linux
Professional Workstation.

EUR 99,95
(versandkostenfrei)
|
Red Hat Linux 9 Personal.
Red Hat Linux 9 Professional.

ab EUR 39,99
(versandkostenfrei) |
|
 |
Thematisch verwandte Subsites:
Apple,
BSD,
Hardware,
Internet,
Microsoft Windows,
Networking,
Open Content,
Open Source & Free Software,
Politik,
Recht,
Safety,
Security,
Shopping,
Software,
The Tark,
Webworking,
Wissen. |
 |
|
|