nixpkgs/pkgs/tools/security/fail2ban/default.nix

61 lines
1.5 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, python3 }:
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";
2016-03-22 01:11:25 +00:00
src = fetchFromGitHub {
2021-07-24 23:02:25 +00:00
owner = "fail2ban";
repo = "fail2ban";
rev = version;
sha256 = "q4U9iWCa1zg8sA+6pPNejt6v/41WGIKN5wITJCrCqQE=";
};
pythonPath = with python3.pkgs;
2021-01-15 09:19:50 +00:00
lib.optionals stdenv.isLinux [
systemd
];
preConfigure = ''
for i in config/action.d/sendmail*.conf; do
substituteInPlace $i \
--replace /usr/sbin/sendmail sendmail \
--replace /usr/bin/whois whois
done
substituteInPlace config/filter.d/dovecot.conf \
--replace dovecot.service dovecot2.service
'';
doCheck = false;
preInstall = ''
substituteInPlace setup.py --replace /usr/share/doc/ share/doc/
2018-10-14 14:26:38 +00:00
# see https://github.com/NixOS/nixpkgs/issues/4968
${python3.interpreter} setup.py install_data --install-dir=$out --root=$out
'';
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
'';
meta = with lib; {
2021-07-24 23:02:25 +00:00
homepage = "https://www.fail2ban.org/";
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;
};
}