Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, apacheHttpd }:
2
3if lib.versionAtLeast (lib.getVersion apacheHttpd) "2.4" then
4
5 throw "mod_evasive is not supported on Apache httpd 2.4"
6
7else
8
9stdenv.mkDerivation {
10 name = "mod_evasive-1.10.1";
11
12 src = fetchurl {
13 url = "http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz";
14 sha256 = "0rsnx50rjv6xygbp9r0gyss7xqdkcb0hy3wh9949jf1im8wm3i07";
15 };
16
17 buildInputs = [ apacheHttpd ];
18
19 buildPhase = ''
20 export APACHE_LIBEXECDIR=$out/modules
21 export makeFlagsArray=(APACHE_LIBEXECDIR=$out/modules)
22 apxs -ca mod_evasive20.c
23 '';
24
25 installPhase = ''
26 mkdir -p $out/modules
27 cp .libs/mod_evasive20.so $out/modules
28 '';
29
30 meta = {
31 homepage = "http://www.zdziarski.com/blog/?page_id=442";
32 description = "Evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack";
33 platforms = stdenv.lib.platforms.linux;
34 };
35}