meiser79
Aktives Mitglied
- Mitglied seit
- 19 Okt 2004
- Beiträge
- 898
- Punkte für Reaktionen
- 14
- Punkte
- 18
BACK=/var/tmp
CHANGED=0
DELAY=
LOGTARGET=internal
DSLDOFF=
ADMINIP=192.168.150.20
LOGD=/var/tmp
AIRBAG=
MYIP=192.168.150.20
BOOTSTRAP=freetz
PORT=83
BOOT=flash
BOOTDIR=/tmp/flash
ROOT=/usr/ipt
#!/bin/sh
. /mod/etc/conf/mod.cfg
echo "/:$MOD_HTTPD_USER:$MOD_HTTPD_PASSWD" > /mod/etc/httpd.conf
httpd -P /var/run/nhipd.pid -p 192.168.150.1:83 -h /usr/ipt -c /mod/etc/httpd.conf -r Freetz
echo "#!/bin/sh" > /var/tmp/logfw.sh
echo "" >> /var/tmp/logfw.sh
echo 'running=$(ps | grep -v grep | grep -o iptlogger)' >> /var/tmp/logfw.sh
echo 'if [ -z $running ]' >> /var/tmp/logfw.sh
echo 'then' >> /var/tmp/logfw.sh
echo 'echo "starting log deamon"' >> /var/tmp/logfw.sh
echo 'sh /var/tmp/iptlogger.sh' >> /var/tmp/logfw.sh
echo 'myexit=0' >> /var/tmp/logfw.sh
echo 'while [ $myexit -eq 0 ]' >> /var/tmp/logfw.sh
echo 'do' >> /var/tmp/logfw.sh
echo 'sleep 15' >> /var/tmp/logfw.sh
echo 'running=$(ps | grep -v grep | grep -o iptlogger)' >> /var/tmp/logfw.sh
echo 'if [ -z $running ]' >> /var/tmp/logfw.sh
echo 'then' >> /var/tmp/logfw.sh
echo 'echo "terminating log deamon"' >> /var/tmp/logfw.sh
echo 'myexit=1' >> /var/tmp/logfw.sh
echo 'else' >> /var/tmp/logfw.sh
echo 'grep -E -v "<4>|DECT|DCT|^$" /var/tmp/system.log | sed "s/^/$(date +'\''%Y-%m-%d %H:%M:%S'\'') /" >> /var/tmp/system.log' >> /var/tmp/logfw.sh
echo 'grep "<4>" /var/tmp/system.log | sed "s/^/$(date +'\''%Y-%m-%d %H:%M:%S'\'') /" >> /var/tmp/fw.log' >> /var/tmp/logfw.sh
echo 'echo "" > /var/tmp/system.log' >> /var/tmp/logfw.sh
echo 'myexit=0' >> /var/tmp/logfw.sh
echo 'fi' >> /var/tmp/logfw.sh
echo 'done' >> /var/tmp/logfw.sh
echo 'else' >> /var/tmp/logfw.sh
echo 'echo "already running, giving up"' >> /var/tmp/logfw.sh
echo 'fi' >> /var/tmp/logfw.sh
chmod +x /var/tmp/logfw.sh
cat /tmp/flash/nhipt.par > /var/tmp/nhipt.par
echo "#!/bin/sh" > /var/tmp/iptlogger.sh
echo "" >> /var/tmp/iptlogger.sh
echo 'running=$(ps | grep -v grep | grep -o iptlogger)' >> /var/tmp/iptlogger.sh
echo 'if [ -n $running ]' >> /var/tmp/iptlogger.sh
echo 'then' >> /var/tmp/iptlogger.sh
echo 'exit 1' >> /var/tmp/iptlogger.sh
echo 'fi' >> /var/tmp/iptlogger.sh
echo 'running=$(ps | grep -v grep | grep -o logfw)' >> /var/tmp/iptlogger.sh
echo 'if [ -z $running ]' >> /var/tmp/iptlogger.sh
echo 'then' >> /var/tmp/iptlogger.sh
echo 'exit 2' >> /var/tmp/iptlogger.sh
echo 'fi' >> /var/tmp/iptlogger.sh
echo "cat /dev/debug > /var/tmp/system.log & " >> /var/tmp/iptlogger.sh
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
iptables -X
date > /var/tmp/system.log
chmod 777 /var/tmp/system.log
chmod +x /var/tmp/iptlogger.sh
sh /var/tmp/logfw.sh &
###FIREWALL###
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_tables
modprobe ipt_LOG
modprobe ipt_REJECT
modprobe iptable_filter
modprobe x_tables
modprobe xt_multiport
modprobe xt_state
modprobe xt_tcpudp
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
iptables -N AVM_DROP
iptables -N TRANS
iptables -A INPUT -s 192.168.150.0/24 -j ACCEPT
iptables -A INPUT -s 127.0.0.1/32 -j ACCEPT
iptables -A INPUT -s 10.0.150.0/24 -j ACCEPT
iptables -A INPUT -s 169.254.0.0/16 -i lan -j ACCEPT
iptables -A INPUT -s 0.0.0.0/32 -d 255.255.255.255/32 -p udp -m udp --sport 68 --dport 67 -j ACCEPT
iptables -A INPUT -d 169.254.0.0/16 -p udp -m udp --dport 1194 -j ACCEPT
iptables -A INPUT -d 169.254.0.0/16 -p udp -m multiport --dports 5060,7078:7079 -j ACCEPT
iptables -A INPUT -d 169.254.0.0/16 -p tcp -m tcp --dport 22222 -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -j LOG --log-prefix "[IPT] DENY-FRITZ-ACCESS "
iptables -A INPUT -j DROP
iptables -A FORWARD -j AVM_DROP
iptables -A FORWARD -j TRANS
iptables -A FORWARD -j LOG --log-prefix "[IPT] DENY-FWD-ACCESS "
iptables -A FORWARD -j DROP
iptables -A OUTPUT -j AVM_DROP
iptables -A OUTPUT -s 192.168.150.0/24 -j ACCEPT
iptables -A OUTPUT -s 10.0.150.0/24 -j ACCEPT
iptables -A OUTPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p udp -m multiport --dports 53,123,1194 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p udp -m udp --dport 5060 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p udp -m multiport --sports 7078:7079 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p udp -m udp --sport 1194 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p tcp -m tcp --sport 22222 -j ACCEPT
iptables -A OUTPUT -d 192.168.150.0/24 -p tcp -m tcp --sport 22222 -j ACCEPT
iptables -A OUTPUT -d 213.239.201.240/32 -j ACCEPT
iptables -A OUTPUT -d 204.13.248.112/32 -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p icmp -j ACCEPT
iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -j LOG --log-prefix "[IPT] WARNING-CALL-HOME "
iptables -A AVM_DROP -s 192.168.150.20/32 -d 212.227.16.2/32 -j ACCEPT
iptables -A AVM_DROP -s 192.168.150.20/32 -d 212.42.244.0/24 -j ACCEPT
iptables -A AVM_DROP -d 212.227.16.2/32 -j DROP
iptables -A AVM_DROP -d 212.42.244.0/24 -j LOG --log-prefix "[IPT] AVM CALL HOME "
iptables -A AVM_DROP -d 212.42.244.0/24 -j DROP
iptables -A TRANS -s 192.168.150.0/24 -p udp -m multiport --dports 53,123,1194 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p udp -m multiport --dports 3478,5060,7078:7079 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p udp -m multiport --sports 7078:7079 -j ACCEPT
iptables -A TRANS -d 192.168.150.0/24 -p udp -m multiport --dports 7078:7079 -j ACCEPT
iptables -A TRANS -d 192.168.150.0/24 -p udp -m udp --sport 1194 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p tcp -m multiport --dports 20,21,22,25,43,80,110 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p tcp -m multiport --dports 143,443,995,3306,22222 -j ACCEPT
iptables -A TRANS -d 192.168.150.0/24 -p tcp -m tcp --sport 22222 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p udp -m udp --dport 24441 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p tcp -m multiport --dports 7,587,2703,24441 -j ACCEPT
iptables -A TRANS -p tcp -m tcp --sport 443 -j ACCEPT
iptables -A TRANS -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A TRANS -p icmp -j ACCEPT
iptables -A TRANS -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A TRANS -j LOG --log-prefix "[IPT] DENY-LAN-ACCESS "
iptables -A TRANS -j DROP
BACK=/var/tmp
CHANGED=0
DELAY=
LOGTARGET=internal
DSLDOFF=
ADMINIP=192.168.150.20
LOGD=/var/tmp
AIRBAG=
MYIP=192.168.150.20
BOOTSTRAP=freetz
PORT=83
BOOT=flash
BOOTDIR=/tmp/flash
ROOT=/usr/ipt
#!/bin/sh
. /mod/etc/conf/mod.cfg
echo "/:$MOD_HTTPD_USER:$MOD_HTTPD_PASSWD" > /mod/etc/httpd.conf
httpd -P /var/run/nhipd.pid -p 192.168.150.1:83 -h /usr/ipt -c /mod/etc/httpd.conf -r Freetz
echo "#!/bin/sh" > /var/tmp/logfw.sh
echo "" >> /var/tmp/logfw.sh
echo 'running=$(ps | grep -v grep | grep -o iptlogger)' >> /var/tmp/logfw.sh
echo 'if [ -z $running ]' >> /var/tmp/logfw.sh
echo 'then' >> /var/tmp/logfw.sh
echo 'echo "starting log deamon"' >> /var/tmp/logfw.sh
echo 'sh /var/tmp/iptlogger.sh' >> /var/tmp/logfw.sh
echo 'myexit=0' >> /var/tmp/logfw.sh
echo 'while [ $myexit -eq 0 ]' >> /var/tmp/logfw.sh
echo 'do' >> /var/tmp/logfw.sh
echo 'sleep 15' >> /var/tmp/logfw.sh
echo 'running=$(ps | grep -v grep | grep -o iptlogger)' >> /var/tmp/logfw.sh
echo 'if [ -z $running ]' >> /var/tmp/logfw.sh
echo 'then' >> /var/tmp/logfw.sh
echo 'echo "terminating log deamon"' >> /var/tmp/logfw.sh
echo 'myexit=1' >> /var/tmp/logfw.sh
echo 'else' >> /var/tmp/logfw.sh
echo 'grep -E -v "<4>|DECT|DCT|^$" /var/tmp/system.log | sed "s/^/$(date +'\''%Y-%m-%d %H:%M:%S'\'') /" >> /var/tmp/system.log' >> /var/tmp/logfw.sh
echo 'grep "<4>" /var/tmp/system.log | sed "s/^/$(date +'\''%Y-%m-%d %H:%M:%S'\'') /" >> /var/tmp/fw.log' >> /var/tmp/logfw.sh
echo 'echo "" > /var/tmp/system.log' >> /var/tmp/logfw.sh
echo 'myexit=0' >> /var/tmp/logfw.sh
echo 'fi' >> /var/tmp/logfw.sh
echo 'done' >> /var/tmp/logfw.sh
echo 'else' >> /var/tmp/logfw.sh
echo 'echo "already running, giving up"' >> /var/tmp/logfw.sh
echo 'fi' >> /var/tmp/logfw.sh
chmod +x /var/tmp/logfw.sh
cat /tmp/flash/nhipt.par > /var/tmp/nhipt.par
echo "#!/bin/sh" > /var/tmp/iptlogger.sh
echo "" >> /var/tmp/iptlogger.sh
echo 'running=$(ps | grep -v grep | grep -o iptlogger)' >> /var/tmp/iptlogger.sh
echo 'if [ -n $running ]' >> /var/tmp/iptlogger.sh
echo 'then' >> /var/tmp/iptlogger.sh
echo 'exit 1' >> /var/tmp/iptlogger.sh
echo 'fi' >> /var/tmp/iptlogger.sh
echo 'running=$(ps | grep -v grep | grep -o logfw)' >> /var/tmp/iptlogger.sh
echo 'if [ -z $running ]' >> /var/tmp/iptlogger.sh
echo 'then' >> /var/tmp/iptlogger.sh
echo 'exit 2' >> /var/tmp/iptlogger.sh
echo 'fi' >> /var/tmp/iptlogger.sh
echo "cat /dev/debug > /var/tmp/system.log & " >> /var/tmp/iptlogger.sh
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
iptables -X
date > /var/tmp/system.log
chmod 777 /var/tmp/system.log
chmod +x /var/tmp/iptlogger.sh
sh /var/tmp/logfw.sh &
###FIREWALL###
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_tables
modprobe ipt_LOG
modprobe ipt_REJECT
modprobe iptable_filter
modprobe x_tables
modprobe xt_multiport
modprobe xt_state
modprobe xt_tcpudp
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
iptables -N AVM_DROP
iptables -N TRANS
iptables -A INPUT -s 192.168.150.0/24 -j ACCEPT
iptables -A INPUT -s 127.0.0.1/32 -j ACCEPT
iptables -A INPUT -s 10.0.150.0/24 -j ACCEPT
iptables -A INPUT -s 169.254.0.0/16 -i lan -j ACCEPT
iptables -A INPUT -s 0.0.0.0/32 -d 255.255.255.255/32 -p udp -m udp --sport 68 --dport 67 -j ACCEPT
iptables -A INPUT -d 169.254.0.0/16 -p udp -m udp --dport 1194 -j ACCEPT
iptables -A INPUT -d 169.254.0.0/16 -p udp -m multiport --dports 5060,7078:7079 -j ACCEPT
iptables -A INPUT -d 169.254.0.0/16 -p tcp -m tcp --dport 22222 -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -j LOG --log-prefix "[IPT] DENY-FRITZ-ACCESS "
iptables -A INPUT -j DROP
iptables -A FORWARD -j AVM_DROP
iptables -A FORWARD -j TRANS
iptables -A FORWARD -j LOG --log-prefix "[IPT] DENY-FWD-ACCESS "
iptables -A FORWARD -j DROP
iptables -A OUTPUT -j AVM_DROP
iptables -A OUTPUT -s 192.168.150.0/24 -j ACCEPT
iptables -A OUTPUT -s 10.0.150.0/24 -j ACCEPT
iptables -A OUTPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p udp -m multiport --dports 53,123,1194 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p udp -m udp --dport 5060 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p udp -m multiport --sports 7078:7079 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p udp -m udp --sport 1194 -j ACCEPT
iptables -A OUTPUT -s 169.254.0.0/16 -p tcp -m tcp --sport 22222 -j ACCEPT
iptables -A OUTPUT -d 192.168.150.0/24 -p tcp -m tcp --sport 22222 -j ACCEPT
iptables -A OUTPUT -d 213.239.201.240/32 -j ACCEPT
iptables -A OUTPUT -d 204.13.248.112/32 -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p icmp -j ACCEPT
iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -j LOG --log-prefix "[IPT] WARNING-CALL-HOME "
iptables -A AVM_DROP -s 192.168.150.20/32 -d 212.227.16.2/32 -j ACCEPT
iptables -A AVM_DROP -s 192.168.150.20/32 -d 212.42.244.0/24 -j ACCEPT
iptables -A AVM_DROP -d 212.227.16.2/32 -j DROP
iptables -A AVM_DROP -d 212.42.244.0/24 -j LOG --log-prefix "[IPT] AVM CALL HOME "
iptables -A AVM_DROP -d 212.42.244.0/24 -j DROP
iptables -A TRANS -s 192.168.150.0/24 -p udp -m multiport --dports 53,123,1194 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p udp -m multiport --dports 3478,5060,7078:7079 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p udp -m multiport --sports 7078:7079 -j ACCEPT
iptables -A TRANS -d 192.168.150.0/24 -p udp -m multiport --dports 7078:7079 -j ACCEPT
iptables -A TRANS -d 192.168.150.0/24 -p udp -m udp --sport 1194 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p tcp -m multiport --dports 20,21,22,25,43,80,110 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p tcp -m multiport --dports 143,443,995,3306,22222 -j ACCEPT
iptables -A TRANS -d 192.168.150.0/24 -p tcp -m tcp --sport 22222 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p udp -m udp --dport 24441 -j ACCEPT
iptables -A TRANS -s 192.168.150.0/24 -p tcp -m multiport --dports 7,587,2703,24441 -j ACCEPT
iptables -A TRANS -p tcp -m tcp --sport 443 -j ACCEPT
iptables -A TRANS -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A TRANS -p icmp -j ACCEPT
iptables -A TRANS -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A TRANS -j LOG --log-prefix "[IPT] DENY-LAN-ACCESS "
iptables -A TRANS -j DROP
###NHIPT-START###
cat /tmp/flash/nhipt.cfg > /var/tmp/nhipt.cfg
cat /tmp/flash/nhipt.par > /var/tmp/nhipt.par
chmod +x /var/tmp/nhipt.cfg
/bin/sh /var/tmp/nhipt.cfg &
###NHIPT-END###
cat /var/tmp/nhipt.par > /tmp/flash/nhipt.par
cat /var/tmp/nhipt.cfg > /tmp/flash/nhipt.cfg
modsave flash
ip6tables -t filter -A INPUT -i sixxs -p ipv6 -m state --state RELATED,ESTABLISHED -j ACCEPT
ip6tables: No chain/target/match by that name
Module Size Used by Tainted: P
ip6table_filter 1920 0
ip6_tables 18208 1 ip6table_filter
ipt_REJECT 4800 0
ipt_LOG 7328 0
ip_conntrack_ftp 71552 0
ip_conntrack 42288 1 ip_conntrack_ftp
iptable_filter 2112 0
ip_tables 21312 3 ipt_REJECT,ipt_LOG,iptable_filter
ipv6 273280 8
Module Size Used by Tainted: P
ipt_multiport 2176 0
ipt_state 1312 0
ip6table_filter 1920 0
ip6_tables 18208 1 ip6table_filter
ipt_REJECT 4800 0
ipt_LOG 7328 0
ip_conntrack_ftp 71552 0
ip_conntrack 42288 2 ipt_state,ip_conntrack_ftp
iptable_filter 2112 0
ip_tables 21312 5 ipt_multiport,ipt_state,ipt_REJECT,ipt_LOG,iptable_filter
/ # ip6tables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
/ # ip6tables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ip_conntrack
ip_conntrack_ftp
ip_tables
ipt_LOG
ipt_REJECT
iptable_filter
x_tables
xt_multiport
xt_state
xt_tcpudp
iptables -t filter -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
ip6tables -t filter -A INPUT -i sixxs -p ipv6-icmp -j ACCEPT
[ ] ip6_queue.ko
[*] ip6_tables.ko
[*] ip6table_filter.ko
[ ] ip6table_raw.ko
[ ] ip6t_ah.ko
[ ] ip6t_dst.ko
[ ] ip6t_esp.ko
[ ] ip6t_eui64.ko
[ ] ip6t_frag.ko
[ ] ip6t_hbh.ko
[ ] ip6t_hl.ko
[ ] ip6t_ipv6header.ko
[ ] ip6t_length.ko
[ ] ip6t_limit.ko
[ ] ip6t_LOG.ko
[ ] ip6t_mac.ko
[ ] ip6t_mark.ko
[ ] ip6t_multiport.ko
[ ] ip6t_owner.ko
[ ] ip6t_rt.ko
[ ] ip6table_mangle.ko
ip6tables: No chain/target/match by that name
Exit Code 1 - ip6tables -t filter -A INPUT -i sixxs -p ipv6 -m state --state RELATED,ESTABLISHED -j ACCEPT
mkdir /mod/etc/default.nhipt
cp /var/media/ftp/uStor01/ipt/freetz/nhipt.cfg /mod/etc/default.nhipt
modconf load nhipt
cd /mod/usr/lib/cgi-bin
ln -s /var/media/ftp/uStor01/ipt/freetz/nhipt.cgi nhipt.cgi
cd /mod/etc/init.d
ln -s /var/media/ftp/uStor01/ipt/freetz/rc.nhipt rc.nhipt
modreg cgi nhipt NHIPT
chmod +x /var/media/ftp/uStor01/ipt/freetz/nhipt.cgi
if [ -z "$(grep 'register.sh' /tmp/flash/mod/rc.custom)" ]; then echo '. /var/media/ftp/uStor01/ipt/register.sh' >> /tmp/flash/mod/rc.custom; modsave flash; fi