N/A
Source
Kube Bench
ID
6
Version
rh-0.7

6 General Security Primitives

6.1 Ensure that the cluster-admin role is only used where required

[Manual test] Review users, groups, serviceaccounts bound to cluster-admin: oc get clusterrolebindings | grep cluster-admin

Review users and groups bound to cluster-admin and decide whether they require such access. Consider creating least-privilege roles for users and service accounts

6.2 Verify Security Context Constraints as in use

[Manual test] Review Security Context Constraints: oc get scc

Use OpenShift’s Security Context Constraint feature, which has been contributed to Kubernetes as Pod Security Policies. PSPs are still beta in Kubernetes 1.10. OpenShift ships with two SCCs: restricted and privileged.

The two default SCCs will be created when the master is started. The restricted SCC is granted to all authenticated users by default.

https://docs.openshift.com/container-platform/3.10/admin_guide/manage_scc.html"

6.3 Use OpenShift projects to maintain boundaries between resources

[Manual test] Review projects: oc get projects

6.4 Create network segmentation using the Multi-tenant plugin or Network Policies

[Manual test] Verify on masters the plugin being used: grep networkPluginName /etc/origin/master/master-config.yaml

OpenShift provides multi-tenant networking isolation (using Open vSwich and vXLAN), to segregate network traffic between containers belonging to different tenants (users or applications) while running on a shared cluster. Red Hat also works with 3rd-party SDN vendors to provide the same level of capabilities integrated with OpenShift. OpenShift SDN is included a part of OpenShift subscription.

OpenShift supports Kubernetes NetworkPolicy. Administrator must configure NetworkPolicies if desired.

https://docs.openshift.com/container-platform/3.10/architecture/networking/sdn.html#architecture-additional-concepts-sdn

Ansible Inventory variable: os_sdn_network_plugin_name: https://docs.openshift.com/container-platform/3.10/install/configuring_inventory_file.html

6.5 Enable seccomp and configure custom Security Context Constraints

[Manual test] Verify SCCs that have been configured with seccomp: oc get scc -ocustom-columns=NAME:.metadata.name,SECCOMP-PROFILES:.seccompProfiles

OpenShift does not enable seccomp by default. To configure seccomp profiles that are applied to pods run by the SCC, follow the instructions in the documentation:

https://docs.openshift.com/container-platform/3.9/admin_guide/seccomp.html#admin-guide-seccomp

6.6 Review Security Context Constraints

[Manual test] Review SCCs: oc describe scc

Use OpenShift’s Security Context Constraint feature, which has been contributed to Kubernetes as Pod Security Policies. PSPs are still beta in Kubernetes 1.10.

OpenShift ships with two SCCs: restricted and privileged. The two default SCCs will be created when the master is started. The restricted SCC is granted to all authenticated users by default.

All pods are run under the restricted SCC by default. Running a pod under any other SCC requires an account with cluster admin capabilities to grant access for the service account.

SecurityContextConstraints limit what securityContext is applied to pods and containers.

https://docs.openshift.com/container-platform/3.10/admin_guide/manage_scc.html

6.7 Manage Image Provenance using ImagePolicyWebhook admission controller

[Manual test] Review imagePolicyConfig in /etc/origin/master/master-config.yaml.

6.8 Configure Network policies as appropriate

[Manual test] If ovs-networkplugin is used, review network policies: oc get networkpolicies

OpenShift supports Kubernetes NetworkPolicy via ovs-networkpolicy plugin. If choosing ovs-multitenant plugin, each namespace is isolated in its own netnamespace by default.

6.9 Use Security Context Constraints as compensating controls for privileged containers

[Manual test]

  1. Determine all sccs allowing privileged containers: oc get scc -ocustom-columns=NAME:.metadata.name,ALLOWS_PRIVILEGED:.allowPrivilegedContainer
  2. Review users and groups assigned to sccs allowing priviliged containers: oc describe sccs <from (1)>

Use OpenShift’s Security Context Constraint feature, which has been contributed to Kubernetes as Pod Security Policies. PSPs are still beta in Kubernetes 1.10.

OpenShift ships with two SCCs: restricted and privileged. The two default SCCs will be created when the master is started. The restricted SCC is granted to all authenticated users by default.

Similar scenarios are documented in the SCC documentation, which outlines granting SCC access to specific serviceaccounts. Administrators may create least-restrictive SCCs based on individual container needs.

For example, if a container only requires running as the root user, the anyuid SCC can be used, which will not expose additional access granted by running privileged containers.

https://docs.openshift.com/container-platform/3.10/admin_guide/manage_scc.html