mirror of https://github.com/fail2ban/fail2ban
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.0 KiB
58 lines
2.0 KiB
7 years ago
|
#!/sbin/openrc-run
|
||
19 years ago
|
# This file is part of Fail2Ban.
|
||
|
#
|
||
|
# Fail2Ban is free software; you can redistribute it and/or modify
|
||
|
# it under the terms of the GNU General Public License as published by
|
||
|
# the Free Software Foundation; either version 2 of the License, or
|
||
|
# (at your option) any later version.
|
||
|
#
|
||
|
# Fail2Ban is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with Fail2Ban; if not, write to the Free Software
|
||
13 years ago
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
19 years ago
|
#
|
||
|
# Author: Sireyessire, Cyril Jaquier
|
||
13 years ago
|
#
|
||
19 years ago
|
|
||
6 years ago
|
description="Ban hosts that cause multiple authentication errors"
|
||
7 years ago
|
description_reload="reload configuration"
|
||
6 years ago
|
extra_started_commands="reload"
|
||
19 years ago
|
|
||
6 years ago
|
# Can't (and shouldn't) be changed by the end-user.
|
||
|
FAIL2BAN_RUNDIR="/run/${RC_SVCNAME}"
|
||
|
FAIL2BAN_SOCKET="${FAIL2BAN_RUNDIR}/${RC_SVCNAME}.sock"
|
||
|
|
||
6 years ago
|
# The fail2ban-client program is also capable of starting and stopping
|
||
|
# the server, but things are simpler if we let start-stop-daemon do it.
|
||
6 years ago
|
command="@BINDIR@/fail2ban-server"
|
||
6 years ago
|
pidfile="${FAIL2BAN_RUNDIR}/${RC_SVCNAME}.pid"
|
||
|
|
||
|
# We force the pidfile/socket location in this service script because
|
||
|
# we're taking responsibility for ensuring that their parent directory
|
||
|
# exists and has the correct permissions (which we can't do if the
|
||
|
# user is allowed to change them).
|
||
|
command_args="${FAIL2BAN_OPTIONS} -p ${pidfile} -s ${FAIL2BAN_SOCKET}"
|
||
6 years ago
|
retry="30"
|
||
19 years ago
|
|
||
|
depend() {
|
||
6 years ago
|
use logger
|
||
19 years ago
|
after iptables
|
||
|
}
|
||
|
|
||
6 years ago
|
start_pre() {
|
||
6 years ago
|
checkpath -d "${FAIL2BAN_RUNDIR}" || return 1
|
||
19 years ago
|
}
|
||
|
|
||
|
reload() {
|
||
6 years ago
|
# The fail2ban-client uses an undocumented protocol to tell
|
||
|
# the server to reload(), so we have to use it here rather
|
||
|
# than e.g. sending a signal to the server daemon.
|
||
6 years ago
|
ebegin "Reloading ${RC_SVCNAME}"
|
||
6 years ago
|
"@BINDIR@/fail2ban-client" ${command_args} reload
|
||
6 years ago
|
eend $? "Failed to reload ${RC_SVCNAME}"
|
||
19 years ago
|
}
|