Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hardenedlinux/zeek2nix

An operator which calls zeek to nix-ecosystem simply.
https://github.com/hardenedlinux/zeek2nix

ids network-monitoring nix zeek zeek-ids zeek-package

Last synced: 3 months ago
JSON representation

An operator which calls zeek to nix-ecosystem simply.

Awesome Lists containing this project

README

        

#+TITLE: Zeek to Nix Flake's feature

* Building Zeek with nix-shell(shell mode)
#+begin_src sh :async t :exports both :results output
nix develop
# or
nix-shell
#+end_src

* Library

** Building zeek with plugins

#+begin_src nix :async :exports both :results output
mkZeekPlugins = inputs.zeek2nix.lib.zeekWithPlugins {
package = inputs.zeek2nix.packages.${system}.zeek-latest;
plugins = [
{
src = inputs.zeek2nix.lib.nixpkgs.zeek-sources.zeek-community-id;
}
];
};
#+end_src

** Testing your Zeek Plugin src with Nix-CI

#+begin_src nix :async :exports both :results output
mkZeekPluginCI = nixpkgs.zeekPluginCi {
plugins = [
{
src = inputs.zeek2nix.lib.nixpkgs.zeek-sources.zeek-netmap;
}
];
buildInputs = [inputs.zeek2nix.lib.nixpkgs.netmap];
};
#+end_src

* Deploying Zeek with NixOS (flakes feature)
#+begin_src nix :async t :exports both :results output
{
inputs =
{
zeek-nix = {
url = "github:hardenedlinux/zeek-nix/main";
inputs.nixpkgs.follows = "nixos";
};
"..."
};
outputs = { self, zeek-nix, nixpkgs, ... }: {
nixosConfigurations.myConfig = nixpkgs.lib.nixosSystem {
system = "...";

modules = [
zeek-nix.nixosModules.zeek
({ ... }: {
services.zeek = {
enable = true;
standalone = true;
interface = "eno1";
listenAddress = "localhost";
package = pkgs.zeekWithPlugins {
package = pkgs.zeek-latest;
plugins = [
{
src = pkgs.zeek-sources.zeek-community-id;
}
];
};

privateScript = ''
@load /home/gtrun/project/hardenedlinux-zeek-script/scripts/zeek-query.zeek
@load /home/gtrun/project/hardenedlinux-zeek-script/scripts/log-passwords.zeek
'';
};
})
];
};
};
}
#+end_src

* creating the zeek dynamic dir to ~/var/lib/zeek~
:BACKLINKS:
[2020-10-09 Fri 19:35] <- [[*Build Zeek with nix-build -> result/bin/zeek (Current version)][Build Zeek with nix-build -> result/bin/zeek (Current version)]]
:END:
#+begin_src sh :async t :exports both :results output
sudo bash ./pre-run-zeekctl.sh
#+end_src

* Optional: using cachix to speed up binary build
#+begin_src sh :async t :exports both :results output
nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use zeek
#+end_src