]>
Commit | Line | Data |
---|---|---|
6b557d34 | 1 | #!/bin/sh |
2 | # DenyHosts - ssh brute force attack scanner | |
7093f17b | 3 | # |
6b557d34 | 4 | # chkconfig: 345 85 05 |
5 | # description: DenyHosts - ssh brute force attack scanner | |
6 | ||
7 | # Source function library | |
8 | . /etc/rc.d/init.d/functions | |
9 | ||
10 | # Get network config | |
11 | . /etc/sysconfig/network | |
12 | ||
13 | # Get service config | |
14 | [ -f /etc/sysconfig/DenyHosts ] && . /etc/sysconfig/DenyHosts | |
15 | ||
16 | # Check that networking is up. | |
17 | if is_yes "${NETWORKING}"; then | |
18 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
19 | msg_network_down "DenyHosts" | |
20 | exit 1 | |
21 | fi | |
22 | else | |
23 | exit 0 | |
24 | fi | |
25 | ||
26 | RETVAL=0 | |
27 | # See how we were called. | |
28 | case "$1" in | |
29 | start) | |
30 | # Check if the service is already running? | |
31 | if [ ! -f /var/lock/subsys/DenyHosts ]; then | |
32 | msg_starting "DenyHosts" | |
33 | daemon /usr/sbin/DenyHostsctl start --config /etc/DenyHosts.cfg | |
34 | touch /var/lock/subsys/DenyHosts | |
35 | else | |
36 | msg_already_running "DenyHosts" | |
37 | fi | |
38 | ;; | |
39 | stop) | |
40 | # Check if the service is already running? | |
41 | if [ -f /var/lock/subsys/DenyHosts ]; then | |
42 | msg_stopping "DenyHosts" | |
43 | busy | |
44 | daemon /usr/sbin/DenyHostsctl stop | |
45 | rm -f /var/lock/subsys/DenyHosts | |
46 | else | |
47 | msg_not_running "DenyHosts" | |
48 | fi | |
49 | ;; | |
50 | restart|force-reload) | |
51 | $0 stop | |
52 | $0 start | |
53 | exit $? | |
54 | ;; | |
55 | status) | |
56 | status "DenyHosts" | |
57 | /usr/sbin/DenyHostsctl status | |
58 | exit $? | |
59 | ;; | |
60 | *) | |
61 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
62 | exit 3 | |
63 | esac | |
64 | ||
65 | exit $RETVAL |