From 7b1c8963ca217d7e44e7d5d49659311d4c58bd64 Mon Sep 17 00:00:00 2001 From: Daniel Pacak Date: Mon, 30 Aug 2021 14:59:12 +0200 Subject: [PATCH] chore(kube-hunter): Bump up kube-hunter from v0.4.1 to v0.6.1 (#691) Resolves: #631 Signed-off-by: Daniel Pacak --- docs/settings.md | 2 +- pkg/kubehunter/scanner.go | 19 ++++++++----------- pkg/starboard/config.go | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/docs/settings.md b/docs/settings.md index 574b3ac33..aace3c7cc 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -56,7 +56,7 @@ configuration settings for common use cases. For example, switch Trivy from | `scanJob.tolerations` | N/A | JSON representation of the [tolerations] to be applied to the scanner pods so that they can run on nodes with matching taints. Example: `'[{"key":"key1", "operator":"Equal", "value":"value1", "effect":"NoSchedule"}]'` | | `scanJob.annotations` | N/A | One-line comma-separated representation of the annotations which the user wants the scanner pods to be annotated with. Example: `foo=bar,env=stage` will annotate the scanner pods with the annotations `foo: bar` and `env: stage` | | `kube-bench.imageRef` | `docker.io/aquasec/kube-bench:0.6.3` | kube-bench image reference | -| `kube-hunter.imageRef` | `docker.io/aquasec/kube-hunter:0.4.1` | kube-hunter image reference | +| `kube-hunter.imageRef` | `docker.io/aquasec/kube-hunter:0.6.1` | kube-hunter image reference | | `kube-hunter.quick` | `"false"` | Whether to use kube-hunter's "quick" scanning mode (subnet 24). Set to `"true"` to enable. | !!! tip diff --git a/pkg/kubehunter/scanner.go b/pkg/kubehunter/scanner.go index 68c73e32c..2d605bb8f 100644 --- a/pkg/kubehunter/scanner.go +++ b/pkg/kubehunter/scanner.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/aquasecurity/starboard/pkg/apis/aquasecurity/v1alpha1" - "github.com/aquasecurity/starboard/pkg/ext" "github.com/aquasecurity/starboard/pkg/kube" "github.com/aquasecurity/starboard/pkg/runner" "github.com/aquasecurity/starboard/pkg/starboard" @@ -30,9 +29,8 @@ type Config interface { } type Scanner struct { - scheme *runtime.Scheme - clientset kubernetes.Interface - ext.IDGenerator + scheme *runtime.Scheme + clientset kubernetes.Interface opts kube.ScannerOpts logsReader kube.LogsReader config starboard.ConfigData @@ -45,12 +43,11 @@ func NewScanner( opts kube.ScannerOpts, ) *Scanner { return &Scanner{ - scheme: scheme, - clientset: clientset, - IDGenerator: ext.NewGoogleUUIDGenerator(), - logsReader: kube.NewLogsReader(clientset), - config: config, - opts: opts, + scheme: scheme, + clientset: clientset, + logsReader: kube.NewLogsReader(clientset), + config: config, + opts: opts, } } @@ -149,7 +146,7 @@ func (s *Scanner) prepareKubeHunterJob() (*batchv1.Job, error) { return &batchv1.Job{ ObjectMeta: metav1.ObjectMeta{ - Name: s.GenerateID(), + Name: fmt.Sprintf("scan-kubehunterreports-%s", kube.ComputeHash("cluster")), Namespace: starboard.NamespaceName, }, Spec: batchv1.JobSpec{ diff --git a/pkg/starboard/config.go b/pkg/starboard/config.go index fedb218dc..514fae47d 100644 --- a/pkg/starboard/config.go +++ b/pkg/starboard/config.go @@ -77,7 +77,7 @@ func GetDefaultConfig() ConfigData { keyConfigAuditReportsScanner: string(Polaris), "kube-bench.imageRef": "docker.io/aquasec/kube-bench:0.6.3", - "kube-hunter.imageRef": "docker.io/aquasec/kube-hunter:0.4.1", + "kube-hunter.imageRef": "docker.io/aquasec/kube-hunter:0.6.1", "kube-hunter.quick": "false", } }