This repository was archived by the owner on Oct 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Add Declarative Combined Scans Implementation #34
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Migrated to main hook file to typescript
This would otherwise lead to invalid names for k8s objects
If the scan was previously prefixed by the scanType, this prefix will now be replaced with the cascading Scans scanType
Like "hostOrIP"
rfelber
approved these changes
Jul 1, 2020
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was referenced Jul 1, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request implements the Declarative Combined Scan approach described in RFC1.
Closes #33
Installation
CombinedScan Hook
Before you can install the hook you need to update your Operator to this branch:
helm -n securecodebox-system upgrade --install securecodebox-operator ./operator/ --set "image.tag=declarative-combined-scans"Installing the Declarative Combined Scan hook will add a ReadOnly Hook to your namespace which looks for matching CascadingRules in the namespace and start the according scans.
Verification
CascadingRule
The CascadingRules are included in the helm charts of the individual scanner. As these were only included in this PR you'll need to update them:
helm upgrade --install amass ./scanners/amass/ helm upgrade --install kube-hunter ./scanners/kube-hunter/ helm upgrade --install nikto ./scanners/nikto helm upgrade --install nmap ./scanners/nmap/ helm upgrade --install ssh-scan ./scanners/ssh_scan/ helm upgrade --install sslyze ./scanners/sslyze/ helm upgrade --install trivy ./scanners/trivy/ helm upgrade --install zap ./scanners/zap/ helm upgrade --install wpscan ./scanners/wpscan/ # Check your CascadingRules $ kubectl get CascadingRules NAME STARTS INVASIVENESS INTENSIVENESS https-tls-scan sslyze non-invasive light imaps-tls-scan sslyze non-invasive light nikto-http nikto non-invasive medium nmap-smb nmap non-invasive light pop3s-tls-scan sslyze non-invasive light smtps-tls-scan sslyze non-invasive light ssh-scan ssh-scan non-invasive light zap-http zap-baseline non-invasive mediumStarting Scans
When you start a normal Scan, no CascadingRule will be applied.
To use CascadingRule the scan must be marked to allow cascading rules.
This is implemented using kubernetes label selectors, meaning that scans mark the classes of scans which are allowed to be cascaded by the current one.
Example
This Scan will used all CascadingRules which are labeled with a "light" intensity.
You can lookup which CascadingRules this selects by running:
$ kubectl get CascadingRules -l "securecodebox.io/intensive=light" NAME STARTS INVASIVENESS INTENSIVENESS https-tls-scan sslyze non-invasive light imaps-tls-scan sslyze non-invasive light nmap-smb nmap non-invasive light pop3s-tls-scan sslyze non-invasive light smtps-tls-scan sslyze non-invasive light ssh-scan ssh-scan non-invasive lightThe label selectors also allow the more powerful matchExpression selectors:
This selection can be replicated in kubectl using:
kubectl get CascadingRules -l "securecodebox.io/intensive in (light,medium)" NAME STARTS INVASIVENESS INTENSIVENESS https-tls-scan sslyze non-invasive light imaps-tls-scan sslyze non-invasive light nikto-http nikto non-invasive medium nmap-smb nmap non-invasive light pop3s-tls-scan sslyze non-invasive light smtps-tls-scan sslyze non-invasive light ssh-scan ssh-scan non-invasive light zap-http zap-baseline non-invasive mediumTodos
There are a couple of open points, which will be addressed in separate prs: