2015-10-05 13:23:01 +02:00
|
|
|
{ stdenv, lib, fetchurl, pkgconfig
|
2017-10-12 14:37:50 +02:00
|
|
|
, curl, apacheHttpd, pcre, apr, aprutil, libxml2
|
|
|
|
, luaSupport ? false, lua5
|
|
|
|
}:
|
2015-09-23 20:28:29 +02:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2017-10-12 14:37:50 +02:00
|
|
|
let luaValue = if luaSupport then lua5 else "no";
|
|
|
|
optional = stdenv.lib.optional;
|
|
|
|
in
|
|
|
|
|
2015-09-23 20:28:29 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "modsecurity";
|
2019-03-11 01:50:38 +01:00
|
|
|
version = "2.9.3";
|
2015-09-23 20:28:29 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 14:41:18 +02:00
|
|
|
url = "https://www.modsecurity.org/tarball/${version}/${pname}-${version}.tar.gz";
|
2019-03-11 01:50:38 +01:00
|
|
|
sha256 = "0611nskd2y6yagrciqafxdn4rxbdk2v4swf45kc1sgwx2sfh34j1";
|
2015-09-23 20:28:29 +02:00
|
|
|
};
|
|
|
|
|
2015-10-05 13:23:01 +02:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2017-10-12 14:37:50 +02:00
|
|
|
buildInputs = [ curl apacheHttpd pcre apr aprutil libxml2 ] ++
|
|
|
|
optional luaSupport lua5;
|
|
|
|
|
2018-07-25 23:44:21 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-standalone-module"
|
|
|
|
"--enable-static"
|
|
|
|
"--with-curl=${curl.dev}"
|
|
|
|
"--with-apxs=${apacheHttpd.dev}/bin/apxs"
|
|
|
|
"--with-pcre=${pcre.dev}"
|
|
|
|
"--with-apr=${apr.dev}"
|
|
|
|
"--with-apu=${aprutil.dev}/bin/apu-1-config"
|
|
|
|
"--with-libxml=${libxml2.dev}"
|
|
|
|
"--with-lua=${luaValue}"
|
|
|
|
];
|
2015-09-23 20:28:29 +02:00
|
|
|
|
|
|
|
outputs = ["out" "nginx"];
|
2017-10-12 14:37:50 +02:00
|
|
|
# by default modsecurity's install script copies compiled output to httpd's modules folder
|
|
|
|
# this patch removes those lines
|
|
|
|
patches = [ ./Makefile.in.patch ];
|
2015-09-23 20:28:29 +02:00
|
|
|
|
|
|
|
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];
|
2017-10-12 14:37:50 +02:00
|
|
|
platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
|
2015-09-23 20:28:29 +02:00
|
|
|
};
|
|
|
|
}
|