PDA

Bekijk de volledige versie : Need help -- script of post-firewall & post-boot



frank8080
22-05-2007, 06:49
I got a problem that my router (wl-500gP) can't auto run the script "post-firewall & post-boot" at start up. so I need to run the script manually.

I can't mkdir of "local" at /usr , but there was a Symbolic Link "local" --> /tmp/local/sbin/

1 ) Is this a problem that I can't autorun the script ?

2) when I mkdir of "local" at /usr , it show me the msg. that /usr is read only system, is that normal ? if not, how can I change to r/w ?

thanks for all !!!

al37919
22-05-2007, 07:31
I can't mkdir of "local" at /usr , but there was a Symbolic Link "local" --> /tmp/local/sbin/
it's OK /usr/local = /tmp/local aready in the firmware


1 ) Is this a problem that I can't autorun the script ?
1) you have Oleg's firmware
2) the files post-boot and post-firewall are located in /usr/local/sbin
3) they are executable by hand
Does all these three statements correct?


2) when I mkdir of "local" at /usr , it show me the msg. that /usr is read only system, is that normal ? if not, how can I change to r/w ?
it is OK, you don't need to do this

frank8080
23-05-2007, 04:20
1) you have Oleg's firmware
2) the files post-boot and post-firewall are located in /usr/local/sbin
3) they are executable by hand
Does all these three statements correct?

Ans : YES

al37919
23-05-2007, 05:28
it seems that the problem is in the scripts itself. Could you show them?

frank8080
23-05-2007, 06:33
Post-boot:

#!/bin/sh
mount /dev/discs/disc0/part1 /opt
i=0
while [ $i -le 30 ]
do
if [ -d /opt/etc ]
then
break
fi
sleep 1
i='expr $i + 1'
done
swapon /dev/discs/disc0/part2
/opt/etc/init.d/rc.unslung



Post-firewall:

#!/bin/sh
#SSH
iptables -D INPUT -j DROP
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -p tcp --dport 2706 -j ACCEPT
iptables -t nat -A PREROUTING -i vlan1 -p tcp --dport 2706 -j DNAT --to-desination $4:2706
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 22 -j DNAT --to-destination $4:22
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 21 -j DNAT --to-destination $4:21
iptables -A INPUT -j DROP

al37919
23-05-2007, 16:51
OK, stupid question. How do you decide that they are not executed.

If hdd is not automounted I suggest to test it with long delays around mount command and manually insert usb modules:
#!/bin/sh
insmod scsi_mod && insmod sd_mod && insmod usb-storage
sleep 30s
mount /dev/discs/disc0/part1 /opt
sleep 30s

check after loading if firewall rules are changed with:
iptables -L
Also, I dont understand what is the purpose of the 3 PREROUTING rules. I suggest to remove them

modelamark
24-05-2007, 22:08
I have the same problem. they do not run at boot, but do run manually from ssh

ImoTh3P
03-06-2007, 13:56
Same case as modelamark... I need to launch it manually, like the post-boot file was not execute on startup...

If anybody have an idea...

Thks,

Cheers,
ImoTh3P


Edit: Resolved, I've just forget #!/bin/sh in my post-boot file... All is OK now :)