• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

meine aktuelle firewall! Was sagt das aus??

Divine

Hacker
Hi beginne gerade damit mich mit dem Thema firewall zu beschäftigen und iptables zeigt folgendes:

linux:~ # iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-IN-ILL-TARGET '
DROP all -- anywhere anywhere

Chain FORWARD (policy DROP)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-FWD-ILL-ROUTING '

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state NEW,RELATED,ESTABLISHED
LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-OUT-ERROR '

Chain reject_func (0 references)
target prot opt source destination
REJECT tcp -- anywhere anywhere reject-with tcp-reset
REJECT udp -- anywhere anywhere reject-with icmp-port-unreachable
REJECT all -- anywhere anywhere reject-with icmp-proto-unreachable
linux:~ #

Ist das jetzt ne gute einstellung oder begehe ich damit selbstmord???

Danke im Voraus!!
 
A

Anonymous

Gast
Divine schrieb:
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
DROP all -- anywhere anywhere
Selbstmord erster Güte, wie du überhaupt nen Internetzugang hinbekommen hast, verwundert mich doch, zuerst lässt du alles zu, dann lässt du alles mit den states da oben zu, dann blockst du wieder alles
Divine schrieb:
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state NEW,RELATED,ESTABLISHED
LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-OUT-ERROR '
fast dasselbe hier
Divine schrieb:
Chain reject_func (0 references)
target prot opt source destination
REJECT tcp -- anywhere anywhere reject-with tcp-reset
REJECT udp -- anywhere anywhere reject-with icmp-port-unreachable
REJECT all -- anywhere anywhere reject-with icmp-proto-unreachable
linux:~ #
diese chain hat keinerlei Verknüpfung, absolut funktionslos und auch sinnlos, ich sehe, dass du noch viel über iptables lernen musst, hierzu das mal lesen:
http://www.pl-forum.de/t_netzwerk/iptables.html
 
OP
Divine

Divine

Hacker
danke für diese antwort, junger padawan wirklich noch viel lernen müssen!!! :lol:
 

nbkr

Guru
Das ist kein Selbstmord! Im Gegenteil es ist sogar gar nicht so schlecht für den Anfang. Man kann es zwar noch drastisch verbessern, aber das kann man immer. Was rm -rf / übersehen hat: Bei den Regeln steht nicht dabei für welches Interface (also welche Netzwerkkarte) sie gelten. Außerdem werden die Regel nach einander abgearbeit. Zuerst ein ACCEPT (mit Zusätze wie dem State) und dann ein DROP kann durchaus Sinn machen.

Das Accept all ANY ANY in der Input Chain wird für das lokale Interface sein. Das ist ok. Lokal Filtern ist unsinn.

Das zweite any any wird für die eth0 sein. Da dort der State auf related established steht ist das auch ok. Du nimmst nur das an was eine "Antwort" darstellt.

Das Drop all am ende ist auch ok aber unötig da die Policy schon auf Drop steht.

Bei Output ist es ähnlich. Any any lokal und alles nach draußen.

Die Fowardchain ist abgeklemmt, macht auch Sinn solange das keine Config für einen Router ist.

Die selbstdefinierte Chain ist nett, wird aber nirgends in den anderen 3 Chains aufgerufen. Ergo landet da auch nichts drin.

Wie gesagt, sowas kann man immer verbessern aber es ist definitiv kein Selbstmord.
 
A

Anonymous

Gast
ja selbstmord nicht gerade, aber man kann einen Kuchen auch mit 5 eiern anstatt mit 10 backen :shock: (blödes Beispiel, ich hab keine Ahnung wieviel da rein müssen)
 
OP
Divine

Divine

Hacker
ja selbstmord nicht gerade, aber man kann einen Kuchen auch mit 5 eiern anstatt mit 10 backen Shocked

ich versteh schon was du meinst! :D

@nbkr danke für diese ausführliche Meinung! Wird mir bei weiteren versuchen sehr nützlich sein!
 

Martin Breidenbach

Ultimate Guru
Bevor hier weiter rumgerätselt wird würde ich empfehlen stattdessen das Firewallskript zu posten. Dann sehen wir doch was los ist. Falls SuSEFirewall2 dann bitte ohne die Kommentare posten (das ist sonst so kilometerlang...)
 

rattle

Newbie
Wenn ich mal meine IPTABLES posten dürfte. Habe nämlich dieses Problem hier: http://www.linux-club.de/viewtopic.php?t=31222&postdays=0&postorder=asc&start=25




#!/bin/bash
# ---------------------------------------------------------------------
#
### BEGIN INIT INFO
# Provides: IP-Paketfilter
# Required-Start: $network $local_fs
# Required-Stop: $local_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# END INIT INFO
#

case "$1" in
start)
echo "Starte IP-Paketfilter"

# iptables-Modul
modprobe ip_tables
# Connection-Tracking-Module
modprobe ip_conntrack
# Das Modul ip_conntrack_irc ist erst bei Kerneln >= 2.4.19 verfuegbar
modprobe ip_conntrack_irc
modprobe ip_conntrack_ftp

# Tabelle flushen
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X

# Default-Policies setzen
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

# MY_REJECT-Chain
iptables -N MY_REJECT

# MY_REJECT fuellen
iptables -A MY_REJECT -p tcp -m limit --limit 7200/h -j LOG --log-prefix "REJECT TCP "
iptables -A MY_REJECT -p tcp -j REJECT --reject-with tcp-reset
iptables -A MY_REJECT -p udp -m limit --limit 7200/h -j LOG --log-prefix "REJECT UDP "
iptables -A MY_REJECT -p udp -j REJECT --reject-with icmp-port-unreachable
iptables -A MY_REJECT -p icmp -m limit --limit 7200/h -j LOG --log-prefix "DROP ICMP "
iptables -A MY_REJECT -p icmp -j DROP
iptables -A MY_REJECT -m limit --limit 7200/h -j LOG --log-prefix "REJECT OTHER "
iptables -A MY_REJECT -j REJECT --reject-with icmp-proto-unreachable

# MY_DROP-Chain
iptables -N MY_DROP
iptables -A MY_DROP -m limit --limit 7200/h -j LOG --log-prefix "PORTSCAN DROP "
iptables -A MY_DROP -j DROP

# Alle verworfenen Pakete protokollieren
iptables -A INPUT -m state --state INVALID -m limit --limit 7200/h -j LOG --log-prefix "INPUT INVALID "
iptables -A OUTPUT -m state --state INVALID -m limit --limit 7200/h -j LOG --log-prefix "OUTPUT INVALID "
iptables -A FORWARD -m state --state INVALID -m limit --limit 7200/h -j LOG --log-prefix "FORWARD INVALID "

# Korrupte Pakete zurueckweisen
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A OUTPUT -m state --state INVALID -j DROP
iptables -A FORWARD -m state --state INVALID -j DROP

# Stealth Scans etc. DROPpen
# Keine Flags gesetzt
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j MY_DROP
iptables -A FORWARD -p tcp --tcp-flags ALL NONE -j MY_DROP

# SYN und FIN gesetzt
iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j MY_DROP
iptables -A FORWARD -p tcp --tcp-flags SYN,FIN SYN,FIN -j MY_DROP

# SYN und RST gleichzeitig gesetzt
iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j MY_DROP
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN,RST -j MY_DROP

# FIN und RST gleichzeitig gesetzt
iptables -A INPUT -p tcp --tcp-flags FIN,RST FIN,RST -j MY_DROP
iptables -A FORWARD -p tcp --tcp-flags FIN,RST FIN,RST -j MY_DROP

# FIN ohne ACK
iptables -A INPUT -p tcp --tcp-flags ACK,FIN FIN -j MY_DROP
iptables -A FORWARD -p tcp --tcp-flags ACK,FIN FIN -j MY_DROP

# PSH ohne ACK
iptables -A INPUT -p tcp --tcp-flags ACK,PSH PSH -j MY_DROP
iptables -A FORWARD -p tcp --tcp-flags ACK,PSH PSH -j MY_DROP

# URG ohne ACK
iptables -A INPUT -p tcp --tcp-flags ACK,URG URG -j MY_DROP
iptables -A FORWARD -p tcp --tcp-flags ACK,URG URG -j MY_DROP

# Loopback-Netzwerk-Kommunikation zulassen
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

# Maximum Segment Size (MSS) für das Forwarding an PMTU anpassen
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

# Connection-Tracking aktivieren
iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i ! ppp0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# HTTPS
iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 443 -j ACCEPT

# FTP
iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 21 -j ACCEPT

# SMB
iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 137 -j ACCEPT
iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 138 -j ACCEPT
iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 139 -j ACCEPT
iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 137 -j ACCEPT
iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 138 -j ACCEPT
iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 139 -j ACCEPT

# IP-Adresse des LAN-Interfaces ermitteln
LAN_IP=$(ifconfig eth0 | head -n 2 | tail -n 1 | cut -d: -f2 | cut -d" " -f 1)


# Rechner 192.168.0.5
# ------------------------------------------------------------------------------------------------------
# NAT fuer HTTP 192.168.0.5
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.5
iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 80 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.5 --dport 80 -j ACCEPT

# NAT fuer SSH 192.168.0.5
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 22 -j DNAT --to-destination 192.168.0.5
iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 22 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.5 --dport 22 -j ACCEPT

# NAT fuer POP3 192.168.0.5
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 110 -j DNAT --to-destination 192.168.0.5
iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 110 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.5 --dport 110 -j ACCEPT

# NAT fuer SMTP 192.168.0.5
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 25 -j DNAT --to-destination 192.168.0.5
iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 25 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.5 --dport 25 -j ACCEPT

# NAT fuer DNS 192.168.0.5
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 53 -j DNAT --to-destination 192.168.0.5
iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 53 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.5 --dport 53 -j ACCEPT

iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 53 -j DNAT --to-destination 192.168.0.5
iptables -t nat -A POSTROUTING -o eth1 -p udp --dport 53 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p udp -d 192.168.0.5 --dport 53 -j ACCEPT


# Rechner 192.168.0.7
# ------------------------------------------------------------------------------------------------------

# NAT fuer FTP 192.168.0.7
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 21 -j DNAT --to-destination 192.168.0.7
iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 21 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.7 --dport 21 -j ACCEPT

# NAT fuer SSH 192.168.0.7
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 22 -j DNAT --to-destination 192.168.0.7
iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 22 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.7 --dport 22 -j ACCEPT

# NAT fuer HTTP 192.168.0.7
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.7
iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 80 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.7 --dport 80 -j ACCEPT

# NAT fuer POP3 192.168.0.7
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 110 -j DNAT --to-destination 192.168.0.7
iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 110 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.7 --dport 110 -j ACCEPT

# NAT fuer SMTP 192.168.0.7
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 25 -j DNAT --to-destination 192.168.0.7
iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 25 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.7 --dport 25 -j ACCEPT

# NAT fuer DNS 192.168.0.7
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 53 -j DNAT --to-destination 192.168.0.7
iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 53 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.7 --dport 53 -j ACCEPT

iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 53 -j DNAT --to-destination 192.168.0.7
iptables -t nat -A POSTROUTING -o eth1 -p udp --dport 53 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p udp -d 192.168.0.7 --dport 53 -j ACCEPT


# ------------------------------------------------------------------------------------------------------------

# LAN-Zugriff auf eth0
iptables -A INPUT -m state --state NEW -i eth0 -j ACCEPT

# Default-Policies mit REJECT
iptables -A INPUT -j MY_REJECT
iptables -A OUTPUT -j MY_REJECT
iptables -A FORWARD -j MY_REJECT

# Routing
echo 1 > /proc/sys/net/ipv4/ip_forward 2> /dev/null

# Masquerading
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

# SYN-Cookies
echo 1 > /proc/sys/net/ipv4/tcp_syncookies 2> /dev/null

# Stop Source-Routing
for i in /proc/sys/net/ipv4/conf/*; do echo 0 > $i/accept_source_route 2> /dev/null; done

# Stop Redirecting
for i in /proc/sys/net/ipv4/conf/*; do echo 0 > $i/accept_redirects 2> /dev/null; done

# Reverse-Path-Filter
for i in /proc/sys/net/ipv4/conf/*; do echo 2 > $i/rp_filter 2> /dev/null; done

# Log Martians
for i in /proc/sys/net/ipv4/conf/*; do echo 1 > $i/log_martians 2> /dev/null; done

# BOOTP-Relaying ausschalten
for i in /proc/sys/net/ipv4/conf/*; do echo 0 > $i/bootp_relay 2> /dev/null; done

# Proxy-ARP ausschalten
for i in /proc/sys/net/ipv4/conf/*; do echo 0 > $i/proxy_arp 2> /dev/null; done

# Ungültige ICMP-Antworten ignorieren
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses 2> /dev/null

# ICMP Echo-Broadcasts ignorieren
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts 2> /dev/null

# Max. 500/Sekunde (5/Jiffie) senden
echo 5 > /proc/sys/net/ipv4/icmp_ratelimit

# Speicherallozierung und -timing für IP-De/-Fragmentierung
echo 262144 > /proc/sys/net/ipv4/ipfrag_high_thresh
echo 196608 > /proc/sys/net/ipv4/ipfrag_low_thresh
echo 30 > /proc/sys/net/ipv4/ipfrag_time

# TCP-FIN-Timeout zum Schutz vor DoS-Attacken setzen
echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout

# Maximal 3 Antworten auf ein TCP-SYN
echo 3 > /proc/sys/net/ipv4/tcp_retries1

# TCP-Pakete maximal 15x wiederholen
echo 15 > /proc/sys/net/ipv4/tcp_retries2

;;

stop)
echo "Stoppe IP-Paketfilter"
# Tabelle flushen
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X
echo "Deaktiviere IP-Routing"
echo 0 > /proc/sys/net/ipv4/ip_forward

# Default-Policies setzen
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
;;

status)
echo "Tabelle filter"
iptables -L -vn
echo "Tabelle nat"
iptables -t nat -L -vn
echo "Tabelle mangle"
iptables -t mangle -L -vn
;;

*)
echo "Fehlerhafter Aufruf"
echo "Syntax: $0 {start|stop|status}"
exit 1
;;

esac

Ihr habt da aj mehr Ahnung. Vielleicht findet ihr einen Fehler. Danke.
 

Martin Breidenbach

Ultimate Guru
Sorry aber wieso postest Du das dann hier ?

Für separate Probleme bitte IMMER separate Threads aufmachen.

Sonst blickt hier einfach keiner mehr durch was sich auf was bezieht.

Mehrere Threads zum *gleichen' Problem haben wir auch nicht gerne - das zerstreut die zur Verfügung stehenden Informationen zum Problem.

P.S. Mal abegesehen davon... was soll den das da:
# NAT fuer SSH 192.168.0.5
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 22 -j DNAT --to-destination 192.168.0.5

# NAT fuer SSH 192.168.0.7
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 22 -j DNAT --to-destination 192.168.0.7
 

rattle

Newbie
Ja ich dachte mal eben ich poste meine iptables weil du es in deinem vorletzten Post vorgeschlagen hattest. Hattest zwar jemand anders gemeint aber da ich nicht ständig neue Threads aufmachen möchte habe ich es hier reingestellt. Ihr hattet ja gerade das Thema. Ausserdem habe ich gehofft ein paar von euch Experten sind hier eh gerade am posten also pack ich mein Zeug gleich dazu. Vielleicht findet ihr was verbesserungwürdiges.

Das was du da bemängelst ist ne alte Portweiterleitung für SSH. Hatte ich mal vor 2 Jahren oder so da reingepackt. Wieso was ist damit?
 

Martin Breidenbach

Ultimate Guru
Wir möchten hier aber für jedes Problem einen eigenen Thread. Die Threads werden sonst absolut unübersichtlich.

Das was du da bemängelst ist ne alte Portweiterleitung für SSH. Hatte ich mal vor 2 Jahren oder so da reingepackt. Wieso was ist damit?

Na... welcher der beiden Befehle soll denn nun gelten ? Du kannst eingehende Pakete auf Port 22 nur zu einem Rechner umleiten.
 
A

Anonymous

Gast
und überhaupt ist das ganze script übervoll mit unnötigen regeln, es reicht, Forwarding zu aktivieren, und dann alle nötigen Dienste einfach aud FORWARD zu erlauben, ein DNAT oder SNAT ist völlig unnötig, und stellt auch sehr wahrscheinlich das Problem dar.
Übrigens würde ich ein generelles
Code:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
setzen, das erhöht die Sicherheit ein bischen, da alle Internet-Pcs denken, die Pakete kommen von deinem Router.... :D
 

rattle

Newbie
rm -rf / schrieb:
Übrigens würde ich ein generelles
Code:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
setzen, das erhöht die Sicherheit ein bischen, da alle Internet-Pcs denken, die Pakete kommen von deinem Router.... :D
Nachdem ich das getan habe ging gar nichts mehr. Sorry aber dieser Vorschlag funktioniert bei mir nicht.

Du meinst so:

Beispiel:

# NAT fuer HTTP 192.168.0.7
# iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.7
# iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 80 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.7 --dport 80 -j ACCEP

Funktioniert zwar aber ob das sicherer ist.
 
A

Anonymous

Gast
rattle schrieb:
Nachdem ich das getan habe ging gar nichts mehr. Sorry aber dieser Vorschlag funktioniert bei mir nicht.
dann fehlt dir ein wichtiges kernelmodul....is aber schlecht, wenn das ned dabei is o_0
rattle schrieb:
Du meinst so:

Beispiel:

# NAT fuer HTTP 192.168.0.7
# iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.7
# iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 80 -j SNAT --to-source $LAN_IP
iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.0.7 --dport 80 -j ACCEP

Funktioniert zwar aber ob das sicherer ist.
nö....hab ich nie behauptet, ich und martin b. haben gesagt, dass es sinnlos ist, ports überhaupt zu dnatten und zu snatten, das ist exakt 3-fache arbeit für den router, die sich ganz einfach mit einem einzigen schritt erledigen lässt
Routing aktivieren und dann einfach auf eth per FORWARD alles erlauben, was notwendig ist
das:
Code:
# iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.7
# iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 80 -j SNAT --to-source $LAN_IP
sind 2 unnötige zeilen, die alles nur verlangsamen. Jetzt verstanden?
 

rattle

Newbie
Zu 1. Benutze noch die Suse 8.1. Kernel 2.4.19 ist ja auch nicht der neueste.

Zu 2. Klar verstanden, aber mir geht es ja hauptsächlich um die Sicherheit, deswegen der Linux-Router.
Danke euch trotzdem. Werde die tables mal überarbeiten.

PS: Wobei ich trotz allem immer noch diese ominöse Fehlermeldung beim booten erhalte und das ganze ca. 12-13x hintereinander.
Try iptables- h or iptables --help for more information
iptables v 1.2.7a: Bad IP Adress `1500´

Keinen Ahnung was die Pinguinsoftware damit meint.
 

framp

Moderator
Teammitglied
Sieht recht interessant aus. Allerdings solltest Du vielleicht mal deine Topologie posten.

Was ich so aus dem Script entnehme ist:

1) Du hast einen WebServer, einen ftp server und einen samba server, der vom internet erreichbar sein soll auf Deinem Rechner laufen. Ich glaube nicht dass es das ist was Du willst. Da mit ftp kann so nicht klappen, da fehlt noch diverses - ftp ist da etwas eigenwillig
2) Du hast einen Rechner 192.168.0.5 der folgende Services anbietet und nutzt: http sshd, pop3, smtp, dns
3) Du hast einen rechner 192.168.0.7 der folgende Services anbietet und nutzt: ftp, sshd, http, pop3, smtp und dns

Ich glaube nicht dass es das ist was Du willst. So wie es aussiehst willst Du nur von Deinen Clients keine Server anbieten sondern nur auf Server zugreifen also webbroswer(http), ftp, ssh, mail abholen(pop3) und mail senden (smtp) machen und dns lookups erlauben. Weil Du keine Server bei Deinen Clients anbietest gibt das auch kein Problem wg der doppelten dnats.

Wie schon vorgeschlagen reicht ein masquerading und allgemeines forwarding fuer http, ssh, pop3, smtp und dns. Fuer ftp sieht es nicht so einfach aus. Wuerde ich auch nicht nutzen. Zu unsicher (plain PW). scp ist besser (Port 22). Die Freigaben auf den Linuxrechner fuer diese Dinge sind absolut unnoetig und u.U. auch gefaehrlich. SMB ports sind sehr beliebt bei ScriptKiddies. Aber ich galube kaum dass sich da ein SMB hinter verbirgt, oder? Und ich denke auch nicht, dass Du fuer Deine Clients die SMB Ports forwarden bzw natten willst. Das ist die beste Art und Weise jemandem vom Internet auf seinen Rechner zugreifen zu lassen.

Ich sehe im Moment keine sicherheitsrelevanten Probleme - aber diverse nutzlose rules die ich der Klarheit wegen entfernen wuerde.
 

rattle

Newbie
Naja wie schon gesagt der Samba ist aus einer früheren Zeit. Den hatte ich nur zu Testzwecken ein paar Monate laufen und brauch ihn eigentlich nicht mehr.
Ich habe 2 Webserver und deshalb die Dienste.
Rechner 192.168.0.5 beinhaltet einen WS
Rechner 192.168.0.7 ebenso.
Das Masquerade Problem scheint ja ein Problem meiner älteren Suse Version zu sein und nicht änderbar.
Mit FTP hatte ich eigentlich fast keine Probleme bis jetzt.
Ich versuche nur heraus zufinden was die Fehlermeldung bedeutet. Habe noch mal kurz die Syntax durchgeschaut aber keine Schreibfehler gefunden. Diese Fehlermeldung kommt ja auch nicht von Anfang an. Ich hatte mal etwas geändert vor ein paar Monaten und seid dem scheint es dieses Problem zu geben. Allerding konnte ich bis jetzt keine Nachteile erkennen. Mir ist das aber erst vor kurzem aufgefallen da ich in der Regel kein Monitor, Maus und Tastatur am Router dran habe. Wollte eigentlich nur nen Monitor eines Kunden testen und da hab ich ihn spontan mal an meine Router angeschlossen und beim Neustarten des Routers fiel mir diese Fehlermeldung auf.

Achso der Aufbau des Netzwerkes:
Internet -> Splitter -> DSL-Modem -> Linux-Router -> Hardware-Router D-Link 601 (fungiert nur als Switch) -> 2 XP-Rechner.
eth0 - 192.168.0.10 Internes Netzwerk
eth1 - dhcp Internet
Hoffe du meinst das so ungefähr.
 

framp

Moderator
Teammitglied
Nicht ganz ;-)

Etwas mehr so:

Router ---- Host 1
!
+--- Host 2

Das ist wohl Deine Topologie.

Dann

Router Server services to internet: SMB, http,

Host 1 Server services to internet: HTTP
Client services from internet: pop3, dhcp, smtp, ftp, ssh

Host 2 Server services to internet: HTTP
Client services from internet: pop3, dhcp, smtp, ftp, ssh

Hast Du wirklich 2 HTTP Server, die beide auf port 80 reagieren? Dann koennen die aber mit Deinen Rules aus dem Internet nicht beide erreichbar sein. Du sagst da alles was auf port 80 ankommt soll auf client 1 UND client 2 natted werden. Das geht nicht. Die muessen dazu unterschiedliche ports haben. Oder hast Du einen DNS Sprayer auf Deinem Router? Denke wohl nicht.
 

rattle

Newbie
Habe einen Rechner als Testumgebung und einen im Einsatz. Da ich auf beiden dasselbe brauche sind die Einstellungen so.
Mittlerweile kann man die Dienste SMB und SSH weglassen. Das ist alter Kram Rechner 192.168.0.5. läuft als Test und selten. Manchmal stöpsel ich dort mein Lappi ran.
Der 192.168.0.7 läuft immer. Es funktioniert ja auch alles. Nur die Meldung verwirrt mich.
 
Oben