summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author06kellyjac <dev@j-k.io>2022-07-06 14:42:05 +0100
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2022-08-11 10:46:28 +0000
commit4dc260c9f2844d76c0fe836503f42a1734b0aebe (patch)
treeee5a0e64c1fc4b90af8c25e4f3c119aa1250d003
parentdiscord: 0.0.18 -> 0.0.19 (diff)
downloadnixpkgs-origin/backport-179354-to-release-22.05.tar.gz
(cherry picked from commit c8cc2dee7ecb0816a0b483ed2b3205cbd418ebff)
-rw-r--r--pkgs/tools/security/kube-bench/default.nix48
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 50 insertions, 0 deletions
diff --git a/pkgs/tools/security/kube-bench/default.nix b/pkgs/tools/security/kube-bench/default.nix
new file mode 100644
index 000000000000..e95ff1a05477
--- /dev/null
+++ b/pkgs/tools/security/kube-bench/default.nix
@@ -0,0 +1,48 @@
+{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
+
+buildGoModule rec {
+ pname = "kube-bench";
+ version = "0.6.8";
+
+ src = fetchFromGitHub {
+ owner = "aquasecurity";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "sha256-uqjF2WtsGMzA/JDS93BSQNuBJorMIJha9qPHJkIbjQo=";
+ };
+ vendorSha256 = "sha256-/LSgIfLBsGRSyz9gExgLKAjO+RF/C8CkxSvwx2jZjoI=";
+
+ nativeBuildInputs = [ installShellFiles ];
+
+ ldflags = [
+ "-s"
+ "-w"
+ "-X github.com/aquasecurity/kube-bench/cmd.KubeBenchVersion=v${version}"
+ ];
+
+ postInstall = ''
+ mkdir -p $out/share/kube-bench/
+ mv ./cfg $out/share/kube-bench/
+
+ installShellCompletion --cmd kube-bench \
+ --bash <($out/bin/kube-bench completion bash) \
+ --fish <($out/bin/kube-bench completion fish) \
+ --zsh <($out/bin/kube-bench completion zsh)
+ '';
+
+ doInstallCheck = true;
+ installCheckPhase = ''
+ runHook preInstallCheck
+ $out/bin/kube-bench --help
+ $out/bin/kube-bench version | grep "v${version}"
+ runHook postInstallCheck
+ '';
+
+ meta = with lib; {
+ homepage = "https://github.com/aquasecurity/kube-bench";
+ changelog = "https://github.com/aquasecurity/kube-bench/releases/tag/v${version}";
+ description = "Checks whether Kubernetes is deployed according to security best practices as defined in the CIS Kubernetes Benchmark";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ jk ];
+ };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 48ee483acf55..5ef00b0cd93b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15818,6 +15818,8 @@ with pkgs;
krew = callPackage ../development/tools/krew { };
+ kube-bench = callPackage ../tools/security/kube-bench { };
+
kube-hunter = callPackage ../tools/security/kube-hunter { };
kubeaudit = callPackage ../tools/security/kubeaudit { };