Skip to content

Commit 98c6cea

Browse files
authored
Merge pull request #913 from secureCodeBox/feature/azure-monitor-persistence
Add Azure Monitor persistence hook
2 parents 28a11f1 + 3a870de commit 98c6cea

20 files changed

Lines changed: 7907 additions & 0 deletions

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ jobs:
426426
- finding-post-processing
427427
- generic-webhook
428428
- notification
429+
- persistence-azure-monitor
429430
- persistence-elastic
430431
- persistence-defectdojo
431432
- update-field
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{{- /*
2+
SPDX-FileCopyrightText: 2021 iteratec GmbH
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/ -}}
6+
7+
{{- define "extra.docsSection" -}}
8+
---
9+
title: "Azure Monitor"
10+
category: "hook"
11+
type: "persistenceProvider"
12+
state: "released"
13+
usecase: "Publishes all Scan Findings to Azure Monitor."
14+
---
15+
{{- end }}
16+
17+
{{- define "extra.dockerDeploymentSection" -}}
18+
## Supported Tags
19+
- `latest` (represents the latest stable release build)
20+
- tagged releases, e.g. `3.0.0`, `2.9.0`, `2.8.0`, `2.7.0`
21+
{{- end }}
22+
23+
{{- define "extra.chartAboutSection" -}}
24+
## What is "Persistence Azure Monitor" Hook about?
25+
The Azure Monitor persistenceProvider hook saves all findings and reports into the configured Azure Monitor workspace using the [Data Collector API](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api).
26+
This allows working with the data in [Azure Monitor](https://azure.microsoft.com/en-us/services/monitor/) or [Microsoft Sentinel](https://docs.microsoft.com/en-us/azure/sentinel/overview) to configure alerting based on new findings.
27+
It will create a custom log type for every scantype titled SCB_[scantype_name].
28+
29+
Installing the Azure Monitor persistenceProvider hook will add a _ReadOnly Hook_ to your namespace.
30+
{{- end }}
31+
32+
{{- define "extra.scannerConfigurationSection" -}}{{- end }}
33+
34+
{{- define "extra.chartConfigurationSection" -}}
35+
## Additional Chart Configurations
36+
The hook requires the Azure Monitor Workspace ID and its Primary Key for authentication. For details on how to find them, see [this page](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api#sample-requests).
37+
Create a Kubernetes secret with these values using
38+
39+
```bash
40+
# Create the secret (use a leading space to avoid having secrets in your shell history)
41+
# Replace "workspace=your-workspace-id" with your Workspace ID
42+
# Replace "sharedkey=your-shared-key" with your Primary Key
43+
kubectl create secret generic azure-monitor --from-literal=workspace=your-workspace-id --from-literal=sharedkey=your-shared-key
44+
```
45+
46+
Then, configure the hook to use this secret when installing it:
47+
```bash
48+
helm upgrade --install persistence-azure-monitor . --wait \
49+
--set="monitor.authentication.apiKeySecret="azure-monitor""
50+
```
51+
52+
{{- end }}
53+
54+
{{- define "extra.scannerLinksSection" -}}
55+
{{- end }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# SPDX-FileCopyrightText: 2021 iteratec GmbH
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
# Patterns to ignore when building packages.
5+
# This supports shell glob matching, relative path matching, and
6+
# negation (prefixed with !). Only one pattern per line.
7+
.DS_Store
8+
# Common VCS dirs
9+
.git/
10+
.gitignore
11+
.bzr/
12+
.bzrignore
13+
.hg/
14+
.hgignore
15+
.svn/
16+
# Common backup files
17+
*.swp
18+
*.bak
19+
*.tmp
20+
*~
21+
# Various IDEs
22+
.project
23+
.idea/
24+
*.tmproj
25+
.vscode/
26+
# Node.js files
27+
node_modules/*
28+
package.json
29+
package-lock.json
30+
src/*
31+
config/*
32+
Dockerfile
33+
.dockerignore
34+
docs/*
35+
*.tar
36+
hook/*
37+
integration-tests/*
38+
examples/*
39+
coverage/*
40+
Makefile
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SPDX-FileCopyrightText: 2022 iteratec GmbH
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
apiVersion: v2
6+
name: persistence-azure-monitor
7+
description: The Azure Monitor persistence provider persists secureCodeBox findings into Azure Monitor.
8+
9+
type: application
10+
11+
# version - gets automatically set to the secureCodeBox release version when the helm charts gets published
12+
version: v3.1.0-alpha1
13+
kubeVersion: ">=v1.11.0-0"
14+
15+
keywords:
16+
- security
17+
- secureCodeBox
18+
- hook
19+
- azure
20+
- sentinel
21+
home: https://docs.securecodebox.io/docs/hooks/azure-monitor
22+
icon: https://docs.securecodebox.io/img/integrationIcons/AzureMonitor.svg
23+
sources:
24+
- https://github.com/secureCodeBox/secureCodeBox
25+
maintainers:
26+
- name: iteratec GmbH
27+
email: secureCodeBox@iteratec.com
28+
29+
dependencies: []
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/make -f
2+
#
3+
# SPDX-FileCopyrightText: 2022 iteratec GmbH
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
include_guard = set
9+
hook = persistence-azure-monitor
10+
11+
include ../../hooks.mk
12+
13+
unit-tests:
14+
@$(MAKE) -s unit-test-js
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
title: "Azure Monitor"
3+
category: "hook"
4+
type: "persistenceProvider"
5+
state: "released"
6+
usecase: "Publishes all Scan Findings to Azure Monitor."
7+
---
8+
9+
<!--
10+
SPDX-FileCopyrightText: the secureCodeBox authors
11+
12+
SPDX-License-Identifier: Apache-2.0
13+
-->
14+
<!--
15+
.: IMPORTANT! :.
16+
--------------------------
17+
This file is generated automatically with `helm-docs` based on the following template files:
18+
- ./.helm-docs/templates.gotmpl (general template data for all charts)
19+
- ./chart-folder/.helm-docs.gotmpl (chart specific template data)
20+
21+
Please be aware of that and apply your changes only within those template files instead of this file.
22+
Otherwise your changes will be reverted/overwritten automatically due to the build process `./.github/workflows/helm-docs.yaml`
23+
--------------------------
24+
-->
25+
26+
<p align="center">
27+
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="License Apache-2.0" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"/></a>
28+
<a href="https://github.com/secureCodeBox/secureCodeBox/releases/latest"><img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/secureCodeBox/secureCodeBox?sort=semver"/></a>
29+
<a href="https://owasp.org/www-project-securecodebox/"><img alt="OWASP Incubator Project" src="https://img.shields.io/badge/OWASP-Incubator%20Project-365EAA"/></a>
30+
<a href="https://artifacthub.io/packages/search?repo=securecodebox"><img alt="Artifact HUB" src="https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/securecodebox"/></a>
31+
<a href="https://github.com/secureCodeBox/secureCodeBox/"><img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/secureCodeBox/secureCodeBox?logo=GitHub"/></a>
32+
<a href="https://twitter.com/securecodebox"><img alt="Twitter Follower" src="https://img.shields.io/twitter/follow/securecodebox?style=flat&color=blue&logo=twitter"/></a>
33+
</p>
34+
35+
## What is "Persistence Azure Monitor" Hook about?
36+
The Azure Monitor persistenceProvider hook saves all findings and reports into the configured Azure Monitor workspace using the [Data Collector API](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api).
37+
This allows working with the data in [Azure Monitor](https://azure.microsoft.com/en-us/services/monitor/) or [Microsoft Sentinel](https://docs.microsoft.com/en-us/azure/sentinel/overview) to configure alerting based on new findings.
38+
It will create a custom log type for every scantype titled SCB_[scantype_name].
39+
40+
Installing the Azure Monitor persistenceProvider hook will add a _ReadOnly Hook_ to your namespace.
41+
42+
## Deployment
43+
The persistence-azure-monitor chart can be deployed via helm:
44+
45+
```bash
46+
# Install HelmChart (use -n to configure another namespace)
47+
helm upgrade --install persistence-azure-monitor secureCodeBox/persistence-azure-monitor
48+
```
49+
50+
## Requirements
51+
52+
Kubernetes: `>=v1.11.0-0`
53+
54+
## Additional Chart Configurations
55+
The hook requires the Azure Monitor Workspace ID and its Primary Key for authentication. For details on how to find them, see [this page](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api#sample-requests).
56+
Create a Kubernetes secret with these values using
57+
58+
```bash
59+
# Create the secret (use a leading space to avoid having secrets in your shell history)
60+
# Replace "workspace=your-workspace-id" with your Workspace ID
61+
# Replace "sharedkey=your-shared-key" with your Primary Key
62+
kubectl create secret generic azure-monitor --from-literal=workspace=your-workspace-id --from-literal=sharedkey=your-shared-key
63+
```
64+
65+
Then, configure the hook to use this secret when installing it:
66+
```bash
67+
helm upgrade --install persistence-azure-monitor . --wait \
68+
--set="monitor.authentication.apiKeySecret="azure-monitor""
69+
```
70+
71+
## Values
72+
73+
| Key | Type | Default | Description |
74+
|-----|------|---------|-------------|
75+
| hook.affinity | object | `{}` | Optional affinity settings that control how the hook job is scheduled (see: https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/) |
76+
| hook.image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images |
77+
| hook.image.repository | string | `"docker.io/securecodebox/hook-persistence-azure-monitor"` | Hook image repository |
78+
| hook.image.tag | string | defaults to the charts version | Container image tag |
79+
| hook.labels | object | `{}` | Add Kubernetes Labels to the hook definition |
80+
| hook.priority | int | `0` | Hook priority. Higher priority Hooks are guaranteed to execute before low priority Hooks. |
81+
| hook.tolerations | list | `[]` | Optional tolerations settings that control how the hook job is scheduled (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) |
82+
| hook.ttlSecondsAfterFinished | string | `nil` | Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/ |
83+
| monitor.authentication | object | `{"apiKeySecret":null}` | Configure authentication schema and credentials the persistence provider should use to connect to Azure Monitor |
84+
| monitor.authentication.apiKeySecret | string | `nil` | Link a pre-existing generic secret with `workspace` and `sharedkey` key / value pairs |
85+
| monitor.logtypePrefix | string | `"SCB"` | |
86+
87+
## License
88+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
89+
90+
Code of secureCodeBox is licensed under the [Apache License 2.0][scb-license].
91+
92+
[scb-owasp]: https://www.owasp.org/index.php/OWASP_secureCodeBox
93+
[scb-docs]: https://docs.securecodebox.io/
94+
[scb-site]: https://www.securecodebox.io/
95+
[scb-github]: https://github.com/secureCodeBox/
96+
[scb-twitter]: https://twitter.com/secureCodeBox
97+
[scb-slack]: https://join.slack.com/t/securecodebox/shared_invite/enQtNDU3MTUyOTM0NTMwLTBjOWRjNjVkNGEyMjQ0ZGMyNDdlYTQxYWQ4MzNiNGY3MDMxNThkZjJmMzY2NDRhMTk3ZWM3OWFkYmY1YzUxNTU
98+
[scb-license]: https://github.com/secureCodeBox/secureCodeBox/blob/master/LICENSE
99+
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<!--
2+
SPDX-FileCopyrightText: the secureCodeBox authors
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
<!--
7+
.: IMPORTANT! :.
8+
--------------------------
9+
This file is generated automatically with `helm-docs` based on the following template files:
10+
- ./.helm-docs/templates.gotmpl (general template data for all charts)
11+
- ./chart-folder/.helm-docs.gotmpl (chart specific template data)
12+
13+
Please be aware of that and apply your changes only within those template files instead of this file.
14+
Otherwise your changes will be reverted/overwritten automatically due to the build process `./.github/workflows/helm-docs.yaml`
15+
--------------------------
16+
-->
17+
18+
<p align="center">
19+
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="License Apache-2.0" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"/></a>
20+
<a href="https://github.com/secureCodeBox/secureCodeBox/releases/latest"><img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/secureCodeBox/secureCodeBox?sort=semver"/></a>
21+
<a href="https://owasp.org/www-project-securecodebox/"><img alt="OWASP Incubator Project" src="https://img.shields.io/badge/OWASP-Incubator%20Project-365EAA"/></a>
22+
<a href="https://artifacthub.io/packages/search?repo=securecodebox"><img alt="Artifact HUB" src="https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/securecodebox"/></a>
23+
<a href="https://github.com/secureCodeBox/secureCodeBox/"><img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/secureCodeBox/secureCodeBox?logo=GitHub"/></a>
24+
<a href="https://twitter.com/securecodebox"><img alt="Twitter Follower" src="https://img.shields.io/twitter/follow/securecodebox?style=flat&color=blue&logo=twitter"/></a>
25+
</p>
26+
27+
## What is OWASP secureCodeBox?
28+
29+
<p align="center">
30+
<img alt="secureCodeBox Logo" src="https://docs.securecodebox.io/img/Logo_Color.svg" width="250px"/>
31+
</p>
32+
33+
_[OWASP secureCodeBox][scb-github]_ is an automated and scalable open source solution that can be used to integrate various *security vulnerability scanners* with a simple and lightweight interface. The _secureCodeBox_ mission is to support *DevSecOps* Teams to make it easy to automate security vulnerability testing in different scenarios.
34+
35+
With the _secureCodeBox_ we provide a toolchain for continuous scanning of applications to find the low-hanging fruit issues early in the development process and free the resources of the penetration tester to concentrate on the major security issues.
36+
37+
The secureCodeBox project is running on [Kubernetes](https://kubernetes.io/). To install it you need [Helm](https://helm.sh), a package manager for Kubernetes. It is also possible to start the different integrated security vulnerability scanners based on a docker infrastructure.
38+
39+
### Quickstart with secureCodeBox on kubernetes
40+
41+
You can find resources to help you get started on our [documentation website](https://docs.securecodebox.io) including instruction on how to [install the secureCodeBox project](https://docs.securecodebox.io/docs/getting-started/installation) and guides to help you [run your first scans](https://docs.securecodebox.io/docs/getting-started/first-scans) with it.
42+
43+
## What is "Persistence Azure Monitor" Hook about?
44+
The Azure Monitor persistenceProvider hook saves all findings and reports into the configured Azure Monitor workspace using the [Data Collector API](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api).
45+
This allows working with the data in [Azure Monitor](https://azure.microsoft.com/en-us/services/monitor/) or [Microsoft Sentinel](https://docs.microsoft.com/en-us/azure/sentinel/overview) to configure alerting based on new findings.
46+
It will create a custom log type for every scantype titled SCB_[scantype_name].
47+
48+
Installing the Azure Monitor persistenceProvider hook will add a _ReadOnly Hook_ to your namespace.
49+
50+
## Deployment
51+
The persistence-azure-monitor chart can be deployed via helm:
52+
53+
```bash
54+
# Install HelmChart (use -n to configure another namespace)
55+
helm upgrade --install persistence-azure-monitor secureCodeBox/persistence-azure-monitor
56+
```
57+
58+
## Requirements
59+
60+
Kubernetes: `>=v1.11.0-0`
61+
62+
## Additional Chart Configurations
63+
The hook requires the Azure Monitor Workspace ID and its Primary Key for authentication. For details on how to find them, see [this page](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api#sample-requests).
64+
Create a Kubernetes secret with these values using
65+
66+
```bash
67+
# Create the secret (use a leading space to avoid having secrets in your shell history)
68+
# Replace "workspace=your-workspace-id" with your Workspace ID
69+
# Replace "sharedkey=your-shared-key" with your Primary Key
70+
kubectl create secret generic azure-monitor --from-literal=workspace=your-workspace-id --from-literal=sharedkey=your-shared-key
71+
```
72+
73+
Then, configure the hook to use this secret when installing it:
74+
```bash
75+
helm upgrade --install persistence-azure-monitor . --wait \
76+
--set="monitor.authentication.apiKeySecret="azure-monitor""
77+
```
78+
79+
## Values
80+
81+
| Key | Type | Default | Description |
82+
|-----|------|---------|-------------|
83+
| hook.affinity | object | `{}` | Optional affinity settings that control how the hook job is scheduled (see: https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/) |
84+
| hook.image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images |
85+
| hook.image.repository | string | `"docker.io/securecodebox/hook-persistence-azure-monitor"` | Hook image repository |
86+
| hook.image.tag | string | defaults to the charts version | Container image tag |
87+
| hook.labels | object | `{}` | Add Kubernetes Labels to the hook definition |
88+
| hook.priority | int | `0` | Hook priority. Higher priority Hooks are guaranteed to execute before low priority Hooks. |
89+
| hook.tolerations | list | `[]` | Optional tolerations settings that control how the hook job is scheduled (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) |
90+
| hook.ttlSecondsAfterFinished | string | `nil` | Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/ |
91+
| monitor.authentication | object | `{"apiKeySecret":null}` | Configure authentication schema and credentials the persistence provider should use to connect to Azure Monitor |
92+
| monitor.authentication.apiKeySecret | string | `nil` | Link a pre-existing generic secret with `workspace` and `sharedkey` key / value pairs |
93+
| monitor.logtypePrefix | string | `"SCB"` | |
94+
95+
## Contributing
96+
97+
Contributions are welcome and extremely helpful 🙌
98+
Please have a look at [Contributing](./CONTRIBUTING.md)
99+
100+
## Community
101+
102+
You are welcome, please join us on... 👋
103+
104+
- [GitHub][scb-github]
105+
- [Slack][scb-slack]
106+
- [Twitter][scb-twitter]
107+
108+
secureCodeBox is an official [OWASP][scb-owasp] project.
109+
110+
## License
111+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
112+
113+
Code of secureCodeBox is licensed under the [Apache License 2.0][scb-license].
114+
115+
[scb-owasp]: https://www.owasp.org/index.php/OWASP_secureCodeBox
116+
[scb-docs]: https://docs.securecodebox.io/
117+
[scb-site]: https://www.securecodebox.io/
118+
[scb-github]: https://github.com/secureCodeBox/
119+
[scb-twitter]: https://twitter.com/secureCodeBox
120+
[scb-slack]: https://join.slack.com/t/securecodebox/shared_invite/enQtNDU3MTUyOTM0NTMwLTBjOWRjNjVkNGEyMjQ0ZGMyNDdlYTQxYWQ4MzNiNGY3MDMxNThkZjJmMzY2NDRhMTk3ZWM3OWFkYmY1YzUxNTU
121+
[scb-license]: https://github.com/secureCodeBox/secureCodeBox/blob/master/LICENSE
122+

0 commit comments

Comments
 (0)