mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
Sort controls, update gif
Sort control output
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Kubescape is the first tool for testing if Kubernetes is deployed securely as defined in [Kubernetes Hardening Guidance by to NSA and CISA](https://www.nsa.gov/News-Features/Feature-Stories/Article-View/Article/2716980/nsa-cisa-release-kubernetes-hardening-guidance/)
|
||||
Tests are configured with YAML files, making this tool easy to update as test specifications evolve.
|
||||
|
||||
<img src="docs/using-mov.gif">
|
||||
<img src="docs/demo.gif">
|
||||
|
||||
# TL;DR
|
||||
## Installation
|
||||
@@ -24,7 +24,7 @@ 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">
|
||||
<img src="docs/summery.PNG">
|
||||
|
||||
|
||||
# Status
|
||||
@@ -32,7 +32,23 @@ If you wish to scan all namespaces in your cluster, remove the `--exclude-namesp
|
||||
[]()
|
||||
|
||||
# How to build
|
||||
`go mod tidy && go build -o kubescape` :zany_face:
|
||||
|
||||
1. Clone Project
|
||||
```
|
||||
git clone git@github.com:armosec/kubescape.git kubescape && cd "$_"
|
||||
```
|
||||
|
||||
2. Build
|
||||
```
|
||||
go mod tidy && go build -o kubescape .
|
||||
```
|
||||
|
||||
3. Run
|
||||
```
|
||||
./kubescape scan framework nsa --exclude-namespaces kube-system,kube-public
|
||||
```
|
||||
|
||||
4. Enjoy :zany_face:
|
||||
|
||||
# Under the hood
|
||||
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 897 KiB |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 206 KiB |
+17
-5
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"kube-escape/cautils"
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
"kube-escape/cautils/k8sinterface"
|
||||
"kube-escape/cautils/opapolicy"
|
||||
@@ -68,12 +69,14 @@ func (printer *Printer) SummerySetup(postureReport *opapolicy.PostureReport) {
|
||||
}
|
||||
|
||||
func (printer *Printer) PrintResults() {
|
||||
for control, controlSummery := range printer.summery {
|
||||
printer.printTitle(control, &controlSummery)
|
||||
printer.printResult(control, &controlSummery)
|
||||
controlNames := printer.getSortedControlsNames()
|
||||
for i := 0; i < len(controlNames); i++ {
|
||||
controlSummery := printer.summery[controlNames[i]]
|
||||
printer.printTitle(controlNames[i], &controlSummery)
|
||||
printer.printResult(controlNames[i], &controlSummery)
|
||||
|
||||
if controlSummery.TotalResources > 0 {
|
||||
printer.printSummery(control, &controlSummery)
|
||||
if printer.summery[controlNames[i]].TotalResources > 0 {
|
||||
printer.printSummery(controlNames[i], &controlSummery)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -165,3 +168,12 @@ func (printer *Printer) PrintSummaryTable() {
|
||||
summaryTable.SetFooter(generateFooter(len(printer.summery), sumFailed, sumTotal))
|
||||
summaryTable.Render()
|
||||
}
|
||||
|
||||
func (printer *Printer) getSortedControlsNames() []string {
|
||||
controlNames := make([]string, 0, len(printer.summery))
|
||||
for k := range printer.summery {
|
||||
controlNames = append(controlNames, k)
|
||||
}
|
||||
sort.Strings(controlNames)
|
||||
return controlNames
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user