First integration of imspector, some more work to do.
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / imspector
1 #!/bin/sh
2 # Begin $rc_base/init.d/imspector
3
4 . /etc/sysconfig/rc
5 . $rc_functions
6
7 case "$1" in
8 start)
9 boot_mesg "Inserting imspector redirects..."
10 iptables -t nat -A CUSTOMPREROUTING -p tcp --destination-port 1863 -j REDIRECT --to-ports 16667
11 iptables -t nat -A CUSTOMPREROUTING -p tcp --destination-port 5222 -j REDIRECT --to-ports 16667
12 iptables -t nat -A CUSTOMPREROUTING -p tcp --destination-port 5223 -j REDIRECT --to-ports 16667
13 iptables -t nat -A CUSTOMPREROUTING -p tcp --destination-port 5190 -j REDIRECT --to-ports 16667
14 iptables -t nat -A CUSTOMPREROUTING -p tcp --destination-port 5050 -j REDIRECT --to-ports 16667
15 iptables -t nat -A CUSTOMPREROUTING -p tcp --destination-port 6667 -j REDIRECT --to-ports 16667
16 iptables -t nat -A CUSTOMPREROUTING -p tcp --destination-port 8074 -j REDIRECT --to-ports 16667
17
18 boot_mesg "Starting imspector Deamon..."
19 loadproc imspector -c /etc/imspector/imspector.conf
20 evaluate_retval
21 ;;
22
23 stop)
24 boot_mesg "Stopping imspector Deamon..."
25 killproc /usr/sbin/imspector
26 evaluate_retval
27
28 boot_mesg "Remove imspector redirects..."
29 iptables -t nat -D CUSTOMPREROUTING -p tcp --destination-port 1863 -j REDIRECT --to-ports 16667
30 iptables -t nat -D CUSTOMPREROUTING -p tcp --destination-port 5222 -j REDIRECT --to-ports 16667
31 iptables -t nat -D CUSTOMPREROUTING -p tcp --destination-port 5223 -j REDIRECT --to-ports 16667
32 iptables -t nat -D CUSTOMPREROUTING -p tcp --destination-port 5190 -j REDIRECT --to-ports 16667
33 iptables -t nat -D CUSTOMPREROUTING -p tcp --destination-port 5050 -j REDIRECT --to-ports 16667
34 iptables -t nat -D CUSTOMPREROUTING -p tcp --destination-port 6667 -j REDIRECT --to-ports 16667
35 iptables -t nat -D CUSTOMPREROUTING -p tcp --destination-port 8074 -j REDIRECT --to-ports 16667
36 ;;
37
38 restart)
39 $0 stop
40 sleep 1
41 $0 start
42 ;;
43
44 status)
45 statusproc /usr/sbin/imspector
46 ;;
47
48 *)
49 echo "Usage: $0 {start|stop|restart|status}"
50 exit 1
51 ;;
52 esac
53
54 # End $rc_base/init.d/imspector