@@ -201,7 +201,7 @@ capabilities:
201201allowPrivilegeEscalation: false
202202seccompProfile:
203203 type: Unconfined
204- { {- if and ( eq (include " host.response_actions_enabled " .) " true" ) ( include " common.cluster_type.is_bottlerocket " .) } }
204+ { {- if eq (include " host.response_actions_needs_higher_privileges " .) " true" } }
205205seLinuxOptions:
206206 type: control_t
207207{ {- end } }
@@ -245,6 +245,31 @@ true
245245{ {- end } }
246246{ {- end } }
247247
248+ { {/*
249+ This function checks if response actions that need higher privileges are enabled.
250+ These include : file_acquire, file_quarantine, and get_logs.
251+ Returns true if response_actions is enabled AND at least one of these actions has trigger != " none" .
252+ */} }
253+ { {- define " host.response_actions_needs_higher_privileges" } }
254+ { {- if eq (include " host.response_actions_enabled" .) " true" } }
255+ { {- $feature_respond := dig " respond" (dict) .Values.features } }
256+ { {- $additional_features := dig " features" (dict) .Values.host.additional_settings } }
257+ { {- $additional_respond := dig " respond" (dict) $additional_features } }
258+ { {- $response_actions := dict } }
259+ { {- if hasKey $additional_respond " response_actions" } }
260+ { {- $response_actions = get $additional_respond " response_actions" } }
261+ { {- else if hasKey $feature_respond " response_actions" } }
262+ { {- $response_actions = get $feature_respond " response_actions" } }
263+ { {- end } }
264+ { {- $file_acquire := dig " file_acquire" (dict) $response_actions } }
265+ { {- $file_quarantine := dig " file_quarantine" (dict) $response_actions } }
266+ { {- $get_logs := dig " get_logs" (dict) $response_actions } }
267+ { {- if or (and $file_acquire (ne (dig " trigger" " none" $file_acquire ) " none" )) (and $file_quarantine (ne (dig " trigger" " none" $file_quarantine ) " none" )) (and $get_logs (ne (dig " trigger" " none" $get_logs ) " none" )) } }
268+ { {- true -} }
269+ { {- end } }
270+ { {- end } }
271+ { {- end } }
272+
248273{ {- define " host.rapid_response_password" } }
249274{ {- $feature_respond := get .Values.features (include " host.respond_key" .Values.features) } }
250275{ {- if (dig " rapid_response" " password" nil $feature_respond ) } }
0 commit comments