32
|
1 # -- bash header installed by automake --
|
|
2 #
|
|
3 # syslog2iptables This script controls the syslog2iptables daemon.
|
|
4 #
|
|
5 #
|
|
6 # chkconfig: 2345 60 40
|
|
7 # description: syslog2iptables monitors syslog files, parses them, and update the iptables filters
|
|
8 # processname: syslog2iptables
|
|
9 # pidfile: /var/run/syslog2iptables.pid
|
|
10 # Source function library.
|
|
11 #
|
|
12 . /etc/rc.d/init.d/functions
|
|
13
|
|
14 # Source networking configuration.
|
|
15 . /etc/sysconfig/network
|
|
16
|
|
17 RETVAL=0
|
|
18 # See how we were called.
|
|
19 case "$1" in
|
|
20 start)
|
|
21 # Start daemons.
|
|
22 echo -n "Starting syslog2iptables: "
|
|
23 if [ ! -f /var/lock/subsys/syslog2iptables ]; then
|
|
24 cd SYSCONFDIR # conf file is here
|
|
25 SBINDIR/syslog2iptables -d 3
|
|
26 RETVAL=$?
|
|
27 pid=`pidof -s SBINDIR/syslog2iptables`
|
|
28 if [ $pid ]
|
|
29 then
|
|
30 success "Starting syslog2iptables :"
|
|
31 touch /var/lock/subsys/syslog2iptables
|
|
32 echo
|
|
33 else
|
|
34 failure "Starting syslog2iptables:"
|
|
35 echo
|
|
36 fi
|
|
37 else
|
|
38 echo -n "already running! "
|
|
39 failure "syslog2iptables already running!"
|
|
40 echo
|
|
41 fi
|
|
42
|
|
43 ;;
|
|
44 stop)
|
|
45 # Stop daemons.
|
|
46 echo -n "Shutting down syslog2iptables: "
|
|
47 killproc syslog2iptables
|
|
48 RETVAL=$?
|
|
49 echo
|
|
50 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/syslog2iptables
|
|
51 ;;
|
|
52 restart|reload)
|
|
53 $0 stop
|
|
54 $0 flush
|
|
55 $0 start
|
|
56 RETVAL=$?
|
|
57 ;;
|
|
58 flush)
|
|
59 /sbin/iptables -F INPUT
|
|
60 ;;
|
|
61 status)
|
|
62 status syslog2iptables
|
|
63 RETVAL=$?
|
|
64 ;;
|
|
65 *)
|
|
66 echo "Usage: syslog2iptables {start|stop|restart|status|flush}"
|
|
67 exit 1
|
|
68 esac
|
|
69 exit $RETVAL
|
|
70
|
|
71 # $Id$
|