Compare commits

..

10 Commits

Author SHA1 Message Date
Daniel Grunberger
405cd837a1 Update README.md 2021-08-18 18:45:46 +03:00
dwertent
e6b2688462 update install version 2021-08-18 14:56:48 +03:00
Daniel Grunberger
e5b35fcb55 Merge pull request #6 from Daniel-GrunbergerCA/master
Update output format
2021-08-18 14:54:59 +03:00
Daniel Grunberger
35449e3d4e Merge branch 'master' into master 2021-08-18 14:54:33 +03:00
danielgrunbergerarmo
9509c69d87 update install version 2021-08-18 14:51:05 +03:00
danielgrunbergerarmo
34170faae9 update readme.md 2021-08-18 14:45:49 +03:00
danielgrunbergerarmo
d5d0da8ac3 fix non-namespacd resources 2021-08-18 14:33:14 +03:00
danielgrunbergerarmo
8b7a4b1e48 fix output format 2021-08-18 14:21:44 +03:00
danielgrunbergerarmo
d5383fe218 fix field selector for non-namespaced resources 2021-08-18 14:04:00 +03:00
danielgrunbergerarmo
329d341fbf delete build.yaml 2021-08-18 11:58:23 +03:00
6 changed files with 21 additions and 11 deletions

View File

@@ -50,4 +50,4 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: build/kubescape
asset_name: kubescape
asset_content_type: application/octet-stream
asset_content_type: application/octet-stream

View File

@@ -9,14 +9,20 @@ Tests are configured with YAML files, making this tool easy to update as test sp
## Installation
To install the tool locally, run this:
`curl -s https://raw.githubusercontent.com/armosec/kubescape/master/install.sh | /bin/bash`
```
curl -s https://raw.githubusercontent.com/armosec/kubescape/master/install.sh | /bin/bash
```
<img src="docs/install.jpeg">
## Run
To get a fast check of the security posture of your Kubernetes cluster, run this:
`kubescape scan framework nsa`
```
kubescape scan framework nsa --exclude-namespaces kube-system,kube-public
```
If you wish to scan all namespaces in your cluster, remove the `--exclude-namespaces` flag.
<img src="docs/run.jpeg">
@@ -42,6 +48,7 @@ Kubescape is running the following tests according to what is defined by [Kubern
* Resource policies
* Control plane hardening
* Exposed dashboard
* Allow privilege escalation
## Technology

View File

@@ -16,6 +16,7 @@ var InfoDisplay = color.New(color.Bold, color.FgHiYellow).FprintfFunc()
var InfoTextDisplay = color.New(color.Faint, color.FgHiYellow).FprintfFunc()
var SimpleDisplay = color.New(color.Bold, color.FgHiWhite).FprintfFunc()
var SuccessDisplay = color.New(color.Bold, color.FgHiGreen).FprintfFunc()
var DescriptionDisplay = color.New(color.Faint, color.FgWhite).FprintfFunc()
var Spinner *spinner.Spinner

View File

@@ -6,7 +6,9 @@ echo
BASE_DIR=~/.kubescape
KUBESCAPE_EXEC=kubescape
RELEASE=v0.0.27
RELEASE=v0.0.31
DOWNLOAD_URL="https://github.com/armosec/kubescape/releases/download/$RELEASE/kubescape"
mkdir -p $BASE_DIR

View File

@@ -60,7 +60,7 @@ func (policyHandler *PolicyHandler) pullSingleResource(resource *schema.GroupVer
// set labels
listOptions := metav1.ListOptions{}
if excludedNamespaces != "" {
if excludedNamespaces != "" && k8sinterface.IsNamespaceScope(resource.Group, resource.Resource) {
excludedNamespacesSlice := strings.Split(excludedNamespaces, ",")
for _, excludedNamespace := range excludedNamespacesSlice {
listOptions.FieldSelector += "metadata.namespace!=" + excludedNamespace + ","
@@ -73,7 +73,6 @@ func (policyHandler *PolicyHandler) pullSingleResource(resource *schema.GroupVer
// set dynamic object
var clientResource dynamic.ResourceInterface
if namespace != "" && k8sinterface.IsNamespaceScope(resource.Group, resource.Resource) {
clientResource = policyHandler.k8s.DynamicClient.Resource(*resource).Namespace(namespace)
} else {

View File

@@ -13,7 +13,7 @@ import (
"github.com/olekukonko/tablewriter"
)
var INDENT = " "
var INDENT = " "
type Printer struct {
opaSessionObj *chan *cautils.OPASessionObj
@@ -83,7 +83,7 @@ func (print *Printer) printSummery(controlName string, controlSummery *ControlSu
cautils.SimpleDisplay(os.Stdout, "Summary - ")
cautils.SuccessDisplay(os.Stdout, "Passed:%v ", controlSummery.TotalResources-controlSummery.TotalFailed)
cautils.FailureDisplay(os.Stdout, "Failed:%v ", controlSummery.TotalFailed)
cautils.InfoDisplay(os.Stdout, "Total:%v\n", controlSummery.TotalResources)
cautils.InfoDisplay(os.Stdout, "Total:%v\n\n", controlSummery.TotalResources)
}
func (printer *Printer) printTitle(controlName string, controlSummery *ControlSummery) {
@@ -96,7 +96,7 @@ func (printer *Printer) printTitle(controlName string, controlSummery *ControlSu
cautils.FailureDisplay(os.Stdout, "failed %v\n", emoji.SadButRelievedFace)
}
cautils.SimpleDisplay(os.Stdout, "Description: %s\n", controlSummery.Description)
cautils.DescriptionDisplay(os.Stdout, "Description: %s\n", controlSummery.Description)
}
func (printer *Printer) printResult(controlName string, controlSummery *ControlSummery) {
@@ -104,8 +104,9 @@ func (printer *Printer) printResult(controlName string, controlSummery *ControlS
indent := INDENT
for ns, rsc := range controlSummery.WorkloadSummery {
preIndent := indent
indent += indent
cautils.SimpleDisplay(os.Stdout, "%sNamespace %s\n", indent, ns)
if ns != "" {
cautils.SimpleDisplay(os.Stdout, "%sNamespace %s\n", indent, ns)
}
preIndent2 := indent
for r := range rsc {
indent += indent