-
Notifications
You must be signed in to change notification settings - Fork 791
CMP-4040, CMP-4041: Add support for CEL based rules and profiles #14597
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
base: master
Are you sure you want to change the base?
Changes from all commits
49a8108
3405a0f
e08420a
6d47a17
c83fd14
0dc64b8
2678610
9ce929e
e065c5b
90afdcd
12fde16
ba8e930
ae5afb0
2772f94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| documentation_complete: true | ||
|
|
||
| title: 'OpenShift Virtualization' | ||
|
|
||
| description: |- | ||
| This section contains security recommendations for OpenShift Virtualization | ||
| (KubeVirt) configuration and virtual machine management. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| check_type: Platform | ||
|
|
||
| inputs: | ||
| - name: hco | ||
| kubernetes_input_spec: | ||
| api_version: hco.kubevirt.io/v1beta1 | ||
| resource: hyperconvergeds | ||
| resource_name: kubevirt-hyperconverged | ||
| resource_namespace: openshift-cnv | ||
|
|
||
| expression: |- | ||
| !has(hco.spec.storageImport) || | ||
| hco.spec.storageImport.insecureRegistries.size() == 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| documentation_complete: true | ||
|
|
||
| title: 'Only Trusted Registries Using TLS Can Be Used' | ||
|
|
||
| description: |- | ||
| By only pulling container images from trusted registries using TLS, organizations | ||
| can reduce the risk of introducing unknown vulnerabilities or malicious | ||
| software into their systems. This helps ensure that their applications and systems | ||
| remain secure and stable. All container image registries used by KubeVirt should | ||
| require TLS connections to protect the integrity and authenticity of images. | ||
|
|
||
| rationale: |- | ||
| When the <tt>.spec.storageImport.insecureRegistries</tt> field contains entries in | ||
| the <tt>kubevirt-hyperconverged</tt> resource, KubeVirt is configured to allow | ||
| connections to container registries that do not use TLS encryption. This creates | ||
| a significant security risk as images could be intercepted or tampered with during | ||
| transit. Man-in-the-middle attacks could result in malicious images being pulled | ||
| and executed within virtual machines. To maintain security, only registries using | ||
| TLS should be permitted, and the insecureRegistries list should be empty. | ||
|
|
||
| failure_reason: |- | ||
| There are registries not using TLS in '.spec.storageImport.insecureRegistries' in | ||
| the 'kubevirt-hyperconverged' resource. | ||
|
|
||
| severity: medium | ||
|
|
||
| ocil_clause: 'insecure registries are configured' | ||
|
|
||
| ocil: |- | ||
| Run the following command to check for insecure registries: | ||
| <pre>$ oc get hyperconverged kubevirt-hyperconverged -n openshift-cnv -o jsonpath='{.spec.storageImport.insecureRegistries}'</pre> | ||
| The output should be empty or the field should not exist. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| check_type: Platform | ||
|
|
||
| inputs: | ||
| - name: hcoList | ||
| kubernetes_input_spec: | ||
| api_version: hco.kubevirt.io/v1beta1 | ||
| resource: hyperconvergeds | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. followup: could add |
||
|
|
||
| expression: | | ||
| hcoList.items.filter(h, | ||
| h.metadata.name == 'kubevirt-hyperconverged' && | ||
| h.metadata.namespace == 'openshift-cnv' | ||
| ).size() == 1 && | ||
| hcoList.items.filter(h, | ||
| h.metadata.name == 'kubevirt-hyperconverged' && | ||
| h.metadata.namespace == 'openshift-cnv' | ||
| ).all(h, | ||
| !has(h.spec.permittedHostDevices) || | ||
| h.spec.permittedHostDevices == null || | ||
| (has(h.spec.permittedHostDevices.pciHostDevices) && size(h.spec.permittedHostDevices.pciHostDevices) == 0) && | ||
| (has(h.spec.permittedHostDevices.mediatedDevices) && size(h.spec.permittedHostDevices.mediatedDevices) == 0) | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| documentation_complete: true | ||
|
|
||
| title: 'KubeVirt Must Not Permit Host Devices' | ||
|
|
||
| description: |- | ||
| Host devices should not be permitted to virtualization workloads unless | ||
| absolutely necessary for workload execution. Allowing host devices provides | ||
| direct access to host hardware, which can introduce security risks including | ||
| unauthorized access to sensitive hardware resources, potential for privilege | ||
| escalation, and bypass of virtualization security boundaries. | ||
|
|
||
| By default, no host devices should be trusted or permitted for use by | ||
| virtualization workloads. | ||
|
|
||
| rationale: |- | ||
| The <tt>.spec.permittedHostDevices</tt> field in the <tt>kubevirt-hyperconverged</tt> | ||
| resource controls which host devices can be used by virtualization workloads. | ||
| Permitting host devices allows virtual machines to bypass virtualization boundaries | ||
| and directly access host hardware, which introduces significant security risks. | ||
| This can lead to unauthorized access to sensitive hardware resources, privilege | ||
| escalation opportunities, and potential compromise of the host system. Unless | ||
| explicitly required, no host devices should be permitted. | ||
|
|
||
| failure_reason: |- | ||
| The '.spec.permittedHostDevices' field is set in the 'kubevirt-hyperconverged' | ||
| resource, allowing host devices to be used by virtualization workloads. | ||
|
|
||
| severity: medium | ||
|
|
||
| ocil_clause: 'permittedHostDevices are configured in kubevirt-hyperconverged' | ||
|
|
||
| ocil: |- | ||
| Run the following command to check the HyperConverged configuration: | ||
| <pre>$ oc get hyperconverged kubevirt-hyperconverged -n openshift-cnv -o jsonpath='{.spec.permittedHostDevices}'</pre> | ||
| The output should be empty or show empty lists for both <tt>pciHostDevices</tt> and <tt>mediatedDevices</tt>. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| check_type: Platform | ||
|
|
||
| inputs: | ||
| - name: vms | ||
| kubernetes_input_spec: | ||
| api_version: kubevirt.io/v1 | ||
| resource: VirtualMachine | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. followup: |
||
|
|
||
| expression: | | ||
| vms.all(h, | ||
| !has(h.spec.template.spec.domain.resources) || | ||
| !has(h.spec.template.spec.domain.resources.overcommitGuestOverhead) || | ||
| (has(h.spec.template.spec.domain.resources.overcommitGuestOverhead) && | ||
| h.spec.template.spec.domain.resources.overcommitGuestOverhead == false) | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved to cel folder in the docs as well.