nixpkgs/pkgs/tools/security/tracee/default.nix

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

114 lines
2.7 KiB
Nix
Raw Normal View History

2022-05-21 12:39:32 +00:00
{ lib
, buildGoModule
, fetchFromGitHub
, clang
2022-05-21 12:39:32 +00:00
, pkg-config
, zlib
, elfutils
, libbpf
, nixosTests
, testers
, tracee
2022-05-21 12:39:32 +00:00
}:
buildGoModule rec {
pname = "tracee";
2023-04-11 12:48:35 +00:00
version = "0.13.1";
2022-05-21 12:39:32 +00:00
src = fetchFromGitHub {
owner = "aquasecurity";
repo = pname;
rev = "v${version}";
2023-04-11 12:48:35 +00:00
hash = "sha256-YO5u/hE5enoqh8niV4Zi+NFUsU+UXCCxdqvxolZImGk=";
2022-05-21 12:39:32 +00:00
};
2023-04-11 12:48:35 +00:00
vendorHash = "sha256-swMvJe+Dz/kwPIStPlQ7d6U/UwXSMcJ3eONxjzebXCc=";
patches = [
./use-our-libbpf.patch
];
2022-05-21 12:39:32 +00:00
enableParallelBuilding = true;
# needed to build bpf libs
hardeningDisable = [ "stackprotector" ];
2022-05-21 12:39:32 +00:00
nativeBuildInputs = [ pkg-config clang ];
buildInputs = [ elfutils libbpf zlib ];
2022-05-21 12:39:32 +00:00
makeFlags = [
"VERSION=v${version}"
"GO_DEBUG_FLAG=-s -w"
2022-05-21 12:39:32 +00:00
# don't actually need git but the Makefile checks for it
"CMD_GIT=echo"
];
buildPhase = ''
runHook preBuild
mkdir -p ./dist
make $makeFlags ''${enableParallelBuilding:+-j$NIX_BUILD_CORES} bpf-core all
2022-05-21 12:39:32 +00:00
runHook postBuild
'';
# tests require a separate go module
# integration tests are ran within a nixos vm
# see passthru.tests.integration
2022-05-21 12:39:32 +00:00
doCheck = false;
outputs = [ "out" "lib" "share" ];
2022-05-21 12:39:32 +00:00
installPhase = ''
runHook preInstall
mkdir -p $out/bin $lib/lib/tracee $share/share/tracee
2022-05-21 12:39:32 +00:00
mv ./dist/tracee $out/bin/
mv ./dist/tracee.bpf.core.o $lib/lib/tracee/
mv ./cmd/tracee-rules/templates $share/share/tracee/
2022-05-21 12:39:32 +00:00
runHook postInstall
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/tracee --help
$out/bin/tracee --version | grep "v${version}"
2022-05-21 12:39:32 +00:00
runHook postInstallCheck
'';
passthru.tests = {
integration = nixosTests.tracee;
version = testers.testVersion {
package = tracee;
version = "v${version}";
command = "tracee --version";
};
};
2022-05-21 12:39:32 +00:00
meta = with lib; {
homepage = "https://aquasecurity.github.io/tracee/latest/";
changelog = "https://github.com/aquasecurity/tracee/releases/tag/v${version}";
description = "Linux Runtime Security and Forensics using eBPF";
longDescription = ''
Tracee is a Runtime Security and forensics tool for Linux. It is using
Linux eBPF technology to trace your system and applications at runtime,
and analyze collected events to detect suspicious behavioral patterns. It
is delivered as a Docker image that monitors the OS and detects suspicious
behavior based on a pre-defined set of behavioral patterns.
'';
license = with licenses; [
# general license
asl20
# pkg/ebpf/c/*
gpl2Plus
];
2022-05-21 12:39:32 +00:00
maintainers = with maintainers; [ jk ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
outputsToInstall = [ "out" "share" ];
2022-05-21 12:39:32 +00:00
};
}