pkgsrc/security/fail2ban/files/fail2ban.sh
nils 08431a1378 Initial import of security/fail2ban, version 0.9.1, into the NetBSD Packages Collection.
Fail2Ban scans log files like /var/log/pwdfail and bans IP
that makes too many password failures. It updates firewall
rules to reject the IP address. Theses rules can be defined by
the user. Fail2Ban can read multiple log files such as sshd
or Apache web server ones.
2015-02-09 10:05:25 +00:00

32 lines
733 B
Bash

#!@RCD_SCRIPTS_SHELL@
#
# PROVIDE: fail2ban
# REQUIRE: NETWORKING syslogd
#
# Add the following lines to /etc/rc.conf to enable fail2ban:
# fail2ban=YES
# fail2ban_flags="<set as needed>"
. /etc/rc.subr
name="@PKGBASE@"
rcvar=${name}
command="@PREFIX@/bin/fail2ban-server"
command_interpreter="@PYTHON_INTERP@"
client="@PREFIX@/bin/fail2ban-client"
pidfile="@VARBASE@/${name}/${name}.pid"
extra_commands="reload"
load_rc_config ${name}
start_precmd="fail2ban_precmd"
start_cmd="${client} ${fail2ban_flags} start"
stop_cmd="${client} ${fail2ban_flags} stop"
status_cmd="${client} ${fail2ban_flags} status"
reload_cmd="${client} ${fail2ban_flags} reload"
fail2ban_precmd () {
mkdir -p /var/run/fail2ban
}
run_rc_command "$1"