diff --git a/README.md b/README.md index ebaa5320..91011846 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ [![build](https://github.com/armosec/kubescape/actions/workflows/build.yaml/badge.svg)](https://github.com/armosec/kubescape/actions/workflows/build.yaml) [![Go Report Card](https://goreportcard.com/badge/github.com/armosec/kubescape)](https://goreportcard.com/report/github.com/armosec/kubescape) + + Kubescape is a K8s open-source tool providing a multi-cloud K8s single pane of glass, including risk analysis, security compliance, RBAC visualizer and image vulnerabilities scanning. Kubescape scans K8s clusters, YAML files, and HELM charts, detecting misconfigurations according to multiple frameworks (such as the [NSA-CISA](https://www.armosec.io/blog/kubernetes-hardening-guidance-summary-by-armo) , [MITRE ATT&CK®](https://www.microsoft.com/security/blog/2021/03/23/secure-containerized-environments-with-updated-threat-matrix-for-kubernetes/)), software vulnerabilities, and RBAC (role-based-access-control) violations at early stages of the CI/CD pipeline, calculates risk score instantly and shows risk trends over time. It became one of the fastest-growing Kubernetes tools among developers due to its easy-to-use CLI interface, flexible output formats, and automated scanning capabilities, saving Kubernetes users and admins’ precious time, effort, and resources. @@ -48,6 +50,7 @@ Want to contribute? Want to discuss something? Have an issue? * Open a issue, we are trying to respond within 48 hours * [Join us](https://armosec.github.io/kubescape/) in a discussion on our discord server! +[![discord](https://goreportcard.com/badge/github.com/armosec/kubescape)](https://img.shields.io/discord/893048809884643379) [logo](https://armosec.github.io/kubescape/) diff --git a/cautils/customerloader.go b/cautils/customerloader.go index 174b3380..b156e2b2 100644 --- a/cautils/customerloader.go +++ b/cautils/customerloader.go @@ -11,7 +11,6 @@ import ( "github.com/armosec/k8s-interface/k8sinterface" "github.com/armosec/kubescape/cautils/getter" - "github.com/armosec/kubescape/cautils/logger" corev1 "k8s.io/api/core/v1" ) @@ -113,13 +112,6 @@ func NewLocalConfig(backendAPI getter.IBackend, customerGUID, clusterName string lc.backendAPI.SetClientID(lc.configObj.ClientID) lc.backendAPI.SetSecretKey(lc.configObj.SecretKey) - if lc.configObj.AccountID != "" { - if err := lc.SetTenant(); err != nil { - logger.L().Error(err.Error()) - } - } - lc.UpdateCachedConfig() - return lc } @@ -229,13 +221,6 @@ func NewClusterConfig(k8s *k8sinterface.KubernetesApi, backendAPI getter.IBacken c.backendAPI.SetClientID(c.configObj.ClientID) c.backendAPI.SetSecretKey(c.configObj.SecretKey) - // if c.configObj.AccountID != "" { - // if err := c.SetTenant(); err != nil { - // logger.L().Error(err.Error()) - // } - // } - c.UpdateCachedConfig() - return c } diff --git a/clihandler/clisubmit.go b/clihandler/clisubmit.go index c8370335..878fc5f7 100644 --- a/clihandler/clisubmit.go +++ b/clihandler/clisubmit.go @@ -34,7 +34,9 @@ func SubmitExceptions(accountID, excPath string) error { // load cached config tenantConfig := getTenantConfig(accountID, "", getKubernetesApi()) - tenantConfig.SetTenant() + if err := tenantConfig.SetTenant(); err != nil { + logger.L().Error("failed setting account ID", helpers.Error(err)) + } // load exceptions from file loader := getter.NewLoadPolicy([]string{excPath}) diff --git a/clihandler/cmd/rbac.go b/clihandler/cmd/rbac.go index 8d8fbec0..a666a58e 100644 --- a/clihandler/cmd/rbac.go +++ b/clihandler/cmd/rbac.go @@ -5,6 +5,7 @@ import ( "github.com/armosec/kubescape/cautils" "github.com/armosec/kubescape/cautils/getter" "github.com/armosec/kubescape/cautils/logger" + "github.com/armosec/kubescape/cautils/logger/helpers" "github.com/armosec/kubescape/clihandler" "github.com/armosec/kubescape/clihandler/cliinterfaces" reporterv1 "github.com/armosec/kubescape/resultshandling/reporter/v1" @@ -23,7 +24,9 @@ var rabcCmd = &cobra.Command{ // get config clusterConfig := getTenantConfig(submitInfo.Account, "", k8s) - clusterConfig.SetTenant() + if err := clusterConfig.SetTenant(); err != nil { + logger.L().Error("failed setting account ID", helpers.Error(err)) + } // list RBAC rbacObjects := cautils.NewRBACObjects(rbacscanner.NewRbacScannerFromK8sAPI(k8s, clusterConfig.GetAccountID(), clusterConfig.GetClusterName())) diff --git a/clihandler/cmd/results.go b/clihandler/cmd/results.go index d6b25cfa..f7c09896 100644 --- a/clihandler/cmd/results.go +++ b/clihandler/cmd/results.go @@ -8,6 +8,7 @@ import ( "github.com/armosec/k8s-interface/workloadinterface" "github.com/armosec/kubescape/cautils/logger" + "github.com/armosec/kubescape/cautils/logger/helpers" "github.com/armosec/kubescape/clihandler" "github.com/armosec/kubescape/clihandler/cliinterfaces" reporterv1 "github.com/armosec/kubescape/resultshandling/reporter/v1" @@ -63,7 +64,9 @@ var resultsCmd = &cobra.Command{ // get config clusterConfig := getTenantConfig(submitInfo.Account, "", k8s) - clusterConfig.SetTenant() + if err := clusterConfig.SetTenant(); err != nil { + logger.L().Error("failed setting account ID", helpers.Error(err)) + } resultsObjects := NewResultsObject(clusterConfig.GetAccountID(), clusterConfig.GetClusterName(), args[0])