3311064278
Fail2ban scans log files (e.g. /var/log/apache/error_log) and bans IPs that show malicious behaviours. Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com> [Thomas: simplify $(SED) expression by using comma as a separator instead of slash.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
24 lines
442 B
Bash
24 lines
442 B
Bash
#!/bin/sh
|
|
|
|
case "$1" in
|
|
start)
|
|
printf "Starting fail2ban: "
|
|
start-stop-daemon -S -q -m -p /var/run/fail2ban.pid \
|
|
-b -x fail2ban-server -- -xf start
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
|
;;
|
|
stop)
|
|
printf "Stopping fail2ban: "
|
|
start-stop-daemon -K -q -p /var/run/fail2ban.pid
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
|
;;
|
|
restart)
|
|
"$0" stop
|
|
sleep 1
|
|
"$0" start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
;;
|
|
esac
|