Skip to content

chore(shield): add support to rapid_response and response_actions features #2221

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

Merged
merged 5 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion charts/shield/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ maintainers:
- name: mavimo
email: [email protected]
type: application
version: 1.3.6
version: 1.3.7
appVersion: "1.0.0"
1 change: 1 addition & 0 deletions charts/shield/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ The following table lists the configurable parameters of the `shield` chart and
| features.investigations.event_forwarder.integrations | | <code>[]</code> |
| features.investigations.event_forwarder.transmit_message_types | | <code>[]</code> |
| features.respond.rapid_response.enabled | | <code>false</code> |
| features.respond.response_actions.enabled | | <code>false</code> |
| features.monitor.app_checks.enabled | | <code>false</code> |
| features.monitor.java_management_extensions.enabled | | <code>false</code> |
| features.monitor.prometheus.enabled | | <code>false</code> |
Expand Down
19 changes: 13 additions & 6 deletions charts/shield/templates/host/_configmap_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
{{- dict "vulnerability_management" (pick . "host_vulnerability_management" "in_use") | toYaml }}
{{- end }}

{{- define "host.configmap.responding" }}
{{- dict "respond" (pick . "rapid_response") | toYaml }}
{{- define "host.configmap.respond" }}
{{- $respond := dict -}}
{{- $featureRespond := get . (include "host.respond_key" .) }}
{{- $rapid_response := dict "rapid_response" (pick $featureRespond.rapid_response "enabled") }}
{{- $respond = merge $respond $rapid_response -}}
{{- $respond = merge $respond (pick .respond "response_actions") -}}
{{- dict "respond" $respond | toYaml }}
{{- end }}

{{- define "host.configmap.detections" }}
Expand All @@ -27,9 +32,9 @@
{{- with .Values.features.vulnerability_management }}
{{- $featuresConfig = merge $featuresConfig ((include "host.configmap.vm" .) | fromYaml) }}
{{- end }}
{{- with .Values.features.respond }}
{{- $featuresConfig = merge $featuresConfig ((include "host.configmap.responding" .) | fromYaml) }}
{{- end }}

{{- $featuresConfig = merge $featuresConfig ((include "host.configmap.respond" .Values.features) | fromYaml) }}

{{- with .Values.features.detections }}
{{- $featuresConfig = merge $featuresConfig ((include "host.configmap.detections" .) | fromYaml)}}
{{- end }}
Expand Down Expand Up @@ -118,7 +123,9 @@ true
{{- $config := merge $config (dict "http_proxy" (include "host.dragent_proxy_config" . | fromYaml)) }}
{{- end }}
{{- if (include "host.rapid_response_enabled" .) }}
{{- $config = merge $config (dict "rapid_response" (dict "enabled" true)) }}
{{- $respond := get .Values.features (include "host.respond_key" .Values.features) }}
{{- $rapid_response := omit (get $respond "rapid_response") "password" }}
{{- $config = merge $config (dict "rapid_response" $rapid_response) }}
{{- end }}
{{- $config = merge $config (include "host.parse_features" . | fromYaml) }}
{{/* Host Scanner requires setting the host fs mount path variable, but that
Expand Down
4 changes: 2 additions & 2 deletions charts/shield/templates/host/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ true
If neither is found, it defaults to false.
*/}}
{{- define "host.response_actions_enabled" }}
{{- $feature_respond := dig (include "host.respond_key" .Values.features) (dict) .Values.features }}
{{- $feature_respond := dig "respond" (dict) .Values.features }}
{{- $additional_features := dig "features" (dict) .Values.host.additional_settings }}
{{- $additional_respond := dig (include "host.respond_key" $additional_features) (dict) $additional_features }}
{{- $additional_respond := dig "respond" (dict) $additional_features }}
{{- if hasKey $additional_respond "response_actions" }}
{{- dig "response_actions" "enabled" false $additional_respond -}}
{{- else if hasKey $feature_respond "response_actions" }}
Expand Down
67 changes: 67 additions & 0 deletions charts/shield/tests/host/configmap-host-shield-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ tests:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: false
Expand Down Expand Up @@ -56,6 +58,8 @@ tests:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: false
Expand Down Expand Up @@ -83,6 +87,8 @@ tests:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: false
Expand Down Expand Up @@ -110,6 +116,8 @@ tests:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: true
Expand Down Expand Up @@ -137,6 +145,8 @@ tests:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: false
Expand All @@ -159,6 +169,8 @@ tests:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: false
Expand Down Expand Up @@ -189,6 +201,8 @@ tests:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: true
Expand Down Expand Up @@ -218,6 +232,8 @@ tests:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: true
Expand All @@ -231,7 +247,25 @@ tests:
respond:
rapid_response:
enabled: true
password: test1234
asserts:
- notMatchRegex:
path: data['dragent.yaml']
pattern: |-
rapid_response:
enabled: true
password: test1234
- notMatchRegex:
path: data['host-shield.yaml']
pattern: |-
rapid_response:
enabled: true
password: test1234
- matchRegex:
path: data['dragent.yaml']
pattern: |-
rapid_response:
enabled: true
- matchRegex:
path: data['host-shield.yaml']
pattern: |-
Expand All @@ -245,6 +279,37 @@ tests:
respond:
rapid_response:
enabled: true
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: false
in_use:
enabled: false
integration_enabled: false

- it: Enable Response Actions
set:
features:
respond:
response_actions:
enabled: true
asserts:
- matchRegex:
path: data['host-shield.yaml']
pattern: |-
features:
detections:
ml_policies:
enabled: false
posture:
host_posture:
enabled: false
respond:
rapid_response:
enabled: false
response_actions:
enabled: true
vulnerability_management:
host_vulnerability_management:
enabled: false
Expand Down Expand Up @@ -272,6 +337,8 @@ tests:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
vulnerability_management:
host_vulnerability_management:
enabled: false
Expand Down
4 changes: 4 additions & 0 deletions charts/shield/tests/host/secrets_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ tests:
apiVersion: v1
name: release-name-shield-host-rapid-response
namespace: shield-namespace
- equal:
path: data.password
decodeBase64: true
value: "abc123"
2 changes: 2 additions & 0 deletions charts/shield/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ features:
respond:
rapid_response:
enabled: false
response_actions:
enabled: false
monitor:
app_checks:
enabled: false
Expand Down
Loading