Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cis benchmarks #118

Merged
merged 85 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
4a03753
Add improvements to Chart.yaml
fhielpos Apr 29, 2022
caceea7
First commit to add CIS reports
fhielpos Jun 6, 2022
fc9fc56
Merge branch 'add-cis-benchmarks' of github.com:giantswarm/starboard-…
fhielpos Jun 6, 2022
ddd0e9b
Add CISKubeBenchReport controller
fhielpos Jun 7, 2022
dde0623
Delete CONTRIBUTING.md file
fhielpos Jun 7, 2022
900b568
Remove severity label from CIS reports
fhielpos Jun 7, 2022
b7348cd
Add CISKubeBenchReports to RBAC permissions
fhielpos Jun 7, 2022
27f7baa
Add SectionSummary to CISKubeBenchReports
fhielpos Jun 9, 2022
3a699b4
Add CISKubeBench custom metrics
fhielpos Jun 13, 2022
adbce07
Add report-labels argument to starboard-exporter
fhielpos Jun 13, 2022
7b28f1c
Fix metric labels on CISKubeBench reports
fhielpos Jun 13, 2022
aa361ad
Fix report-labels argument on Helm chart
fhielpos Jun 13, 2022
d459b29
Test multiple metrics
fhielpos Jun 13, 2022
5b42d0c
Test multiple metrics
fhielpos Jun 13, 2022
7cd83ec
Test multiple metrics
fhielpos Jun 13, 2022
29d4122
Test multiple metrics
fhielpos Jun 13, 2022
654e5a7
Fix metric counts
fhielpos Jun 14, 2022
6dcde30
Rename section labels
fhielpos Jun 14, 2022
cdbb117
Add status label
fhielpos Jun 14, 2022
daeb9c5
Add status label
fhielpos Jun 14, 2022
38246c7
Add status label
fhielpos Jun 14, 2022
125742f
Change status groups
fhielpos Jun 14, 2022
ab02c73
Disable custom metrics for testing
fhielpos Jun 14, 2022
5cbd11e
Revert testing changes
fhielpos Jun 14, 2022
bf8370c
Add debugging
fhielpos Jun 15, 2022
5331471
Fix labels overflow
fhielpos Jun 15, 2022
1dd056c
Remove debugging
fhielpos Jun 15, 2022
884616c
Rename metric and register custom ones
fhielpos Jun 15, 2022
657f8ae
Add improvements to Chart.yaml
fhielpos Apr 29, 2022
40b78de
First commit to add CIS reports
fhielpos Jun 6, 2022
a0e1675
Add CISKubeBenchReport controller
fhielpos Jun 7, 2022
5606974
Delete CONTRIBUTING.md file
fhielpos Jun 7, 2022
38151ad
Remove severity label from CIS reports
fhielpos Jun 7, 2022
dbaaf8e
Add CISKubeBenchReports to RBAC permissions
fhielpos Jun 7, 2022
ca3e3f4
Add SectionSummary to CISKubeBenchReports
fhielpos Jun 9, 2022
6a2ca47
Add CISKubeBench custom metrics
fhielpos Jun 13, 2022
eac0c7e
Add report-labels argument to starboard-exporter
fhielpos Jun 13, 2022
8782117
Fix metric labels on CISKubeBench reports
fhielpos Jun 13, 2022
2507c41
Fix report-labels argument on Helm chart
fhielpos Jun 13, 2022
6c5318c
Test multiple metrics
fhielpos Jun 13, 2022
64f7477
Test multiple metrics
fhielpos Jun 13, 2022
e8f8bbf
Test multiple metrics
fhielpos Jun 13, 2022
01c9c4d
Test multiple metrics
fhielpos Jun 13, 2022
49f6335
Fix metric counts
fhielpos Jun 14, 2022
7b501ff
Rename section labels
fhielpos Jun 14, 2022
fcbc737
Add status label
fhielpos Jun 14, 2022
6453a55
Add status label
fhielpos Jun 14, 2022
cda29c2
Add status label
fhielpos Jun 14, 2022
dc17c05
Change status groups
fhielpos Jun 14, 2022
aeeaf64
Disable custom metrics for testing
fhielpos Jun 14, 2022
e531a43
Revert testing changes
fhielpos Jun 14, 2022
8e50916
Add debugging
fhielpos Jun 15, 2022
43443e3
Fix labels overflow
fhielpos Jun 15, 2022
cbd83ef
Remove debugging
fhielpos Jun 15, 2022
4a3e65a
Rename metric and register custom ones
fhielpos Jun 15, 2022
addcfea
Remove finalizers
fhielpos Jun 15, 2022
35a4437
Remove finalizers
fhielpos Jun 15, 2022
e1813ba
Re-add removed registerMetrics
fhielpos Jun 15, 2022
820a5e2
Delete duplicated argument and start renaming
fhielpos Jun 15, 2022
60d8e1b
Normalize status values
fhielpos Jun 15, 2022
7004b24
Add shard helper
fhielpos Jun 15, 2022
80fd368
Update helm/starboard-exporter/Chart.yaml
fhielpos Jun 15, 2022
1f09a91
Add customizable labels to Results
fhielpos Jun 16, 2022
5ba8207
Merge branch 'add-cis-benchmarks' of github.com:giantswarm/starboard-…
fhielpos Jun 16, 2022
1a3af0c
Rename CIS detail report labels argument
fhielpos Jun 16, 2022
4a750a2
Rename CIS detail report labels argument
fhielpos Jun 16, 2022
a64211d
Remove finalizers from CIS KubeBench Reports
fhielpos Jun 16, 2022
ccaadc8
Rename metrics
fhielpos Jun 16, 2022
0df8690
Remove unused metric
fhielpos Jun 16, 2022
e8bce48
Update CHANGELOG
fhielpos Jun 16, 2022
2a40bf9
Fix BenchmarkResultInfo metric
fhielpos Jun 18, 2022
4a7a6cb
Add missing labels to all
fhielpos Jun 18, 2022
272a0b5
Add section_name label to CISKubeBench section metrics
fhielpos Jun 20, 2022
36f9175
Remove section_name from global summary
fhielpos Jun 20, 2022
5e55edf
Add CISKubeBenchReports documentation
fhielpos Jun 21, 2022
7527235
Apply suggestions from code review
fhielpos Jun 22, 2022
1113dd3
Apply suggestions from code review
fhielpos Jun 22, 2022
b0627f4
Remove sources from Chart.yaml
fhielpos Jun 22, 2022
a3f0f03
Refactor report_name
fhielpos Jun 22, 2022
9949eac
Print report labels for CIS benchmarks argument
fhielpos Jun 22, 2022
4155b69
Update docs
fhielpos Jun 22, 2022
5a7f8f1
Print report labels for CIS benchmarks argument
fhielpos Jun 22, 2022
225edc1
Update docs
fhielpos Jun 22, 2022
1d70f4d
Drop report_name label
fhielpos Jun 22, 2022
a54e9c5
Apply suggestions from code review
fhielpos Jun 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Set `runAsNonRoot` and use `RuntimeDefault` seccomp profile.
- Make replica count configurable in Helm values.
- Add configurable tolerations to Helm values.
- Reconcile and expose metrics for `CISKubeBenchReport` custom resources.

fhielpos marked this conversation as resolved.
Show resolved Hide resolved
## [0.4.1] - 2022-04-26

Expand Down
93 changes: 88 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,53 @@ Exposes Prometheus metrics from [Starboard][starboard-upstream]'s `Vulnerability

## Metrics

This exporter exposes two types of metrics:
This exporter exposes several types of metrics:

### Summary
fhielpos marked this conversation as resolved.
Show resolved Hide resolved
### CIS Benchmarks

#### Report Summary

A report summary series exposes the count of checks of each status reported in a given `CISKubeBenchReport`. For example:

```shell
starboard_exporter_ciskubebenchreport_report_summary_count{
node_name="bj56o-master-bj56o-000000"
status="FAIL"
} 31
```

#### Section Summary

For slightly more granular reporting, a section summary series exposes the count of checks of each status reported in a given `CISKubeBenchSection`. For example:

```shell
starboard_exporter_ciskubebenchreport_section_summary_count{
node_name="bj56o-master-bj56o-000000"
node_type="controlplane"
section_name="Control Plane Configuration"
status="WARN"
} 4
```

#### Result Detail

A CIS benchmark result info series exposes fields from each instance of an Aqua `CISKubeBenchResult`. For example:

```shell
starboard_exporter_ciskubebenchreport_result_info{
node_name="bj56o-master-bj56o-000000"
node_type="controlplane"
pod="starboard-exporter-859955f485-cwkj6"
section_name="Control Plane Configuration"
test_desc="Client certificate authentication should not be used for users (Manual)"
test_number="3.1.1"
test_status="WARN"
} 1
```

### Vulnerability Reports

#### Report Summary

A summary series exposes the count of CVEs of each severity reported in a given `VulnerabilityReport`. For example:

Expand All @@ -26,9 +70,9 @@ starboard_exporter_vulnerabilityreport_image_vulnerability_severity_count{

This indicates that the `giantswarm/starboard-operator` image in the `demo` namespace contains 4 medium-severity vulnerabilities.

### Detail / Vulnerability
#### Vulnerability Details

A detail or vulnerability series exposes fields from each instance of an Aqua `Vulnerability`. The value of the metric is the `Score` for the vulnerability. For example:
A "detail" or "vulnerability" series exposes fields from each instance of an Aqua `Vulnerability`. The value of the metric is the `Score` for the vulnerability. For example:

```shell
starboard_exporter_vulnerabilityreport_image_vulnerability{
Expand All @@ -43,14 +87,29 @@ starboard_exporter_vulnerabilityreport_image_vulnerability{
severity="HIGH",
vulnerability_id="CVE-2021-3712",
vulnerability_link="https://avd.aquasec.com/nvd/cve-2021-3712",
vulnerability_title="openssl: Read buffer overruns processing ASN.1 strings",vulnerable_resource_name="libssl1.1"
vulnerability_title="openssl: Read buffer overruns processing ASN.1 strings",
vulnerable_resource_name="libssl1.1"
} 7.4
```

This indicates that the vulnerability with the id `CVE-2021-3712` was found in the `giantswarm/starboard-operator` image in the `demo` namespace, and it has a CVSS 3.x score of 7.4.

An additional series would be exposed for every combination of those labels.

### Config Audit Reports

#### Report Summary

A summary series exposes the count of checks of each severity reported in a given `ConfigAuditReport`. For example:

```shell
starboard_exporter_configauditreport_resource_checks_summary_count{
resource_name="replicaset-chart-operator-748f756847",
resource_namespace="giantswarm",
severity="LOW"
} 7
```

#### A Note on Cardinality

For some use cases, it is helpful to export additional fields from `VulnerabilityReport` CRs. However, because many fields contain unbounded arbitrary data, including them in Prometheus metrics can lead to extremely high cardinality. This can drastically impact Prometheus performance. For this reason, we only expose summary data by default and allow users to opt-in to higher-cardinality fields.
Expand Down Expand Up @@ -95,6 +154,30 @@ exporter:
- ...
```

The same can be done for CIS Benchmark Results. To enable an additional detail series *per CIS Benchmark Result*, use the `--cis-detail-report-labels` flag to specify which labels should be exposed. For example:

```shell
# Expose only section_name, test_name and test_status
--cis-detail-report-labels=section_name,test_name,test_status

# Run with (almost) all fields exposed as labels.
--cis-detail-report-labels=all
```

CIS detail target labels can also be set via Helm values:

```yaml
exporter:
CISKubeBenchReports:
targetLabels:
- node_name
- node_type
- section_name
- test_name
- test_status
- ...
```

[starboard-upstream]: https://github.com/aquasecurity/starboard
[starboard-config]: https://github.com/aquasecurity/starboard/blob/main/docs/operator/configuration.md

Expand Down
Loading