-
-
Save klDen/c90d9798828e31fecbb603f85e27f4f1 to your computer and use it in GitHub Desktop.
Falcon package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, lib, pkgs, dpkg, | |
openssl, libnl, zlib, | |
fetchurl, autoPatchelfHook, buildFHSUserEnv, writeScript, ... }: | |
let | |
pname = "falcon-sensor"; | |
version = "6.31.0-12803"; | |
arch = "amd64"; | |
src = /opt/CrowdStrike + "/ubuntu_${pname}_${version}_${arch}.deb"; | |
falcon-sensor = stdenv.mkDerivation { | |
inherit version arch src; | |
name = pname; | |
buildInputs = [ dpkg zlib autoPatchelfHook ]; | |
sourceRoot = "."; | |
unpackPhase = '' | |
dpkg-deb -x $src . | |
''; | |
installPhase = '' | |
cp -r . $out | |
''; | |
meta = with lib; { | |
description = "Crowdstrike Falcon Sensor"; | |
homepage = "https://www.crowdstrike.com/"; | |
license = licenses.unfree; | |
platforms = platforms.linux; | |
maintainers = with maintainers; [ klden ]; | |
}; | |
}; | |
in buildFHSUserEnv { | |
name = "fs-bash"; | |
targetPkgs = pkgs: [ libnl openssl zlib ]; | |
extraInstallCommands = '' | |
ln -s ${falcon-sensor}/* $out/ | |
''; | |
runScript = "bash"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs, ... }: | |
let | |
falcon = pkgs.callPackage ./falcon { }; | |
startPreScript = pkgs.writeScript "init-falcon" '' | |
#! ${pkgs.bash}/bin/sh | |
/run/current-system/sw/bin/mkdir -p /opt/CrowdStrike | |
ln -sf ${falcon}/opt/CrowdStrike/* /opt/CrowdStrike | |
${falcon}/bin/fs-bash -c "${falcon}/opt/CrowdStrike/falconctl -g --cid" | |
''; | |
in { | |
systemd.services.falcon-sensor = { | |
enable = true; | |
description = "CrowdStrike Falcon Sensor"; | |
unitConfig.DefaultDependencies = false; | |
after = [ "local-fs.target" ]; | |
conflicts = [ "shutdown.target" ]; | |
before = [ "sysinit.target" "shutdown.target" ]; | |
serviceConfig = { | |
ExecStartPre = "${startPreScript}"; | |
ExecStart = "${falcon}/bin/fs-bash -c \"${falcon}/opt/CrowdStrike/falcond\""; | |
Type = "forking"; | |
PIDFile = "/run/falcond.pid"; | |
Restart = "no"; | |
TimeoutStopSec = "60s"; | |
KillMode = "process"; | |
}; | |
wantedBy = [ "multi-user.target" ]; | |
}; | |
} |
Glad it worked well for you!
With this setup, I was able to get falcon running. Thank you!
This worked on falcon-sensor 7.17-0-17005
, thanks @klDen !
I modified the src slightly so that I can keep the falcon-sensor deb in the same directory:
falcon/default.nix
{ stdenv, lib, pkgs, dpkg, openssl, libnl, zlib, fetchurl, autoPatchelfHook
, buildFHSEnv, writeScript, ... }:
let
pname = "falcon-sensor";
version = "7.17.0-17005";
arch = "amd64";
src = builtins.path {
path = ./${pname}_${version}_${arch}.deb;
name = "${pname}_${version}_${arch}.deb";
};
falcon-sensor = stdenv.mkDerivation {
inherit version arch src;
name = pname;
buildInputs = [ dpkg zlib autoPatchelfHook ];
sourceRoot = ".";
unpackPhase = ''
dpkg-deb -x $src .
'';
installPhase = ''
cp -r . $out '';
meta = with lib; {
description = "Crowdstrike Falcon Sensor";
homepage = "https://www.crowdstrike.com/";
license = licenses.unfree;
platforms = platforms.linux;
maintainers = with maintainers; [ klden ];
};
};
in buildFHSEnv {
name = "fs-bash";
targetPkgs = pkgs: [ libnl openssl zlib ];
extraInstallCommands = ''
ln -s ${falcon-sensor}/* $out/
'';
runScript = "bash";
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to work great with the latest version 7. Thank you so much!