Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 1 | SUMMARY = "Daemon to ban hosts that cause multiple authentication errors." |
| 2 | DESCRIPTION = "Fail2Ban scans log files like /var/log/auth.log and bans IP addresses having too \ |
| 3 | many failed login attempts. It does this by updating system firewall rules to reject new \ |
| 4 | connections from those IP addresses, for a configurable amount of time. Fail2Ban comes \ |
| 5 | out-of-the-box ready to read many standard log files, such as those for sshd and Apache, \ |
| 6 | and is easy to configure to read any log file you choose, for any error you choose." |
| 7 | HOMEPAGE = "http://www.fail2ban.org" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 8 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 9 | LICENSE = "GPL-2.0-only" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 10 | LIC_FILES_CHKSUM = "file://COPYING;md5=ecabc31e90311da843753ba772885d9f" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 11 | |
Patrick Williams | de0582f | 2022-04-08 10:23:27 -0500 | [diff] [blame] | 12 | DEPENDS = "python3-native" |
| 13 | |
Andrew Geissler | 2daf84b | 2023-03-31 09:57:23 -0500 | [diff] [blame] | 14 | SRCREV = "e1d3006b0330e9777705a7baafe3989d442ed120" |
| 15 | SRC_URI = "git://github.com/fail2ban/fail2ban.git;branch=master;protocol=https \ |
| 16 | file://initd \ |
| 17 | file://run-ptest \ |
| 18 | " |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 19 | |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 20 | UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)" |
| 21 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 22 | inherit update-rc.d ptest setuptools3_legacy |
Andrew Geissler | 2013739 | 2023-10-12 04:59:14 -0600 | [diff] [blame^] | 23 | inherit systemd |
| 24 | |
| 25 | SYSTEMD_SERVICE:${PN} = "fail2ban.service" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 26 | |
| 27 | S = "${WORKDIR}/git" |
| 28 | |
Patrick Williams | 53961c2 | 2022-01-20 11:06:23 -0600 | [diff] [blame] | 29 | do_compile () { |
Andrew Geissler | 8b13928 | 2021-03-05 15:22:30 -0600 | [diff] [blame] | 30 | cd ${S} |
Patrick Williams | de0582f | 2022-04-08 10:23:27 -0500 | [diff] [blame] | 31 | |
| 32 | #remove symlink to python3 |
| 33 | # otherwise 2to3 is run against it |
| 34 | rm -f bin/fail2ban-python |
| 35 | |
Andrew Geissler | 8b13928 | 2021-03-05 15:22:30 -0600 | [diff] [blame] | 36 | ./fail2ban-2to3 |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 37 | } |
| 38 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 39 | do_install:append () { |
Patrick Williams | 53961c2 | 2022-01-20 11:06:23 -0600 | [diff] [blame] | 40 | rm -f ${D}/${bindir}/fail2ban-python |
Andrew Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 41 | 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 Geissler | 2013739 | 2023-10-12 04:59:14 -0600 | [diff] [blame^] | 44 | |
| 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 Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 50 | chown -R root:root ${D}/${bindir} |
Patrick Williams | 53961c2 | 2022-01-20 11:06:23 -0600 | [diff] [blame] | 51 | rm -rf ${D}/run |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 52 | } |
| 53 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 54 | do_install_ptest:append () { |
Andrew Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 55 | install -d ${D}${PTEST_PATH} |
Andrew Geissler | 9d3cc05 | 2021-03-31 13:36:22 -0500 | [diff] [blame] | 56 | install -d ${D}${PTEST_PATH}/bin |
Andrew Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 57 | sed -i -e 's/##PYTHON##/${PYTHON_PN}/g' ${D}${PTEST_PATH}/run-ptest |
Andrew Geissler | 9d3cc05 | 2021-03-31 13:36:22 -0500 | [diff] [blame] | 58 | install -D ${S}/bin/* ${D}${PTEST_PATH}/bin |
Patrick Williams | 53961c2 | 2022-01-20 11:06:23 -0600 | [diff] [blame] | 59 | rm -f ${D}${PTEST_PATH}/bin/fail2ban-python |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 60 | } |
| 61 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 62 | |
| 63 | INITSCRIPT_PACKAGES = "${PN}" |
| 64 | INITSCRIPT_NAME = "fail2ban-server" |
| 65 | INITSCRIPT_PARAMS = "defaults 25" |
| 66 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 67 | INSANE_SKIP:${PN}:append = "already-stripped" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 68 | |
Andrew Geissler | 2013739 | 2023-10-12 04:59:14 -0600 | [diff] [blame^] | 69 | RDEPENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog} iptables python3-core python3-pyinotify" |
| 70 | RDEPENDS:${PN} += "python3-sqlite3" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 71 | RDEPENDS:${PN} += " python3-logging python3-fcntl python3-json" |
| 72 | RDEPENDS:${PN}-ptest = "python3-core python3-io python3-modules python3-fail2ban" |
Andrew Geissler | 2013739 | 2023-10-12 04:59:14 -0600 | [diff] [blame^] | 73 | |
| 74 | RRECOMMENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'python3-systemd', '', d)}" |
| 75 | RRECOMMENDS:${PN} += "python3-distutils" |