From 884f708bd7f4b48c90503752d927975ba10dafbc Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 15 Jul 2018 09:07:28 -0400 Subject: fail2ban/files: rename "gentoo" files to "openrc". We ship a service script and configuration file for "gentoo" that are actually more generally applicable: they work on any system where OpenRC is used. This commit simply renames the files from "gentoo" to "openrc" to reflect the fact that they are in no way Gentoo-specific. --- files/fail2ban-openrc.conf | 8 +++++++ files/fail2ban-openrc.init | 60 ++++++++++++++++++++++++++++++++++++++++++++++ files/gentoo-confd | 8 ------- files/gentoo-initd | 60 ---------------------------------------------- 4 files changed, 68 insertions(+), 68 deletions(-) create mode 100644 files/fail2ban-openrc.conf create mode 100755 files/fail2ban-openrc.init delete mode 100644 files/gentoo-confd delete mode 100755 files/gentoo-initd (limited to 'files') diff --git a/files/fail2ban-openrc.conf b/files/fail2ban-openrc.conf new file mode 100644 index 00000000..00d19f8b --- /dev/null +++ b/files/fail2ban-openrc.conf @@ -0,0 +1,8 @@ +# Config file for /etc/init.d/fail2ban +# +# For information on options, see "/usr/bin/fail2ban-client -h". + +FAIL2BAN_OPTIONS="" + +# Force execution of the server even if the socket already exists: +#FAIL2BAN_OPTIONS="-x" diff --git a/files/fail2ban-openrc.init b/files/fail2ban-openrc.init new file mode 100755 index 00000000..0fb157cd --- /dev/null +++ b/files/fail2ban-openrc.init @@ -0,0 +1,60 @@ +#!/sbin/openrc-run +# 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 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Sireyessire, Cyril Jaquier +# + +description="Daemon to ban hosts that cause multiple authentication errors" +description_reload="reload configuration" +description_showlog="show fail2ban logs" +extra_started_commands="reload showlog" + +FAIL2BAN="/usr/bin/fail2ban-client ${FAIL2BAN_OPTIONS}" + +depend() { + need net + need logger + after iptables +} + +start() { + ebegin "Starting fail2ban" + mkdir -p /var/run/fail2ban || return 1 + # remove stalled sock file after system crash + # bug 347477 + rm -f /var/run/fail2ban/fail2ban.sock || return 1 + start-stop-daemon --start --pidfile /var/run/fail2ban/fail2ban.pid \ + -- ${FAIL2BAN} start + eend $? "Failed to start fail2ban" +} + +stop() { + ebegin "Stopping fail2ban" + start-stop-daemon --stop --pidfile /var/run/fail2ban/fail2ban.pid --retry 30 \ + -- ${FAIL2BAN} stop + eend $? "Failed to stop fail2ban" +} + +reload() { + ebegin "Reloading fail2ban" + ${FAIL2BAN} reload + eend $? "Failed to reload fail2ban" +} + +showlog(){ + less /var/log/fail2ban.log +} diff --git a/files/gentoo-confd b/files/gentoo-confd deleted file mode 100644 index 00d19f8b..00000000 --- a/files/gentoo-confd +++ /dev/null @@ -1,8 +0,0 @@ -# Config file for /etc/init.d/fail2ban -# -# For information on options, see "/usr/bin/fail2ban-client -h". - -FAIL2BAN_OPTIONS="" - -# Force execution of the server even if the socket already exists: -#FAIL2BAN_OPTIONS="-x" diff --git a/files/gentoo-initd b/files/gentoo-initd deleted file mode 100755 index 0fb157cd..00000000 --- a/files/gentoo-initd +++ /dev/null @@ -1,60 +0,0 @@ -#!/sbin/openrc-run -# 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 -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Author: Sireyessire, Cyril Jaquier -# - -description="Daemon to ban hosts that cause multiple authentication errors" -description_reload="reload configuration" -description_showlog="show fail2ban logs" -extra_started_commands="reload showlog" - -FAIL2BAN="/usr/bin/fail2ban-client ${FAIL2BAN_OPTIONS}" - -depend() { - need net - need logger - after iptables -} - -start() { - ebegin "Starting fail2ban" - mkdir -p /var/run/fail2ban || return 1 - # remove stalled sock file after system crash - # bug 347477 - rm -f /var/run/fail2ban/fail2ban.sock || return 1 - start-stop-daemon --start --pidfile /var/run/fail2ban/fail2ban.pid \ - -- ${FAIL2BAN} start - eend $? "Failed to start fail2ban" -} - -stop() { - ebegin "Stopping fail2ban" - start-stop-daemon --stop --pidfile /var/run/fail2ban/fail2ban.pid --retry 30 \ - -- ${FAIL2BAN} stop - eend $? "Failed to stop fail2ban" -} - -reload() { - ebegin "Reloading fail2ban" - ${FAIL2BAN} reload - eend $? "Failed to reload fail2ban" -} - -showlog(){ - less /var/log/fail2ban.log -} -- cgit v1.2.1