Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 56515c7

Browse files
authored
Merge pull request #72 from secureCodeBox/feature/docs-declarative-combined-scans
Documentation for declarative combined scans
2 parents 33282ef + 1302b5a commit 56515c7

File tree

1 file changed

+128
-1
lines changed

1 file changed

+128
-1
lines changed

docs/user-guide/README.md

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,131 @@ category: "use"
88

99
# Using the secureCodeBox
1010

11-
> **Page under construction.**
11+
12+
> **Page under construction.**
13+
14+
## Declarative Combined Scans
15+
16+
### Install Hook
17+
18+
Installing the Declarative Combined Scan hook will add a ReadOnly Hook to your namespace which looks for matching CascadingRules in the namespace and starts subsequent scans accordingly.
19+
20+
```bash
21+
helm install combined-scans ./hooks/declarative-subsequent-scans
22+
```
23+
24+
### Verify Hook Installation
25+
26+
Successful installation can be verified by retrieving installed ScanCompletionHooks.
27+
28+
```bash
29+
kubectl get ScanCompletionHooks
30+
```
31+
32+
The result should contain a hook for declarative subsequent scans.
33+
34+
```bash
35+
NAME TYPE IMAGE
36+
combined-scans-declarative-subsequent-scans ReadOnly docker.io/scbexperimental/hook-declarative-subsequent-scans:latest
37+
```
38+
39+
### Verify CascadingRules
40+
41+
CascadingRules are included in each individual scanner's Helm chart.
42+
43+
```bash
44+
kubectl get CascadingRules
45+
```
46+
47+
Output should show these CascadingRules:
48+
49+
```bash
50+
NAME STARTS INVASIVENESS INTENSIVENESS
51+
https-tls-scan sslyze non-invasive light
52+
imaps-tls-scan sslyze non-invasive light
53+
nikto-http nikto non-invasive medium
54+
nmap-smb nmap non-invasive light
55+
pop3s-tls-scan sslyze non-invasive light
56+
smtps-tls-scan sslyze non-invasive light
57+
ssh-scan ssh-scan non-invasive light
58+
zap-http zap-baseline non-invasive medium
59+
```
60+
61+
### Start Scans
62+
63+
When you start a normal Scan, no CascadingRule will be applied.
64+
To use CascadingRules the scan must be marked to allow cascading rules.
65+
66+
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.
67+
68+
### Example
69+
70+
```bash
71+
cat <<EOF | kubectl apply -f -
72+
apiVersion: "execution.experimental.securecodebox.io/v1"
73+
kind: Scan
74+
metadata:
75+
name: "example.com"
76+
spec:
77+
scanType: nmap
78+
parameters:
79+
- -p22,80,443
80+
- example.com
81+
cascades:
82+
matchLabels:
83+
securecodebox.io/intensive: light
84+
EOF
85+
```
86+
87+
This Scan will used all CascadingRules which are labeled with a "light" intensity.
88+
89+
You can lookup which CascadingRules this selects by running:
90+
91+
```bash
92+
kubectl get CascadingRules -l "securecodebox.io/intensive=light"
93+
NAME STARTS INVASIVENESS INTENSIVENESS
94+
https-tls-scan sslyze non-invasive light
95+
imaps-tls-scan sslyze non-invasive light
96+
nmap-smb nmap non-invasive light
97+
pop3s-tls-scan sslyze non-invasive light
98+
smtps-tls-scan sslyze non-invasive light
99+
ssh-scan ssh-scan non-invasive light
100+
```
101+
102+
The label selectors also allow the more powerful [matchExpression](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#set-based-requirement) selectors:
103+
104+
```bash
105+
cat <<EOF | kubectl apply -f -
106+
apiVersion: "execution.experimental.securecodebox.io/v1"
107+
kind: Scan
108+
metadata:
109+
name: "example.com"
110+
spec:
111+
scanType: nmap
112+
parameters:
113+
- -p22,80,443
114+
- example.com
115+
cascades:
116+
# Using matchExpression instead of matchLabels
117+
matchExpression:
118+
key: "securecodebox.io/intensive"
119+
operator: In
120+
# This select both light and medium intensity rules
121+
values: [light, medium]
122+
EOF
123+
```
124+
125+
This selection can be replicated in kubectl using:
126+
127+
```bash
128+
kubectl get CascadingRules -l "securecodebox.io/intensive in (light,medium)"
129+
NAME STARTS INVASIVENESS INTENSIVENESS
130+
https-tls-scan sslyze non-invasive light
131+
imaps-tls-scan sslyze non-invasive light
132+
nikto-http nikto non-invasive medium
133+
nmap-smb nmap non-invasive light
134+
pop3s-tls-scan sslyze non-invasive light
135+
smtps-tls-scan sslyze non-invasive light
136+
ssh-scan ssh-scan non-invasive light
137+
zap-http zap-baseline non-invasive medium
138+
```

0 commit comments

Comments
 (0)