2022-08-12 12:06:08 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "kube-bench";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.8.0";
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aquasecurity";
|
|
|
|
repo = pname;
|
2023-03-04 12:14:45 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-vP/BK3hOBrEAPrg+Bltg0GdyvAQyUffEtXoK3B3CEjs=";
|
2022-08-12 12:06:08 +00:00
|
|
|
};
|
2023-03-04 12:14:45 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
vendorHash = "sha256-bq8nz4i40xd4O6/r2ZiUyAEKxmsoLCNKctqRV/GPQEU=";
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
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";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "kube-bench";
|
2022-08-12 12:06:08 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ jk ];
|
|
|
|
};
|
|
|
|
}
|