summary refs log tree commit diff
path: root/pkgs/tools/security/modsecurity/default.nix
blob: 5ed6c9ecdc4a9924d08019fa750f51ae9c2c6a4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ stdenv, lib, fetchurl
, curl, apacheHttpd, pcre, apr, aprutil, libxml2 }:

with lib;

stdenv.mkDerivation rec {
  name = "modsecurity-${version}";
  version = "2.9.0";

  src = fetchurl {
    url = "https://www.modsecurity.org/tarball/${version}/${name}.tar.gz";
    sha256 = "e2bbf789966c1f80094d88d9085a81bde082b2054f8e38e0db571ca49208f434";
  };

  buildInputs = [ curl apacheHttpd pcre apr aprutil libxml2 ];
  configureFlags = [
    "--enable-standalone-module"
    "--enable-static"
    "--with-curl=${curl}"
    "--with-apxs=${apacheHttpd}/bin/apxs"
    "--with-pcre=${pcre}"
    "--with-apr=${apr}"
    "--with-apu=${aprutil}/bin/apu-1-config"
    "--with-libxml=${libxml2}"
  ];

  outputs = ["out" "nginx"];

  preBuild = ''
    substituteInPlace apache2/Makefile.in --replace "install -D " "# install -D"
  '';

  postInstall = ''
    mkdir -p $nginx
    cp -R * $nginx
  '';

  meta = {
    description = "Open source, cross-platform web application firewall (WAF)";
    license = licenses.asl20;
    homepage = https://www.modsecurity.org/;
    maintainers = with maintainers; [offline];
    platforms = with platforms; linux;
  };
}