PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Iptables starten nicht!



rallan
12.04.02, 12:47
Hallo Tuxer!
Da mein System jetzt läuft, wollte ich mich ein wenig um die Sicherheit kümmern. Ich habe das Programm Firestarter und die iptables installiert, nur wollen die iptables nicht starten! :-( Beim hochfahren kommt dann immer die Meldung, dass es zwar versucht wird, aber wohl nicht klappt!
Habe alles so eingestellt, dass es beim booten starten soll, nur iptables will nicht so recht.
Kann mir bitte einer helfen. Danke schon mal.

hmflesch
12.04.02, 13:13
Hallo,

welche Meldung bekommst du denn genau?

Gruß
Martin

rallan
12.04.02, 13:21
kommt die Meldung "invalid Mask"

hmflesch
12.04.02, 13:28
ok,

poste oder maile mal das Script...

Martin

Newbie2001
12.04.02, 13:34
d.h. das du irgendwo eine ungültige Netzmaske gesetzt hast (kann auch ein Schreibfehler sein). Prüfe mal alle Netzmasken die du verwendet in dem Skript auf Gültigkeit und Schreibfehler

rallan
12.04.02, 13:35
#!/bin/sh
#
# Startup script to implement /etc/sysconfig/iptables pre-defined rules.
#
# chkconfig: 2345 03 92
#
# description: Automates a packet filtering firewall with iptables.
#
# by bero@redhat.com, based on the ipchains script:
# Script Author: Joshua Jensen <joshua@redhat.com>
# -- hacked up by gafton with help from notting
# modified by Anton Altaparmakov <aia21@cam.ac.uk>:
# modified by Nils Philippsen <nils@redhat.de>
#
# config: /etc/sysconfig/iptables

# Source 'em up
. /etc/init.d/functions

IPTABLES_CONFIG=/etc/sysconfig/iptables

if [ ! -x /sbin/iptables ]; then
exit 0
fi

KERNELMAJ=`uname -r | sed -e 's,\..*,,'`
KERNELMIN=`uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,'`

if [ "$KERNELMAJ" -lt 2 ] ; then
exit 0
fi
if [ "$KERNELMAJ" -eq 2 -a "$KERNELMIN" -lt 3 ] ; then
exit 0
fi



if /sbin/lsmod 2>/dev/null |grep -q ipchains ; then
# Don't do both
exit 0
fi

start() {
# don't do squat if we don't have the config file
if [ -f $IPTABLES_CONFIG ]; then
# We do net need to flush/clear anything if using iptables-restore
gprintf "Applying iptables firewall rules: \n"
grep -v "^[[:space:]]*#" $IPTABLES_CONFIG | grep -v '^[[:space:]]*$' | /sbin/iptables-restore -c && \
success "Applying iptables firewall rules" || \
failure "Applying iptables firewall rules"
echo
touch /var/lock/subsys/iptables
fi
}

stop() {
chains=`cat /proc/net/ip_tables_names 2>/dev/null`
for i in $chains; do iptables -t $i -F; done && \
success "Flushing all chains:" || \
failure "Flushing all chains:"
for i in $chains; do iptables -t $i -X; done && \
success "Removing user defined chains:" || \
failure "Removing user defined chains:"
gprintf "Resetting built-in chains to the default ACCEPT policy:"
iptables -P INPUT ACCEPT && \
iptables -P OUTPUT ACCEPT && \
iptables -P FORWARD ACCEPT && \
iptables -t nat -P PREROUTING ACCEPT && \
iptables -t nat -P POSTROUTING ACCEPT && \
iptables -t nat -P OUTPUT ACCEPT && \
iptables -t mangle -P PREROUTING ACCEPT && \
iptables -t mangle -P OUTPUT ACCEPT && \
success "Resetting built-in chains to the default ACCEPT policy" || \
failure "Resetting built-in chains to the default ACCEPT policy"
echo
rm -f /var/lock/subsys/iptables
}

case "$1" in
start)
start
;;

stop)
stop
;;

restart|reload)
# "restart" is really just "start" as this isn't a daemon,
# and "start" clears any pre-defined rules anyway.
# This is really only here to make those who expect it happy
start
;;

condrestart)
[ -e /var/lock/subsys/iptables ] && start
;;

status)
chains=`cat /proc/net/ip_tables_names 2>/dev/null`
for i in $chains; do
gprintf "Table: %s\n" "$i"
iptables -t $i --list
done
;;

panic)
gprintf "Changing target policies to DROP: "
iptables -P INPUT DROP && \
iptables -P FORWARD DROP && \
iptables -P OUTPUT DROP && \
iptables -t nat -P PREROUTING DROP && \
iptables -t nat -P POSTROUTING DROP && \
iptables -t nat -P OUTPUT DROP && \
iptables -t mangle -P PREROUTING DROP && \
iptables -t mangle -P OUTPUT DROP && \
success "Changing target policies to DROP" || \
failure "Changing target policies to DROP"
echo
iptables -F INPUT && \
iptables -F FORWARD && \
iptables -F OUTPUT && \
iptables -t nat -F PREROUTING && \
iptables -t nat -F POSTROUTING && \
iptables -t nat -F OUTPUT && \
iptables -t mangle -F PREROUTING && \
iptables -t mangle -F OUTPUT && \
success "Flushing all chains:" || \
failure "Flushing all chains:"
iptables -X INPUT && \
iptables -X FORWARD && \
iptables -X OUTPUT && \
iptables -t nat -X PREROUTING && \
iptables -t nat -X POSTROUTING && \
iptables -t nat -X OUTPUT && \
iptables -t mangle -X PREROUTING && \
iptables -t mangle -X OUTPUT && \
success "Removing user defined chains:" || \
failure "Removing user defined chains:"
;;

save)
gprintf "Saving current rules to %s: " "$IPTABLES_CONFIG"
touch $IPTABLES_CONFIG
chmod 600 $IPTABLES_CONFIG
/sbin/iptables-save -c > $IPTABLES_CONFIG 2>/dev/null && \
success "Saving current rules to %s" "$IPTABLES_CONFIG" || \
failure "Saving current rules to %s" "$IPTABLES_CONFIG"
echo
;;

*)
gprintf "Usage: %s {start|stop|restart|condrestart|status|panic|save} \n" "$0"
exit 1
esac

exit 0


kannst Du damit was anfangen?

hmflesch
12.04.02, 13:41
...das möchte ich mal in Ruhe lesen und nicht nur überfliegen ;-)

rallan
13.04.02, 08:52
, warum ich die Fehlermeldungen bekomme?
Mein System wird dann auch verdammt langsam! :-((

hmflesch
13.04.02, 12:57
Moin,

was steht in /etc/sysconfig/iptables ?

Martin

rallan
14.04.02, 08:38
befindet sich nichts mit iptables! :-(( Ich habe aber bemerkt, dass es am Programm Firestarter liegen muss, denn lasse ich es beim Start weg, so ist auch die Fehlermeldung weg! Ist es denn normal, dass die iptables nach dem Start gestoppt werden, oder müssen die immer laufen?
Gibt es denn eine Firewall die ich einfach konfigurieren kann wie zB Zone Alarm unter Win? Ausprobiert habe ich schon FWbuilder, Firestarter, gfcc! Aber so richtig bekomme ich nichts ans laufen! :-((

hmflesch
15.04.02, 07:55
Original geschrieben von rallan
befindet sich nichts mit iptables! :-((

Das ist merkwürdig, da es ja explizit als Config-Variable eingefügt wird...


Ich habe aber bemerkt, dass es am Programm Firestarter liegen muss,...
Kenne ich nicht...


Gibt es denn eine Firewall die ich einfach konfigurieren kann wie zB Zone Alarm unter Win? Ausprobiert habe ich schon FWbuilder, Firestarter, gfcc! Aber so richtig bekomme ich nichts ans laufen! :-((

ipchains / iptables ... ;-)) Vielleicht noch in Verbindung mit Squid etc.

Tut mir leid, aber ich kann dir dann auch keinen Tipp mehr geben.

Martin

Breezer
18.04.02, 13:13
Hallo , habe auch eine Frage zum Systemstart und iptables

habe ein script erstellt um regeln zu definieren

Bei Systemstart soll dieses Script ausgeführt werden

1. Ich bekomme eine Fehlermeldung iptables command not found

Fragen wie ist der Status eigentlich beim hochfahren des rechners man ist ja noch gar nicht eingelockt somit hat man noch keine root rechte
somit ist das Kommando
iptables auch noch nicht ausführbar ? kratz Kopf

die rechte von IPtables sage das iptables auch von anderen ausführbar ist

genauer
nach ls -al iptables
-rwxr-x-r-x iptables

so wenn ich als normaler user angemeldet bin geschied folgendes
ausführen geht von ./iptables -t nat -L bspw. nur kann die table nicht angezeigt werden :
can't initialisize iptables tables 'filter' : permission denied ( you must be root )
Perhaps iptables or your Kernel needs to be upgraded

wie läuft das denn nun bei einem Systemstart trotzdem ? gruss

Infos :
iptables 1.2.5
SuSE linux Kernel 2.4.17

Newbie2001
18.04.02, 14:07
hast du villeicht vergessen den Pfad zu den iptables anzugeben. Ich denke mal dass du wie die meisten deine Regeln mit
$IPTABLES ....
anfängst oder zumindest so ähnlich. Hast du villeicht vergessen die Variable zu definieren also am Anfang IPATBLES=/pfad/zu/iptables anzugeben ? Sieht mir nämlich ganz danach aus als wüsste er nicht wo er die iptables zu finden hat.

Breezer
18.04.02, 14:18
das wars auch
Path mußte exportiert werden

Gruß