Role-based access to security context constraints
You can specify SCCs as resources that are handled by RBAC. This allows you to scope access to your SCCs to a certain project or to the entire cluster. Assigning users, groups, or service accounts directly to an SCC retains cluster-wide scope.
|
|
Do not run workloads in or share access to default projects. Default projects are reserved for running core cluster components. The following default projects are considered highly privileged: |
To include access to SCCs for your role, specify the scc resource
when creating a role.
$ oc create role <role-name> --verb=use --resource=scc --resource-name=<scc-name> -n <namespace>
This results in the following role definition:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
...
name: role-name
namespace: namespace
...
rules:
- apiGroups:
- security.openshift.io
resourceNames:
- scc-name
resources:
- securitycontextconstraints
verbs:
- use
- where
name-
The name of the role.
namespace-
The namespace of the defined role. Defaults to
defaultif not specified. apiGroups-
The API group that includes the
SecurityContextConstraintsresource. Automatically defined whensccis specified as a resource. resourceName-
An example name for an SCC you want to have access.
resources-
The name of the resource group that allows users to specify SCC names in the
resourceNamesfield. verbs-
A list of verbs to apply to the role.
A local or cluster role with such a rule allows the subjects that are
bound to it with a role binding or a cluster role binding to use the
user-defined SCC called scc-name.
|
|
Because RBAC is designed to prevent escalation, even project administrators
are unable to grant access to an SCC. By default, they are not
allowed to use the verb |