2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "kubescape";
|
2022-04-03 18:54:34 +00:00
|
|
|
version = "2.0.150";
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "armosec";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-04-03 18:54:34 +00:00
|
|
|
hash = "sha256-1D/ixtZI7/H05MD6zRtZCF8yhW1FhvRpdPWieAPwxHs=";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
modRoot = "cmd";
|
|
|
|
vendorSha256 = "sha256-Nznf793OMQ7ZCWb5voVcLyMiBa1Z8Dswp7Tdn1AzlJA=";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
2022-04-03 18:54:34 +00:00
|
|
|
"-X github.com/armosec/kubescape/core/cautils.BuildNumber=v${version}"
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
2021-10-28 06:52:43 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
postBuild = ''
|
|
|
|
# kubescape/cmd should be called kubescape
|
|
|
|
mv $GOPATH/bin/{cmd,kubescape}
|
|
|
|
'';
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd kubescape \
|
|
|
|
--bash <($out/bin/kubescape completion bash) \
|
|
|
|
--fish <($out/bin/kubescape completion fish) \
|
|
|
|
--zsh <($out/bin/kubescape completion zsh)
|
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
$out/bin/kubescape --help
|
|
|
|
$out/bin/kubescape --version | grep "v${version}"
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Tool for testing if Kubernetes is deployed securely";
|
|
|
|
homepage = "https://github.com/armosec/kubescape";
|
2021-10-28 06:52:43 +00:00
|
|
|
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.
|
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
license = licenses.asl20;
|
2021-10-28 06:52:43 +00:00
|
|
|
maintainers = with maintainers; [ fab jk ];
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
}
|