2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, python3 }:
|
2012-05-16 22:58:49 +00:00
|
|
|
|
|
|
|
|
2021-07-24 23:02:25 +00:00
|
|
|
python3.pkgs.buildPythonApplication rec {
|
2019-08-13 21:52:01 +00:00
|
|
|
pname = "fail2ban";
|
2021-07-24 23:02:25 +00:00
|
|
|
version = "0.11.2";
|
2012-05-16 22:58:49 +00:00
|
|
|
|
2016-03-22 01:11:25 +00:00
|
|
|
src = fetchFromGitHub {
|
2021-07-24 23:02:25 +00:00
|
|
|
owner = "fail2ban";
|
|
|
|
repo = "fail2ban";
|
|
|
|
rev = version;
|
2021-07-24 20:20:37 +00:00
|
|
|
sha256 = "q4U9iWCa1zg8sA+6pPNejt6v/41WGIKN5wITJCrCqQE=";
|
2012-05-16 22:58:49 +00:00
|
|
|
};
|
|
|
|
|
2019-12-14 20:58:10 +00:00
|
|
|
pythonPath = with python3.pkgs;
|
2021-01-15 09:19:50 +00:00
|
|
|
lib.optionals stdenv.isLinux [
|
2019-12-14 20:58:10 +00:00
|
|
|
systemd
|
|
|
|
];
|
2012-05-17 13:43:11 +00:00
|
|
|
|
2013-09-07 00:49:38 +00:00
|
|
|
preConfigure = ''
|
|
|
|
for i in config/action.d/sendmail*.conf; do
|
|
|
|
substituteInPlace $i \
|
|
|
|
--replace /usr/sbin/sendmail sendmail \
|
|
|
|
--replace /usr/bin/whois whois
|
|
|
|
done
|
2019-06-21 02:09:04 +00:00
|
|
|
|
|
|
|
substituteInPlace config/filter.d/dovecot.conf \
|
|
|
|
--replace dovecot.service dovecot2.service
|
2013-09-07 00:49:38 +00:00
|
|
|
'';
|
2012-05-16 22:58:49 +00:00
|
|
|
|
|
|
|
doCheck = false;
|
2013-10-15 16:36:45 +00:00
|
|
|
|
2015-12-13 16:36:21 +00:00
|
|
|
preInstall = ''
|
2018-03-25 14:14:48 +00:00
|
|
|
substituteInPlace setup.py --replace /usr/share/doc/ share/doc/
|
2018-10-14 14:26:38 +00:00
|
|
|
|
2015-12-13 16:36:21 +00:00
|
|
|
# see https://github.com/NixOS/nixpkgs/issues/4968
|
2019-12-14 20:58:10 +00:00
|
|
|
${python3.interpreter} setup.py install_data --install-dir=$out --root=$out
|
2015-12-13 16:36:21 +00:00
|
|
|
'';
|
|
|
|
|
2020-01-02 09:39:50 +00:00
|
|
|
postPatch = ''
|
|
|
|
${stdenv.shell} ./fail2ban-2to3
|
|
|
|
'';
|
|
|
|
|
2021-07-24 23:02:25 +00:00
|
|
|
postInstall =
|
|
|
|
let
|
|
|
|
sitePackages = "$out/${python3.sitePackages}";
|
|
|
|
in
|
|
|
|
''
|
|
|
|
# see https://github.com/NixOS/nixpkgs/issues/4968
|
|
|
|
rm -r ${sitePackages}/etc ${sitePackages}/usr
|
|
|
|
'';
|
2015-12-13 16:36:21 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2021-07-24 23:02:25 +00:00
|
|
|
homepage = "https://www.fail2ban.org/";
|
2012-05-16 22:58:49 +00:00
|
|
|
description = "A program that scans log files for repeated failing login attempts and bans IP addresses";
|
2021-07-24 23:02:25 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2016-03-22 01:11:25 +00:00
|
|
|
maintainers = with maintainers; [ eelco lovek323 fpletz ];
|
2021-07-24 23:02:25 +00:00
|
|
|
platforms = platforms.unix;
|
2012-05-16 22:58:49 +00:00
|
|
|
};
|
|
|
|
}
|