The final part of my post.
$ ps w
Code:
PID USER VSZ STAT COMMAND
1 god 1312 S /sbin/init
2 god 0 SW [keventd]
3 god 0 SWN [ksoftirqd_CPU0]
4 god 0 SW [kswapd]
5 god 0 SW [bdflush]
6 god 0 SW [kupdated]
7 god 0 SW [mtdblockd]
38 god 1108 S httpd eth1
39 god 1072 S nas /tmp/nas.lan.conf /tmp/nas.lan.pid lan
41 god 1516 S syslogd -m 0 -O /tmp/syslog.log -S -l 7 -b 2
42 god 1516 S klogd
44 nobody 832 S dnsmasq
45 god 0 SW [khubd]
57 god 1316 S watchdog
63 god 0 SW [usb-storage-0]
64 god 0 SW [scsi_eh_0]
73 god 0 SW [kjournald]
74 god 0 SW [kjournald]
84 god 6304 S N /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
85 god 6304 S N /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
86 god 6304 S N /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
97 god 1516 S sh -c ps w > /tmp/syscmd.log 2>&1
98 god 1516 R ps w
As you can see dropbear should be running, because it's launched in /usr/local/sbin/post-firewall. I have disabled the default dropbear in the web GUI.
$ lsmod
Code:
Tainted: P
usb-storage 63080 3
sd_mod 12660 6
scsi_mod 72624 2 [usb-storage sd_mod]
ehci-hcd 28212 0 (unused)
usb-uhci 27412 0 (unused)
usbcore 78840 1 [usb-storage ehci-hcd usb-uhci]
ip_nat_ftp 3136 0 (unused)
ip_conntrack_ftp 4584 1
wl 897336 0 (unused)
No et module?!?
$ ifconfig
Code:
br0 Link encap:Ethernet HWaddr 00:1E:8C:72:28:ED
inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2909 errors:0 dropped:0 overruns:0 frame:0
TX packets:4307 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:237804 (232.2 KiB) TX bytes:4382975 (4.1 MiB)
eth0 Link encap:Ethernet HWaddr 00:1E:8C:72:28:ED
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2872 errors:0 dropped:0 overruns:0 frame:339
TX packets:4439 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:274156 (267.7 KiB) TX bytes:4435594 (4.2 MiB)
Interrupt:12 Base address:0x4000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU:16436 Metric:1
RX packets:2806 errors:0 dropped:0 overruns:0 frame:0
TX packets:2806 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:568755 (555.4 KiB) TX bytes:568755 (555.4 KiB)
No ethernet drivers? I suppose eth0 is the wireless card.
$ route -an
Code:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.1 0.0.0.0 255.255.255.0 U 0 0 0 br0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
$ netstat -an
Code:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:9091 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:51413 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN
tcp 0 0 192.168.100.1:80 192.168.100.38:55439 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55435 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55443 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55438 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55434 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55442 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55437 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55445 ESTABLISHED
tcp 0 0 192.168.100.1:80 192.168.100.38:55441 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55436 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55444 TIME_WAIT
tcp 0 0 192.168.100.1:80 192.168.100.38:55440 TIME_WAIT
udp 0 0 127.0.0.1:34954 0.0.0.0:*
udp 0 0 0.0.0.0:53 0.0.0.0:*
udp 0 0 0.0.0.0:67 0.0.0.0:*
udp 0 0 0.0.0.0:51413 0.0.0.0:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 4 [ ] DGRAM 259 /dev/log
unix 3 [ ] STREAM CONNECTED 595
unix 3 [ ] STREAM CONNECTED 594
unix 2 [ ] DGRAM 367
unix 2 [ ] DGRAM 366
So httpd and transmission are listening. As you can see I'm controlling the router through httpd, as it is the only way to reach it.
$ mount
Code:
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
none on /dev type devfs (rw)
proc on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw,noatime)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/discs/disc0/part2 on /opt type ext3 (rw,noatime)
/dev/discs/disc0/part3 on /tmp/mnt/disc0_3 type ext3 (rw,noatime)
All ok here?
$ ls -la /usr/local/sbin/
Code:
total 312
drwxr-xr-x 2 god root 220 Jan 1 2000 .
drwxr-xr-x 5 god root 120 Jan 1 2000 ..
-rwxr-xr-x 1 god root 268 Dec 2 17:06 ez-setup
-rwxr-xr-x 1 god root 9836 Nov 18 15:30 knock
-rwxr-xr-x 1 god root 273100 Nov 18 15:30 knockd
-rwxr-xr-x 1 god root 24 Dec 2 18:50 post-boot
-rwxr-xr-x 1 god root 798 Dec 3 09:25 post-firewall
-rwxr-xr-x 1 god root 45 Dec 2 17:12 post-mount
-rwxr-xr-x 1 god root 0 Nov 18 17:43 pre-boot
-rwxr-xr-x 1 god root 330 Dec 2 17:11 pre-mount
-rwxr-xr-x 1 god root 170 Dec 2 17:13 pre-shutdown
These are my startup scripts. N.B. pre-boot is empty.
$ cat /usr/local/sbin/post-boot
Code:
#!/bin/sh
rmmod printer
$ cat /usr/local/sbin/post-firewall
Code:
#!/bin/sh
LAN_IP="$(nvram get lan_ipaddr)"
#WAN_IP="$(nvram get wan_ipaddr)"
# My own firewall rules:
# remove the default DROP rule
iptables -D INPUT -j DROP
# Open ports for transmission
iptables -A INPUT -p tcp --dport 51413 -j ACCEPT
iptables -A INPUT -p udp --dport 51413 -j ACCEPT
# append the default DROP rule
iptables -A INPUT -j DROP
# -------------------------------------------------
# start dropbear on LAN
/usr/sbin/dropbear -p $LAN_IP:22
# start dropbear on WAN
# -s = no password logins
#/usr/sbin/dropbear -s -p $WAN_IP:2222
# Launch knockd on WAN
#/usr/local/sbin/knockd --daemon --interface eth1 --config /usr/local/etc/knockd/knockd.conf
$ cat /usr/local/sbin/post-mount
Code:
#! /bin/sh
/opt/etc/init.d/rc.unslung start
One remark about starting rc.unslung in post-mount: now everytime I plug in a USB flash drive, a new process of transmission is launched because rc.unslung launches it.
$ cat /usr/local/sbin/pre-mount
Code:
#! /bin/sh
swapon -a
# I commented out this part of wengi's script cause I want mail notification
# when the file system needs checking. Don't know how to do it yet.
#
#for i in `awk '/ext3/{print($1)}' /etc/fstab` ; do
# if [ -b $i ] ; then
# grep -q $i /proc/mounts || e2fsck -p $i 2>&1 | logger -t e2fsck
# else
# logger -t fstab "$i is not attached"
# fi
#done
$ cat /usr/local/sbin/pre-shutdown
Code:
#! /bin/sh
/opt/etc/init.d/rc.unslung stop
sleep 10s
for i in `cat /proc/mounts | awk '/ext3/{print($1)}'` ; do
mount -oremount,ro $i
done
swapoff -a
sleep 1s
Thanks for reading!