annotate syslog2iptables.rc @ 30:718e94b6b049 stable-1-3

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