depot/third_party/nixpkgs/pkgs/tools/security/kubescape/default.nix
Default email d56f44df06 Project import generated by Copybara.
GitOrigin-RevId: bc4b9eef3ce3d5a90d8693e8367c9cbfc9fc1e13
2022-04-03 20:54:34 +02:00

69 lines
2 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
}:
buildGoModule rec {
pname = "kubescape";
version = "2.0.150";
src = fetchFromGitHub {
owner = "armosec";
repo = pname;
rev = "v${version}";
hash = "sha256-1D/ixtZI7/H05MD6zRtZCF8yhW1FhvRpdPWieAPwxHs=";
};
nativeBuildInputs = [
installShellFiles
];
modRoot = "cmd";
vendorSha256 = "sha256-Nznf793OMQ7ZCWb5voVcLyMiBa1Z8Dswp7Tdn1AzlJA=";
ldflags = [
"-s"
"-w"
"-X github.com/armosec/kubescape/core/cautils.BuildNumber=v${version}"
];
postBuild = ''
# kubescape/cmd should be called kubescape
mv $GOPATH/bin/{cmd,kubescape}
'';
postInstall = ''
installShellCompletion --cmd kubescape \
--bash <($out/bin/kubescape completion bash) \
--fish <($out/bin/kubescape completion fish) \
--zsh <($out/bin/kubescape completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/kubescape --help
$out/bin/kubescape --version | grep "v${version}"
runHook postInstallCheck
'';
meta = with lib; {
description = "Tool for testing if Kubernetes is deployed securely";
homepage = "https://github.com/armosec/kubescape";
changelog = "https://github.com/armosec/kubescape/releases/tag/v${version}";
longDescription = ''
Kubescape is the first open-source tool for testing if Kubernetes is
deployed securely according to multiple frameworks: regulatory, customized
company policies and DevSecOps best practices, such as the NSA-CISA and
the MITRE ATT&CK®.
Kubescape scans K8s clusters, YAML files, and HELM charts, and detect
misconfigurations and software vulnerabilities at early stages of the
CI/CD pipeline and provides a risk score instantly and risk trends over
time. Kubescape integrates natively with other DevOps tools, including
Jenkins, CircleCI and Github workflows.
'';
license = licenses.asl20;
maintainers = with maintainers; [ fab jk ];
};
}