blob: 68695f2bb1a65007c8b600cd3ccc081aa91a8030 [file] [log] [blame]
Brad Bishopa48c0142020-01-06 09:48:41 -05001SUMMARY = "Daemon to ban hosts that cause multiple authentication errors."
2DESCRIPTION = "Fail2Ban scans log files like /var/log/auth.log and bans IP addresses having too \
3many failed login attempts. It does this by updating system firewall rules to reject new \
4connections from those IP addresses, for a configurable amount of time. Fail2Ban comes \
5out-of-the-box ready to read many standard log files, such as those for sshd and Apache, \
6and is easy to configure to read any log file you choose, for any error you choose."
7HOMEPAGE = "http://www.fail2ban.org"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08008
Andrew Geissler9aee5002022-03-30 16:27:02 +00009LICENSE = "GPL-2.0-only"
Brad Bishopa48c0142020-01-06 09:48:41 -050010LIC_FILES_CHKSUM = "file://COPYING;md5=ecabc31e90311da843753ba772885d9f"
Brad Bishop15ae2502019-06-18 21:44:24 -040011
Patrick Williamsde0582f2022-04-08 10:23:27 -050012DEPENDS = "python3-native"
13
Andrew Geissler2daf84b2023-03-31 09:57:23 -050014SRCREV = "e1d3006b0330e9777705a7baafe3989d442ed120"
15SRC_URI = "git://github.com/fail2ban/fail2ban.git;branch=master;protocol=https \
16 file://initd \
17 file://run-ptest \
18 "
Brad Bishopa48c0142020-01-06 09:48:41 -050019
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050020UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
21
Andrew Geissler9aee5002022-03-30 16:27:02 +000022inherit update-rc.d ptest setuptools3_legacy
Andrew Geissler20137392023-10-12 04:59:14 -060023inherit systemd
24
25SYSTEMD_SERVICE:${PN} = "fail2ban.service"
Brad Bishopa48c0142020-01-06 09:48:41 -050026
27S = "${WORKDIR}/git"
28
Patrick Williams53961c22022-01-20 11:06:23 -060029do_compile () {
Andrew Geissler8b139282021-03-05 15:22:30 -060030 cd ${S}
Patrick Williamsde0582f2022-04-08 10:23:27 -050031
32 #remove symlink to python3
33 # otherwise 2to3 is run against it
34 rm -f bin/fail2ban-python
35
Andrew Geissler8b139282021-03-05 15:22:30 -060036 ./fail2ban-2to3
Brad Bishopa48c0142020-01-06 09:48:41 -050037}
38
Patrick Williams213cb262021-08-07 19:21:33 -050039do_install:append () {
Patrick Williams53961c22022-01-20 11:06:23 -060040 rm -f ${D}/${bindir}/fail2ban-python
Andrew Geissler1fe918a2020-05-15 14:16:47 -050041 install -d ${D}/${sysconfdir}/fail2ban
42 install -d ${D}/${sysconfdir}/init.d
43 install -m 0755 ${WORKDIR}/initd ${D}${sysconfdir}/init.d/fail2ban-server
Andrew Geissler20137392023-10-12 04:59:14 -060044
45 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
46 install -d ${D}${systemd_system_unitdir}
47 install -m 0644 ${B}/fail2ban.service ${D}${systemd_system_unitdir}
48 fi
49
Andrew Geissler1fe918a2020-05-15 14:16:47 -050050 chown -R root:root ${D}/${bindir}
Patrick Williams53961c22022-01-20 11:06:23 -060051 rm -rf ${D}/run
Brad Bishopa48c0142020-01-06 09:48:41 -050052}
53
Patrick Williams213cb262021-08-07 19:21:33 -050054do_install_ptest:append () {
Andrew Geissler1fe918a2020-05-15 14:16:47 -050055 install -d ${D}${PTEST_PATH}
Andrew Geissler9d3cc052021-03-31 13:36:22 -050056 install -d ${D}${PTEST_PATH}/bin
Andrew Geissler1fe918a2020-05-15 14:16:47 -050057 sed -i -e 's/##PYTHON##/${PYTHON_PN}/g' ${D}${PTEST_PATH}/run-ptest
Andrew Geissler9d3cc052021-03-31 13:36:22 -050058 install -D ${S}/bin/* ${D}${PTEST_PATH}/bin
Patrick Williams53961c22022-01-20 11:06:23 -060059 rm -f ${D}${PTEST_PATH}/bin/fail2ban-python
Brad Bishopa48c0142020-01-06 09:48:41 -050060}
61
Brad Bishopa48c0142020-01-06 09:48:41 -050062
63INITSCRIPT_PACKAGES = "${PN}"
64INITSCRIPT_NAME = "fail2ban-server"
65INITSCRIPT_PARAMS = "defaults 25"
66
Patrick Williams213cb262021-08-07 19:21:33 -050067INSANE_SKIP:${PN}:append = "already-stripped"
Brad Bishopa48c0142020-01-06 09:48:41 -050068
Andrew Geissler20137392023-10-12 04:59:14 -060069RDEPENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog} iptables python3-core python3-pyinotify"
70RDEPENDS:${PN} += "python3-sqlite3"
Patrick Williams213cb262021-08-07 19:21:33 -050071RDEPENDS:${PN} += " python3-logging python3-fcntl python3-json"
72RDEPENDS:${PN}-ptest = "python3-core python3-io python3-modules python3-fail2ban"
Andrew Geissler20137392023-10-12 04:59:14 -060073
74RRECOMMENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'python3-systemd', '', d)}"
75RRECOMMENDS:${PN} += "python3-distutils"