nixpkgs/pkgs/applications/networking/ids/zeek/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

114 lines
2.5 KiB
Nix
Raw Normal View History

2021-02-26 01:13:36 +00:00
{ lib
, stdenv
2022-07-07 08:43:54 +00:00
, callPackage
2020-07-28 00:00:00 +00:00
, fetchurl
, cmake
, flex
, bison
2022-07-07 08:43:54 +00:00
, spicy-parser-generator
2020-07-28 00:00:00 +00:00
, openssl
2022-07-07 08:43:54 +00:00
, libkqueue
2020-07-28 00:00:00 +00:00
, libpcap
, zlib
, file
, curl
, libmaxminddb
, gperftools
, python3
2020-07-28 00:00:00 +00:00
, swig
, gettext
, coreutils
, ncurses
2020-07-28 00:00:00 +00:00
}:
2021-02-26 01:13:36 +00:00
2022-07-07 08:43:54 +00:00
let
broker = callPackage ./broker { };
in
2019-09-30 02:21:21 +00:00
stdenv.mkDerivation rec {
pname = "zeek";
version = "5.2.2";
2019-09-30 02:21:21 +00:00
src = fetchurl {
2020-04-18 09:20:00 +00:00
url = "https://download.zeek.org/zeek-${version}.tar.gz";
sha256 = "sha256-4MJBV8yWpy5LvkyyipOZdDjU6FV7F8INc/zWddRGFcY=";
2019-09-30 02:21:21 +00:00
};
2022-07-07 08:43:54 +00:00
strictDeps = true;
patches = [
./avoid-broken-tests.patch
./debug-runtime-undef-fortify-source.patch
./fix-installation.patch
];
2022-01-25 23:09:49 +00:00
nativeBuildInputs = [
bison
cmake
file
flex
2022-07-07 08:43:54 +00:00
python3
2022-01-25 23:09:49 +00:00
];
buildInputs = [
2022-07-07 08:43:54 +00:00
broker
spicy-parser-generator
2022-01-25 23:09:49 +00:00
curl
gperftools
libmaxminddb
libpcap
ncurses
openssl
swig
zlib
] ++ lib.optionals stdenv.isLinux [
libkqueue
2022-01-25 23:09:49 +00:00
] ++ lib.optionals stdenv.isDarwin [
gettext
];
2019-09-30 02:21:21 +00:00
2022-07-07 08:43:54 +00:00
postPatch = ''
patchShebangs ./auxil/spicy/spicy/scripts
substituteInPlace auxil/spicy/CMakeLists.txt --replace "hilti-toolchain-tests" ""
substituteInPlace auxil/spicy/spicy/hilti/CMakeLists.txt --replace "hilti-toolchain-tests" ""
'';
2020-04-10 09:20:00 +00:00
2019-09-30 02:21:21 +00:00
cmakeFlags = [
2022-07-07 08:43:54 +00:00
"-DBroker_ROOT=${broker}"
"-DSPICY_ROOT_DIR=${spicy-parser-generator}"
2019-09-30 02:21:21 +00:00
"-DENABLE_PERFTOOLS=true"
"-DINSTALL_AUX_TOOLS=true"
2022-07-07 08:43:54 +00:00
"-DZEEK_ETC_INSTALL_DIR=/etc/zeek"
"-DZEEK_LOG_DIR=/var/log/zeek"
"-DZEEK_STATE_DIR=/var/lib/zeek"
"-DZEEK_SPOOL_DIR=/var/spool/zeek"
] ++ lib.optionals stdenv.isLinux [
"-DLIBKQUEUE_ROOT_DIR=${libkqueue}"
2019-09-30 02:21:21 +00:00
];
2021-02-26 01:13:36 +00:00
postInstall = ''
for file in $out/share/zeek/base/frameworks/notice/actions/pp-alarms.zeek $out/share/zeek/base/frameworks/notice/main.zeek; do
substituteInPlace $file \
--replace "/bin/rm" "${coreutils}/bin/rm" \
--replace "/bin/cat" "${coreutils}/bin/cat"
done
for file in $out/share/zeek/policy/misc/trim-trace-file.zeek $out/share/zeek/base/frameworks/logging/postprocessors/scp.zeek $out/share/zeek/base/frameworks/logging/postprocessors/sftp.zeek; do
substituteInPlace $file --replace "/bin/rm" "${coreutils}/bin/rm"
done
'';
2022-07-07 08:43:54 +00:00
passthru = {
inherit broker;
};
meta = with lib; {
2022-01-25 23:09:49 +00:00
description = "Network analysis framework much different from a typical IDS";
2019-09-30 02:21:21 +00:00
homepage = "https://www.zeek.org";
changelog = "https://github.com/zeek/zeek/blob/v${version}/CHANGES";
2019-09-30 02:21:21 +00:00
license = licenses.bsd3;
2019-10-02 09:00:00 +00:00
maintainers = with maintainers; [ pSub marsam tobim ];
2019-09-30 02:21:21 +00:00
platforms = platforms.unix;
};
}