aboutsummaryrefslogtreecommitdiff
path: root/network/fail2ban/rc.fail2ban
diff options
context:
space:
mode:
Diffstat (limited to 'network/fail2ban/rc.fail2ban')
-rw-r--r--network/fail2ban/rc.fail2ban26
1 files changed, 14 insertions, 12 deletions
diff --git a/network/fail2ban/rc.fail2ban b/network/fail2ban/rc.fail2ban
index bc3021e56e3ce..86c6b7de52629 100644
--- a/network/fail2ban/rc.fail2ban
+++ b/network/fail2ban/rc.fail2ban
@@ -1,20 +1,22 @@
#!/bin/sh
#
+# Copyright (c) 2008-2009, Nishant Limbachia, Hoffman Est, IL, USA (nishant@mnspace.net)
# /etc/rc.d/rc.fail2ban
#
-# start/stop/reload/status/ping fail2ban server.
+# start|stop|restart|reload|status|ping fail2ban server
#
-# To start fail2ban automatically at boot, make this
-# file executable: chmod 755 /etc/rc.d/rc.fail2ban
-# you must also add this file to rc.local in the
-# appropriate order.
+# To start fail2ban automatically at boot, make this file executable:
+# chmod 755 /etc/rc.d/rc.fail2ban
+# you must also add this file to rc.local for fail2ban to start during boot.
-SOCKET="/var/run/fail2ban/fail2ban.socket"
+### default socket file is /var/run/fail2ban/fail2ban.sock which can be
+### changed via the config file: /etc/fail2ban/fail2ban.conf
fail2ban_start() {
if [ -x /etc/rc.d/rc.fail2ban ]; then
echo "Starting fail2ban: "
- /usr/bin/fail2ban-client -x -s ${SOCKET} start
+ ### using -x option to remove any stale socket file.
+ /usr/bin/fail2ban-client -x start
else
echo "rc.fail2ban is not executable or you don't have enough permissions"
exit 1
@@ -23,22 +25,22 @@ fail2ban_start() {
fail2ban_stop() {
echo "Stopping fail2ban"
- /usr/bin/fail2ban-client -x -s ${SOCKET} stop
+ /usr/bin/fail2ban-client stop
}
fail2ban_reload() {
echo "Reloading fail2ban"
- /usr/bin/fail2ban-client -x -s ${SOCKET} reload
+ /usr/bin/fail2ban-client reload
}
fail2ban_status() {
echo "Status: fail2ban"
- /usr/bin/fail2ban-client -s ${SOCKET} status
+ /usr/bin/fail2ban-client status
}
fail2ban_ping() {
echo "Pinging fail2ban"
- /usr/bin/fail2ban-client -s ${SOCKET} ping
+ /usr/bin/fail2ban-client ping
}
case "$1" in
@@ -50,7 +52,7 @@ case "$1" in
;;
'restart')
fail2ban_stop
- sleep 2
+ sleep 5
fail2ban_start
;;
'reload')