2022-12-06 21:36:17 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, pkg-config, autoreconfHook
|
2017-10-12 12:37:50 +00:00
|
|
|
, curl, apacheHttpd, pcre, apr, aprutil, libxml2
|
2022-12-06 21:36:17 +00:00
|
|
|
, luaSupport ? false, lua5, perl
|
2017-10-12 12:37:50 +00:00
|
|
|
}:
|
2015-09-23 18:28:29 +00:00
|
|
|
|
2017-10-12 12:37:50 +00:00
|
|
|
let luaValue = if luaSupport then lua5 else "no";
|
2021-01-15 09:19:50 +00:00
|
|
|
optional = lib.optional;
|
2017-10-12 12:37:50 +00:00
|
|
|
in
|
|
|
|
|
2015-09-23 18:28:29 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "modsecurity";
|
2023-01-09 02:13:29 +00:00
|
|
|
version = "2.9.7";
|
2015-09-23 18:28:29 +00:00
|
|
|
|
2022-12-06 21:36:17 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "SpiderLabs";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-01-09 02:13:29 +00:00
|
|
|
sha256 = "sha256-hJ8wYeC83dl85bkUXGZKHpHzw9QRgtusj1/+Coxsx0k=";
|
2015-09-23 18:28:29 +00:00
|
|
|
};
|
|
|
|
|
2022-12-06 21:36:17 +00:00
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook ];
|
2017-10-12 12:37:50 +00:00
|
|
|
buildInputs = [ curl apacheHttpd pcre apr aprutil libxml2 ] ++
|
|
|
|
optional luaSupport lua5;
|
|
|
|
|
2018-07-25 21:44:21 +00: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 18:28:29 +00:00
|
|
|
|
|
|
|
outputs = ["out" "nginx"];
|
2017-10-12 12:37:50 +00:00
|
|
|
# by default modsecurity's install script copies compiled output to httpd's modules folder
|
|
|
|
# this patch removes those lines
|
2022-12-06 21:36:17 +00:00
|
|
|
patches = [ ./Makefile.am.patch ];
|
|
|
|
|
|
|
|
doCheck = true;
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = [ perl ];
|
2015-09-23 18:28:29 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $nginx
|
|
|
|
cp -R * $nginx
|
|
|
|
'';
|
|
|
|
|
2023-01-24 16:35:54 +00:00
|
|
|
meta = with lib; {
|
2015-09-23 18:28:29 +00:00
|
|
|
description = "Open source, cross-platform web application firewall (WAF)";
|
|
|
|
license = licenses.asl20;
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.modsecurity.org/";
|
2015-09-23 18:28:29 +00:00
|
|
|
maintainers = with maintainers; [offline];
|
2021-01-15 13:21:58 +00:00
|
|
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
2015-09-23 18:28:29 +00:00
|
|
|
};
|
|
|
|
}
|