depot/third_party/nixpkgs/pkgs/tools/security/kube-bench/default.nix
Default email 4bac34ead1 Project import generated by Copybara.
GitOrigin-RevId: 724bfc0892363087709bd3a5a1666296759154b1
2023-02-09 12:40:11 +01:00

48 lines
1.4 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "kube-bench";
version = "0.6.11";
src = fetchFromGitHub {
owner = "aquasecurity";
repo = pname;
rev = "v${version}";
sha256 = "sha256-fh7kVYajpn8DKteyvAJf3dk1UrSXFX2gKtTAvuiOjpY=";
};
vendorHash = "sha256-PM8VnPNMLhDhRVy6xafW0kuTHgd374r0Ol2U9k8LNIw=";
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 ];
};
}