Fail2Ban scans log files like /var/log/auth.log and bans IP addresses having
too many failed login attempts. It does this by updating system firewall rules
to reject new connections from those IP addresses, for a configurable amount of
time. Fail2Ban comes out-of-the-box ready to read many standard log files, such
as those for sshd and Apache, and is easy to configure to read any log file you
choose, for any error you choose.
Though Fail2Ban is able to reduce the rate of incorrect authentications
attempts, it cannot eliminate the risk that weak authentication presents.
Configure services to use only two factor or public/private authentication
mechanisms if you really want to protect services.
Signed-off-by: Armin Kuster
---
recipes-security/fail2ban/fail2ban_0.10.0.bb | 41 +
recipes-security/fail2ban/files/fail2ban_setup.py | 175 ++
recipes-security/fail2ban/files/initd | 98
3 files changed, 314 insertions(+)
create mode 100644 recipes-security/fail2ban/fail2ban_0.10.0.bb
create mode 100755 recipes-security/fail2ban/files/fail2ban_setup.py
create mode 100644 recipes-security/fail2ban/files/initd
diff --git a/recipes-security/fail2ban/fail2ban_0.10.0.bb
b/recipes-security/fail2ban/fail2ban_0.10.0.bb
new file mode 100644
index 000..1beeb5b
--- /dev/null
+++ b/recipes-security/fail2ban/fail2ban_0.10.0.bb
@@ -0,0 +1,41 @@
+SUMMARY = "Daemon to ban hosts that cause multiple authentication errors."
+DESCIPTION = "Fail2Ban scans log files like /var/log/auth.log and bans IP
addresses having too \
+many failed login attempts. It does this by updating system firewall rules to
reject new \
+connections from those IP addresses, for a configurable amount of time.
Fail2Ban comes \
+out-of-the-box ready to read many standard log files, such as those for sshd
and Apache, \
+and is easy to configure to read any log file you choose, for any error you
choose."
+HOMEPAGE = "http://www.fail2ban.org;
+
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=ecabc31e90311da843753ba772885d9f"
+
+SRCREV ="c60784540c5307d16cdc136ace5b395961492e73"
+SRC_URI = " \
+ git://github.com/fail2ban/fail2ban.git;branch=0.10 \
+ file://initd \
+ file://fail2ban_setup.py \
+"
+
+inherit update-rc.d setuptools
+
+S = "${WORKDIR}/git"
+
+INITSCRIPT_PACKAGES = "${PN}"
+INITSCRIPT_NAME = "fail2ban-server"
+INITSCRIPT_PARAMS = "defaults 25"
+
+do_compile_prepend () {
+cp ${WORKDIR}/fail2ban_setup.py ${S}/setup.py
+}
+
+do_install_append () {
+ install -d ${D}/${sysconfdir}/fail2ban
+ install -d ${D}/${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/initd
${D}${sysconfdir}/init.d/fail2ban-server
+}
+
+FILES_${PN} += "/run"
+
+INSANE_SKIP_${PN}_append = "already-stripped"
+
+RDEPENDS_${PN} = "sysklogd iptables sqlite3 python python-pyinotify"
diff --git a/recipes-security/fail2ban/files/fail2ban_setup.py
b/recipes-security/fail2ban/files/fail2ban_setup.py
new file mode 100755
index 000..a5d4ed6
--- /dev/null
+++ b/recipes-security/fail2ban/files/fail2ban_setup.py
@@ -0,0 +1,175 @@
+#!/usr/bin/env python
+# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
+# vi: set ft=python sts=4 ts=4 sw=4 noet :
+
+# 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__ = "Cyril Jaquier, Steven Hiscocks, Yaroslav Halchenko"
+__copyright__ = "Copyright (c) 2004 Cyril Jaquier, 2008-2016 Fail2Ban
Contributors"
+__license__ = "GPL"
+
+import platform
+
+try:
+ import setuptools
+ from setuptools import setup
+ from setuptools.command.install import install
+ from setuptools.command.install_scripts import install_scripts
+except ImportError:
+ setuptools = None
+ from distutils.core import setup
+
+# all versions
+from distutils.command.build_py import build_py
+from distutils.command.build_scripts import build_scripts
+if setuptools is None:
+ from distutils.command.install import install
+ from distutils.command.install_scripts import install_scripts
+try:
+ # python 3.x
+ from distutils.command.build_py import build_py_2to3
+ from distutils.command.build_scripts import build_scripts_2to3
+ _2to3 = True
+except ImportError:
+