diff options
Diffstat (limited to 'nixpkgs/pkgs/tools/security/fail2ban/default.nix')
-rw-r--r-- | nixpkgs/pkgs/tools/security/fail2ban/default.nix | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/nixpkgs/pkgs/tools/security/fail2ban/default.nix b/nixpkgs/pkgs/tools/security/fail2ban/default.nix index 459f9f12c1ea..780f1b4dfb0c 100644 --- a/nixpkgs/pkgs/tools/security/fail2ban/default.nix +++ b/nixpkgs/pkgs/tools/security/fail2ban/default.nix @@ -1,50 +1,36 @@ { lib, stdenv, fetchFromGitHub , python3 -, fetchpatch +, installShellFiles }: python3.pkgs.buildPythonApplication rec { pname = "fail2ban"; - version = "0.11.2"; + version = "1.0.2"; src = fetchFromGitHub { owner = "fail2ban"; repo = "fail2ban"; rev = version; - sha256 = "q4U9iWCa1zg8sA+6pPNejt6v/41WGIKN5wITJCrCqQE="; + hash = "sha256-Zd8zLkFlvXTbeInEkNFyHgcAiOsX4WwF6hf5juSQvbY="; }; + outputs = [ "out" "man" ]; + + nativeBuildInputs = [ installShellFiles ]; + pythonPath = with python3.pkgs; lib.optionals stdenv.isLinux [ systemd pyinotify ]; - patches = [ - # remove references to use_2to3, for setuptools>=58 - # has been merged into master, remove next release - (fetchpatch { - url = "https://github.com/fail2ban/fail2ban/commit/5ac303df8a171f748330d4c645ccbf1c2c7f3497.patch"; - sha256 = "sha256-aozQJHwPcJTe/D/PLQzBk1YH3OAP6Qm7wO7cai5CVYI="; - }) - # fix use of MutableMapping with Python >= 3.10 - # https://github.com/fail2ban/fail2ban/issues/3142 - (fetchpatch { - url = "https://github.com/fail2ban/fail2ban/commit/294ec73f629d0e29cece3a1eb5dd60b6fccea41f.patch"; - sha256 = "sha256-Eimm4xjBDYNn5QdTyMqGgT5EXsZdd/txxcWJojXlsFE="; - }) - ]; - preConfigure = '' - # workaround for setuptools 58+ - # https://github.com/fail2ban/fail2ban/issues/3098 patchShebangs fail2ban-2to3 ./fail2ban-2to3 for i in config/action.d/sendmail*.conf; do substituteInPlace $i \ - --replace /usr/sbin/sendmail sendmail \ - --replace /usr/bin/whois whois + --replace /usr/sbin/sendmail sendmail done substituteInPlace config/filter.d/dovecot.conf \ @@ -60,17 +46,21 @@ python3.pkgs.buildPythonApplication rec { ${python3.interpreter} setup.py install_data --install-dir=$out --root=$out ''; - postPatch = '' - ${stdenv.shell} ./fail2ban-2to3 - ''; - postInstall = let sitePackages = "$out/${python3.sitePackages}"; in '' + install -m 644 -D -t "$out/lib/systemd/system" build/fail2ban.service + # Replace binary paths + sed -i "s#build/bdist.*/wheel/fail2ban.*/scripts/#$out/bin/#g" $out/lib/systemd/system/fail2ban.service + # Delete creating the runtime directory, systemd does that + sed -i "/ExecStartPre/d" $out/lib/systemd/system/fail2ban.service + # see https://github.com/NixOS/nixpkgs/issues/4968 rm -r "${sitePackages}/etc" + + installManPage man/*.[1-9] '' + lib.optionalString stdenv.isLinux '' # see https://github.com/NixOS/nixpkgs/issues/4968 rm -r "${sitePackages}/usr" @@ -81,6 +71,5 @@ python3.pkgs.buildPythonApplication rec { description = "A program that scans log files for repeated failing login attempts and bans IP addresses"; license = licenses.gpl2Plus; maintainers = with maintainers; [ eelco lovek323 ]; - platforms = platforms.unix; }; } |