As I promised a while ago, here a little tuturial howto setup moblock on a PPC8533 diskstation. It took me hours and hours to get moblock and the kernel modules compiled but here it is:
Using FW914, the firewall must be enabled to activate the kernel modules which ship with the firmware. After activating, make sure the modules without a * are present
iptable_filter /lib/modules/iptable_filter.ko
ip_tables /lib/modules/ip_tables.ko
* ipt_REJECT /opt/lib/modules/ipt_REJECT.ko
nf_conntrack /lib/modules/nf_conntrack.ko
nf_conntrack_ipv4 /lib/modules/nf_conntrack_ipv4.ko
x_tables /lib/modules/x_tables.ko
* xt_iprange
* xt_mark
xt_multiport /lib/modules/xt_multiport.ko
* xt_NFQUEUE
xt_state /lib/modules/xt_state.ko
xt_tcpudp /lib/modules/xt_tcpudp.ko
* nfnetlink /lib/modules/nfnetlink.ko
* nfnetlink_queue /lib/modules/nfnetlink_queue.ko
Install needed ipkg packages from optware feed:
ipkg install findutils
ipkg install module-init-tools
Needed packages from
http://users.skynet.be/synologyipkg install
http://users.skynet.be/synology/moblock ... owerpc.ipkipkg install
http://users.skynet.be/synology/moblock ... owerpc.ipkipkg install
http://users.skynet.be/synology/moblock ... owerpc.ipkipkg install
http://users.skynet.be/synology/moblock ... owerpc.ipkDownload and unzip the following file:
http://users.skynet.be/synology/moblock/moblock.zipThe zip file contains 2 main directories
1/ iptables-syno-kernel-2-6-24-ppc8533 containing the kernel modules needed + insmod/rmmod script to insert/remove kernel modules:
ipt_iprange.ko
ipt_REJECT.ko
nfnetlink.ko
nfnetlink_queue.ko
xt_conntrack.ko
xt_mark.ko
xt_NFQUEUE.ko
script_insmod.sh
script_rmmod.sh
copy all kernel modules to /opt/lib/modules/2.6.24/ and execute sh script_insmod.sh
=> you should see the kernel modules installed now by executing lsmod
2/ opt containing the scripts / libraries for blockcontrol written by jre and adjusted by me to work on the disk station. The opt directory has the following structure:
opt
--var
----lib
------blockcontrol > this is the path where the downloaded lists will be stored
--lib
----blockcontrol
------blockcontrol.defaults
------blockcontrol.main
------blockcontrol.lib
----lsb
------init-functions
--bin
----blockcontrol
----blockcontrol.watchdog
--etc
----blockcontrol
------blockcontrol.conf
------blocklists.list
------allow.p2p
copy this directory structure to your bootstrapped disk station exactly as it is.
=> check and uncheck the blocklists you want to include in blocklists.list. Make sure exclude TBG Bogon since it will block your land addresses according to RFC???
=> edit blockcontrol.conf to allow certain ports to bypass moblock (eg. mangement port etc...)
Start moblock by using /opt/bin/blockcontrol start
or use other script options:
start
stop
restart
reload
update
status
test
stats
reset_stats
show_config
search
After starting moblock, using iptables -L -nv, you should see somthing like:
Chain INPUT (policy ACCEPT 12562 packets, 910K bytes)
pkts bytes target prot opt in out source destination
1761 118K blockcontrol_in all -- * * 0.0.0.0/0 0.0.0.0/0 state NEW MARK match !0x14
26M 35G ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
23669 1681K ACCEPT all -- eth0 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- eth0 * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 blockcontrol_fw all -- * * 0.0.0.0/0 0.0.0.0/0 state NEW MARK match !0x14
Chain OUTPUT (policy ACCEPT 24M packets, 12G bytes)
pkts bytes target prot opt in out source destination
2454 172K blockcontrol_out all -- * * 0.0.0.0/0 0.0.0.0/0 state NEW MARK match !0x1 4
Chain blockcontrol_fw (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 MARK match 0xa
0 0 RETURN all -- * * 0.0.0.0/0 192.168.111.1
0 0 RETURN all -- * * 192.168.111.0/24 192.168.111.0/24
0 0 NFQUEUE all -- * * 0.0.0.0/0 0.0.0.0/0 NFQUEUE num 92
Chain blockcontrol_in (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 MARK match 0xa
441 29560 RETURN all -- lo * 0.0.0.0/0 0.0.0.0/0
688 54923 RETURN all -- * * 192.168.111.0/24 0.0.0.0/0
0 0 RETURN udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:53
2 1312 RETURN udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:5070
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5070
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8088
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8050
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
32 1616 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5001
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5000
598 30207 NFQUEUE all -- * * 0.0.0.0/0 0.0.0.0/0 NFQUEUE num 92
Chain blockcontrol_out (1 references)
pkts bytes target prot opt in out source destination
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 MARK match 0xa reject-with icmp- port-unreachable
441 29560 RETURN all -- * lo 0.0.0.0/0 0.0.0.0/0
0 0 RETURN all -- * * 0.0.0.0/0 192.168.111.1
59 7924 RETURN all -- * * 0.0.0.0/0 192.168.111.0/24
33 2181 RETURN udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:53
0 0 RETURN udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:5070
25 16163 RETURN udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:5060
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8050
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8088
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:993
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:21
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5001
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5000
10 600 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
39 2340 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
1847 114K NFQUEUE all -- * * 0.0.0.0/0 0.0.0.0/0 NFQUEUE num 92
Known issues (so far):
* when moblock blocks a packet, something like this is written in the log file:
Aug 13 20:47:42 kernel: nf_queue: error creating packet message
Aug 13 20:47:43 kernel: nf_queue: error creating packet message
Aug 13 20:47:48 kernel: printk: 4 messages suppressed.
Many thanks to jre (Maintainer of
http://moblock-deb.sourceforge.net: MoBlock, mobloquer, blockcontrol and NFBlock Debian packages.
Author of blockcontrol, previously moblock-control) to help me sort out a lot of things and get moblock up and running on a ppc8533 synology disk station.
Have moblock fun