[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: iptables-skript in Runlevel S>Dienstemanager stürzt ab



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

Dirk Salva wrote:
> Wie wärs denn, wenn Du die Glaskugeln hier mal mit was sinnvollem
> fütterst - z.B. Deinem Script!?!
> 
> 
> ciao, Dirk

ich hatte gedacht, dass meine Regelbeschreibung genügen und somit keine,
wie du es nennst, "Glaskugel" entstehen würde.

Hier ist es:

#!/bin/bash
case "$1" in
"start")

#################################
# Lösche alle Regeln            #
#################################
iptables --flush FORWARD
iptables --flush INPUT
iptables --flush OUTPUT


#################################
# Erlaube zunächst nichts       #
#################################
iptables --policy OUTPUT DROP
iptables --policy INPUT DROP
iptables --policy FORWARD DROP

#################################
# Erlaube TCP:			#
#[www:80,443]		        #
#[mail:pop3  110 	 	#
#      pops3 995		#
#      imaps 993		#
#      smtp   25]               #
#################################

####### INPUT #######
iptables --append INPUT \
	 --destination 192.168.1.2 \
	 --protocol TCP \
	 -m multiport \
	 --source-ports 25,80,110,993,995,443 \
	 -m state \
	 --state ESTABLISHED,RELATED \
         --jump LOG \
         --log-level debug \
         --log-prefix "LOG----IN_TCP "

iptables --append INPUT \
	 --destination 192.168.1.2 \
	 --protocol TCP \
	 -m multiport \
	 --source-ports 25,80,110,993,995,443 \
	 -m state \
	 --state ESTABLISHED,RELATED \
         --jump ACCEPT


####### OUTPUT #######
iptables --append OUTPUT \
	 --source 192.168.1.2 \
	 --protocol TCP \
	 -m multiport \
	 --destination-ports 25,80,110,993,995,443 \
	 -m state \
	 --state NEW,ESTABLISHED,RELATED \
         --jump LOG \
         --log-level debug \
         --log-prefix "LOG----OUT_TCP "

iptables --append OUTPUT \
	 --source 192.168.1.2 \
	 --protocol TCP \
	 -m multiport \
	 --destination-ports 25,80,110,993,995,443 \
	 -m state \
	 --state NEW,ESTABLISHED,RELATED \
	 --jump ACCEPT

#################################
# Erlaube SSH(22)               #
#################################

####### INPUT #######
iptables --append INPUT \
	 --destination 192.168.1.2 \
	 --protocol TCP \
	 --source-port 22 \
	 -m state \
	 --state NEW,ESTABLISHED,RELATED \
         --jump LOG \
         --log-level debug \
         --log-prefix "LOG----IN_SSH(22) "

iptables --append INPUT \
	 --destination 192.168.1.2 \
	 --protocol TCP \
	 --source-port 22 \
	 -m state \
	 --state NEW,ESTABLISHED,RELATED \
         --jump ACCEPT


####### OUTPUT #######
iptables --append OUTPUT \
	 --source 192.168.1.2 \
	 --protocol TCP \
	 --destination-port 22 \
	 -m state \
	 --state NEW,ESTABLISHED,RELATED \
         --jump LOG \
         --log-level debug \
         --log-prefix "LOG----OUT_SSH(22) "

iptables --append OUTPUT \
	 --source 192.168.1.2 \
	 --protocol TCP \
	 --destination-port 22 \
	 -m state \
	 --state NEW,ESTABLISHED,RELATED \
	 --jump ACCEPT


#################################
# Erlaube ICMP                  #
#################################
iptables --append INPUT \
	 --protocol ICMP \
	 --jump LOG \
	 --log-level debug \
	 --log-prefix "LOG----IN_ICMP_general "


iptables --append INPUT \
	 --protocol ICMP \
	 --jump ACCEPT

iptables --append OUTPUT \
	 --protocol ICMP \
	 --jump LOG \
	 --log-level debug \
	 --log-prefix "LOG----OUT_ICMP_general "

iptables --append OUTPUT \
	 --protocol ICMP \
	 --jump ACCEPT


#################################
# Erlaube  UDP-Ports 		#
#################################

####### INPUT #######
# 53: DNS
#67,68: DHCP
#123: NTP

iptables --append INPUT \
 	 --protocol UDP \
	 -m multiport \
	 --source-ports 53,67,68,123 \
	 --jump LOG \
	 --log-level debug \
	 --log-prefix "LOG----IN_UDP "

iptables --append INPUT \
 	 --protocol UDP \
	 -m multiport \
	 --source-ports 53,67,68,123 \
	 --jump ACCEPT


####### OUTPUT #######
# 53: DNS
#111: Portmap
#123: NTP
iptables --append OUTPUT \
 	 --protocol UDP \
	 -m multiport \
	 --destination-ports 53,67,68,123 \
	 --jump LOG \
	 --log-level debug \
	 --log-prefix "LOG----OUT_UDP "

iptables --append OUTPUT \
 	 --protocol UDP \
	 -m multiport \
	 --destination-ports 53,67,68,123 \
	 --jump ACCEPT
;;

"stop")
#################################
# Lösche alle Regeln            #
#################################
iptables --flush FORWARD
iptables --flush INPUT
iptables --flush OUTPUT

#################################
# Erlaube alles		        #
#################################
iptables --policy OUTPUT ACCEPT
iptables --policy INPUT ACCEPT
iptables --policy FORWARD ACCEPT
;;

"restart")
echo "Stopping firewall..."
/etc/init.d/firewall stop
echo "Firewall stopped!"
echo "Starting firewall..."
/etc/init.d/firewall start
echo "Firewall started!"
;;

*)
echo "Usage: /etc/init.d/networking {start|stop|restart}"
exit 1;
;;
esac

exit 0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGijVAoAQ/BgYpd2QRAvIrAJ9lGDitPneI5d2DmjfQ7DzsoqVyEwCfUq3o
IG22bjiZtrSzqBkC6wJF03s=
=Yf+v
-----END PGP SIGNATURE-----



Reply to: