forked from ComplianceAsCode/content
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #68 from sig-bsi-grundschutz/bsi-sys-1-6-a26
PreProfile: Bsi sys 1 6 a26
- Loading branch information
Showing
10 changed files
with
179 additions
and
8 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
applications/openshift/general/sandboxed_containers_operator_configured/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,41 @@ | ||
|
||
title: Ensure that Sandboxed Containers Operator is Configured | ||
|
||
description: |- | ||
{{{ weblink(link="https://docs.redhat.com/en/documentation/openshift_sandboxed_containers/1.7", | ||
text="The Sandboxed Containers Operator") }}} | ||
provides containers with a dedicated kernel by running them in a virtual machine. This allows for extended separation, as no kernel is shared. This is done by using RHCOS cluster extension and is only available on RHCOS nodes. | ||
It is only active, if it is correctly configured with a KataConfig AND you configured each pod spec with <pre>runtimeClassName: kata</pre>. | ||
Be advised, that on AWS, Azure, IBM Z and IBM LinuxOne you need to enable PeerPods and confiugre additional resources. | ||
rationale: |- | ||
Using separate kernels for each container provides for better isolation, and makes it harder for adveseries to move laterally to other containers or the container-host. | ||
severity: medium | ||
|
||
identifiers: | ||
cce@ocp4: CCE-87430-5 | ||
|
||
ocil_clause: 'Sandboxed Containers Operator is not configured' | ||
|
||
ocil: |- | ||
Run the following command to check if a KataConfig for the cluster exists: | ||
<pre>$ oc get kataconfigs openshift-sandboxed-containers-operator</pre> | ||
Make sure at least one KataConfig exists. | ||
warnings: | ||
- general: |- | ||
{{{ openshift_cluster_setting("/apis/kataconfiguration.openshift.io/v1/kataconfigs?limit=5") | indent(4) }}} | ||
template: | ||
name: yamlfile_value | ||
vars: | ||
ocp_data: "true" | ||
filepath: /apis/kataconfiguration.openshift.io/v1/kataconfigs?limit=5 | ||
yamlpath: ".items[:].metadata.name" | ||
entity_check: "at least one" | ||
values: | ||
- value: ".*" | ||
operation: "pattern match" |
27 changes: 27 additions & 0 deletions
27
.../openshift/general/sandboxed_containers_operator_configured/tests/ocp4/e2e-remediation.sh
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,27 @@ | ||
#!/bin/bash | ||
set -xe | ||
|
||
echo "installing sandboxed-containers-operator" | ||
oc apply -f ${ROOT_DIR}/ocp-resources/e2e/sandboxed-containers-install.yaml --server-side=true | ||
|
||
sleep 30 | ||
|
||
echo "waiting for sandboxed-containers-operator deployment to exist" | ||
while [ -z "$(oc get -n openshift-sandboxed-containers-operator --ignore-not-found deployment/controller-manager)" ]; do | ||
sleep 3 | ||
done | ||
|
||
# we need to wait for the pods to be ready, otherwise there is no webhook endpoint | ||
# for the kataconfig | ||
echo "waiting for sandboxed-containers-operator pods to be ready" | ||
oc wait -n openshift-sandboxed-containers-operator --for=condition=ContainersReady=true \ | ||
--timeout=300s pods -l control-plane=controller-manager | ||
|
||
echo "configuring kataconfig" | ||
oc apply -f ${ROOT_DIR}/ocp-resources/e2e/sandboxed-containers-instance.yaml --server-side=true | ||
|
||
echo "check, that the mcp was updated" | ||
oc wait --for=condition=Updated --timeout=3600s machineconfigpool/kata-oc | ||
|
||
echo "waiting for the cluster to become stable" | ||
oc adm wait-for-stable-cluster --minimum-stable-period 1m |
3 changes: 3 additions & 0 deletions
3
applications/openshift/general/sandboxed_containers_operator_configured/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,3 @@ | ||
--- | ||
default_result: FAIL | ||
result_after_remediation: PASS |
38 changes: 38 additions & 0 deletions
38
applications/openshift/general/sandboxed_containers_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,38 @@ | ||
|
||
title: Ensure that Sandboxed Containers Operator exists in the cluster | ||
|
||
description: |- | ||
{{{ weblink(link="https://docs.redhat.com/en/documentation/openshift_sandboxed_containers/1.7", | ||
text="The Sandboxed Containers Operator") }}} | ||
provides containers with a dedicated kernel by running them in a virtual machine. This allows for extended separation, as no kernel is shared. This is done by using RHCOS cluster extension and is only available on RHCOS nodes. | ||
rationale: |- | ||
Using separate kernels for each container provides for better isolation, and makes it harder for adveseries to move laterally to other containers or the container-host. | ||
severity: medium | ||
|
||
identifiers: | ||
cce@ocp4: CCE-86496-7 | ||
|
||
ocil_clause: 'Sandboxed Containers Operator is not installed' | ||
|
||
ocil: |- | ||
Run the following command to check if a subscription for the operator exists in the system: | ||
<pre>$ oc get sub -n openshift-sandboxed-containers-operator</pre> | ||
Make sure the Sandboxed Containers Operator is installed. | ||
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: "sandboxed-containers-operator.*" | ||
operation: "pattern match" | ||
entity_check: "at least one" |
16 changes: 16 additions & 0 deletions
16
...ions/openshift/general/sandboxed_containers_operator_exists/tests/ocp4/e2e-remediation.sh
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,16 @@ | ||
#!/bin/bash | ||
set -xe | ||
|
||
echo "installing sandboxed-containers-operator" | ||
oc apply -f ${ROOT_DIR}/ocp-resources/e2e/sandboxed-containers-install.yaml --server-side=true | ||
|
||
sleep 30 | ||
|
||
echo "waiting for sandboxed-containers-operator deployment to exist" | ||
while [ -z "$(oc get -n openshift-sandboxed-containers-operator --ignore-not-found deployment/controller-manager)" ]; do | ||
sleep 3 | ||
done | ||
|
||
echo "waiting for sandboxed-containers-operator deployment to be ready" | ||
oc wait -n openshift-sandboxed-containers-operator --for=condition=Available --timeout=300s \ | ||
deployment/controller-manager |
3 changes: 3 additions & 0 deletions
3
applications/openshift/general/sandboxed_containers_operator_exists/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,3 @@ | ||
--- | ||
default_result: FAIL | ||
result_after_remediation: PASS |
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
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,28 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: openshift-sandboxed-containers-operator | ||
labels: | ||
openshift.io/cluster-monitoring: "true" | ||
--- | ||
apiVersion: operators.coreos.com/v1 | ||
kind: OperatorGroup | ||
metadata: | ||
name: sandboxed-containers-operator-group | ||
namespace: openshift-sandboxed-containers-operator | ||
spec: | ||
targetNamespaces: | ||
- openshift-sandboxed-containers-operator | ||
--- | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: "sandboxed-containers-operator" | ||
namespace: "openshift-sandboxed-containers-operator" | ||
spec: | ||
channel: stable | ||
installPlanApproval: Automatic | ||
name: sandboxed-containers-operator | ||
source: redhat-operators | ||
sourceNamespace: openshift-marketplace |
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,12 @@ | ||
apiVersion: kataconfiguration.openshift.io/v1 | ||
kind: KataConfig | ||
metadata: | ||
name: example-kataconfig | ||
spec: | ||
checkNodeEligibility: false | ||
enablePeerPods: false | ||
kataConfigPoolSelector: | ||
matchExpressions: | ||
- key: node-role.kubernetes.io/worker | ||
operator: Exists | ||
logLevel: info |
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