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