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