-
Notifications
You must be signed in to change notification settings - Fork 709
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11997 from sig-bsi-grundschutz/bsi-app-4.4-a20to21
Bsi app 4.4 a20to21
- Loading branch information
Showing
6 changed files
with
132 additions
and
13 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
applications/openshift/general/kube_descheduler_interval.var
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
documentation_complete: true | ||
|
||
title: 'Maximum number of seconds between descheduler runs' | ||
|
||
description: |- | ||
You can configure the maximum amount of time between descheduler runs in seconds. | ||
|
||
type: string | ||
|
||
operator: equals | ||
|
||
interactive: true | ||
|
||
options: | ||
default: "86400" |
40 changes: 40 additions & 0 deletions
40
applications/openshift/general/kube_descheduler_lifecycle_policy/rule.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
documentation_complete: true | ||
|
||
title: Ensure that the LifecycleAndUtilization Profile for the Kube Descheduler Operator is Enabled | ||
|
||
description: |- | ||
If there is an increased risk of external influences and a very high need for protection, pods should be stopped and restarted regularly. | ||
No pod should run for more than 24 hours. The availability of the applications in the pod should be ensured. | ||
rationale: |- | ||
If there is an increased risk of external influences and a very high need for protection, pods should be stopped and restarted regularly. | ||
identifiers: {} | ||
|
||
severity: medium | ||
|
||
ocil_clause: "The LifecycleAndUtilization profile for the Kube Descheduler operator is not enabled, the Interval is too high or mode is not set to automatic" | ||
|
||
ocil: |- | ||
Run the following command to edit the KubeDescheduler object: | ||
<pre>$ oc get kubedeschedulers.operator.openshift.io --all-namespaces </pre> | ||
Make sure the LifecycleAndUtilization profile is listed under .spec.profiles and the correct time between descheduler runs is set under .spec.deschedulingIntervalSeconds. Furthermore ensure that .spec.mode is set to 'Automatic' | ||
{{% set jqfilter = '[ .items[].spec | if any(.profiles[]; . =="LifecycleAndUtilization") and .deschedulingIntervalSeconds <= {{.kube_descheduler_interval}} and .mode == "Automatic" then true else false end]' %}} | ||
|
||
warnings: | ||
- general: |- | ||
{{{ openshift_filtered_cluster_setting({'/apis/operator.openshift.io/v1/kubedeschedulers': jqfilter}) | indent(4) }}} | ||
template: | ||
name: yamlfile_value | ||
vars: | ||
ocp_data: "true" | ||
filepath: {{{ openshift_filtered_path('/apis/operator.openshift.io/v1/kubedeschedulers', jqfilter) }}} | ||
yamlpath: "[:]" | ||
check_existence: "all_exist" | ||
entity_check: "all" | ||
values: | ||
- value: "true" | ||
operation: "equals" | ||
entity_check: "at least one" |
37 changes: 37 additions & 0 deletions
37
applications/openshift/general/kube_descheduler_operator_exists/rule.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
documentation_complete: true | ||
|
||
title: Ensure that the Kube Descheduler operator is deployed | ||
|
||
description: |- | ||
If there is an increased risk of external influences and a very high need for protection, pods should be stopped and restarted regularly. | ||
No pod should run for more than 24 hours. The availability of the applications in the pod should be ensured. | ||
rationale: |- | ||
If there is an increased risk of external influences and a very high need for protection, pods should be stopped and restarted regularly. | ||
identifiers: {} | ||
|
||
severity: medium | ||
|
||
ocil_clause: "the Kube Descheduler operator is not installed" | ||
|
||
ocil: |- | ||
To check if the Kube Descheduler Operator is installed, run the following command: | ||
<pre>oc get sub --all-namespaces | grep cluster-kube-descheduler-operator</pre> | ||
the output should return at least one entry that represents the installed operator. | ||
warnings: | ||
- general: |- | ||
{{{ openshift_cluster_setting("/apis/operators.coreos.com/v1alpha1/subscriptions") | indent(4) }}} | ||
template: | ||
name: yamlfile_value | ||
vars: | ||
ocp_data: "true" | ||
filepath: '/apis/operators.coreos.com/v1alpha1/subscriptions' | ||
yamlpath: ".items[:].status.installedCSV" | ||
check_existence: "at_least_one_exists" | ||
values: | ||
- value: "clusterkubedescheduleroperator.*" | ||
operation: "pattern match" | ||
entity_check: "at least one" |
19 changes: 19 additions & 0 deletions
19
applications/openshift/general/kube_descheduler_podlifetime/rule.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
documentation_complete: true | ||
|
||
title: 'Set Pod Lifetime for the Deschedulers' | ||
|
||
description: |- | ||
If there is an increased risk of external influences and a very high need for protection, pods should be stopped and restarted regularly. | ||
No pod should run for more than 24 hours. The availability of the applications in the pod should be ensured. | ||
rationale: |- | ||
If there is an increased risk of external influences and a very high need for protection, pods should be stopped and restarted regularly. With this an attacker who gained control over a pod loses it and the pod gets restarted from a known good state (the image). | ||
severity: medium | ||
|
||
ocil_clause: 'podLifetime Values of Deschedulers need review' | ||
|
||
ocil: |- | ||
Run the following command and review the kubedeschedulers and how they are configured. <pre>$ oc get kubedeschedulers.operator.openshift.io --all-namespaces -o=custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,deschedulingIntervalSeconds:.spec.deschedulingIntervalSeconds,podLifetime:.spec.profileCustomizations.podLifetime,Profiles:.spec.profiles </pre> | ||
Ensure that each kubedescheduler, which defines the LifecycleAndUtilization Profile also defines a podLifetime of none or below your company threshold (i.e. 24h) |
2 changes: 2 additions & 0 deletions
2
applications/openshift/general/kube_descheduler_podlifetime/tests/ocp4/e2e.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
default_result: MANUAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters