Skip to content

Commit e8141fb

Browse files
authored
Merge pull request #30617 from bergerhoffer/OSDOCS-1898
OSDOCS-1898: Improving About SCC docs
2 parents 46565e9 + 08fa426 commit e8141fb

File tree

2 files changed

+135
-103
lines changed

2 files changed

+135
-103
lines changed

modules/security-context-constraints-about.adoc

Lines changed: 129 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,86 @@
55
[id="security-context-constraints-about_{context}"]
66
= About security context constraints
77

8-
Similar to the way that RBAC resources control user access, administrators can
9-
use _security context constraints_ (SCCs) to control permissions for pods. These
10-
permissions include actions that a _pod_, a collection of containers, can
11-
perform and what resources it can access. You can use SCCs to define a set of
12-
conditions that a pod must run with to be accepted into the system.
13-
14-
ifdef::openshift-origin,openshift-enterprise,openshift-dedicated[]
15-
SCCs allow an administrator to control:
16-
17-
- Whether a pod can run privileged containers.
18-
- The capabilities that a container can request.
19-
- The use of host directories as volumes.
20-
- The SELinux context of the container.
21-
- The container user ID.
22-
- The use of host namespaces and networking.
23-
- The allocation of an `FSGroup` that owns the pod's volumes.
24-
- The configuration of allowable supplemental groups.
25-
- Whether a container requires the use of a read only root file system.
26-
- The usage of volume types.
27-
- The configuration of allowable `seccomp` profiles.
28-
29-
////
30-
If you have `cluster-admin` privileges, you can adjust the default SCC policies to
31-
be more permissive.
32-
////
33-
34-
The cluster contains nine default SCCs:
35-
36-
* `anyuid`
37-
* `hostaccess`
38-
* `hostmount-anyuid`
39-
* `hostnetwork`
40-
+
41-
[WARNING]
42-
====
43-
If additional workloads are run on control plane hosts (also known as the master hosts), use caution when providing access to `hostnetwork`. A workload that runs `hostnetwork` on a control plane host is effectively root on the cluster and must be trusted accordingly.
44-
====
45-
* `node-exporter`
46-
* `nonroot`
47-
* `privileged`
48-
* `restricted`
49-
* `pipelines-scc`
8+
Similar to the way that RBAC resources control user access, administrators can use _security context constraints_ (SCCs) to control permissions for pods. These permissions include actions that a pod can perform and what resources it can access. You can use SCCs to define a set of conditions that a pod must run with to be accepted into the system.
9+
10+
Security context constraints allow an administrator to control:
5011

12+
* Whether a pod can run privileged containers
13+
* The capabilities that a container can request
14+
* The use of host directories as volumes
15+
* The SELinux context of the container
16+
* The container user ID
17+
* The use of host namespaces and networking
18+
* The allocation of an `FSGroup` that owns the pod volumes
19+
* The configuration of allowable supplemental groups
20+
* Whether a container requires write access to its root file system
21+
* The usage of volume types
22+
* The configuration of allowable `seccomp` profiles
23+
24+
[id="default-sccs_{context}"]
25+
== Default security context constraints
26+
27+
The cluster contains several default security context constraints (SCCs) as described in the table below. Additional SCCs might be installed when you install Operators or other components to {product-title}.
5128

5229
[IMPORTANT]
5330
====
5431
Do not modify the default SCCs. Customizing the default SCCs can lead to issues when some of the platform pods deploy or {product-title} is upgraded. During upgrades between some versions of {product-title}, the values of the default SCCs are reset to the default values, which discards all customizations to those SCCs.
5532
ifdef::openshift-origin,openshift-enterprise,openshift-webscale[]
56-
Instead, create new SCCs.
33+
Instead, create new SCCs as needed.
5734
endif::[]
5835
====
5936

37+
.Default security context constraints
38+
[cols="1,3a",options="header"]
39+
|===
40+
|Security context constraint |Description
41+
42+
|`anyuid`
43+
| Provides all features of the `restricted` SCC, but allows users to run with any UID and any GID.
44+
45+
|`hostaccess`
46+
|Allows access to all host namespaces but still requires pods to be run with a UID and SELinux context that are allocated to the namespace.
47+
48+
[WARNING]
49+
====
50+
This SCC allows host access to namespaces, file systems, and PIDS. It should only be used by trusted pods. Grant with caution.
51+
====
52+
53+
|`hostmount-anyuid`
54+
|Provides all the features of the `restricted` SCC, but allows host mounts and running as any UID and any GID on the system.
55+
56+
[WARNING]
57+
====
58+
This SCC allows host file system access as any UID, including UID 0. Grant with caution.
59+
====
60+
61+
|`hostnetwork`
62+
|Allows using host networking and host ports but still requires pods to be run with a UID and SELinux context that are allocated to the namespace.
63+
64+
[WARNING]
65+
====
66+
If additional workloads are run on control plane hosts (also known as the master hosts), use caution when providing access to `hostnetwork`. A workload that runs `hostnetwork` on a control plane host is effectively root on the cluster and must be trusted accordingly.
67+
====
68+
69+
|`node-exporter`
70+
|Used for the Prometheus node exporter.
71+
72+
[WARNING]
73+
====
74+
This SCC allows host file system access as any UID, including UID 0. Grant with caution.
75+
====
76+
77+
|`nonroot`
78+
|Provides all features of the `restricted` SCC, but allows users to run with any non-root UID. The user must specify the UID or it must be specified in the manifest of the container runtime.
79+
80+
|`privileged`
81+
|Allows access to all privileged and host features and the ability to run as any user, any group, any FSGroup, and with any SELinux context.
82+
83+
[WARNING]
84+
====
85+
This is the most relaxed SCC and should be used only for cluster administration. Grant with caution.
86+
====
87+
6088
The `privileged` SCC allows:
6189

6290
* Users to run privileged pods
@@ -70,25 +98,32 @@ The `privileged` SCC allows:
7098
* Pods to use any seccomp profiles
7199
* Pods to request any capabilities
72100

73-
The `restricted` SCC:
74-
75-
* Ensures that pods cannot run as privileged.
76-
* Ensures that pods cannot mount host directory volumes.
77-
* Requires that a pod run as a user in a pre-allocated range of UIDs.
78-
* Requires that a pod run with a pre-allocated MCS label.
79-
* Allows pods to use any FSGroup.
80-
* Allows pods to use any supplemental group.
81-
82101
[NOTE]
83102
====
84-
For more information about each SCC, see the `kubernetes.io/description`
85-
annotation available on the SCC.
103+
Setting `privileged: true` in the pod specification does not select the `privileged` SCC. Setting `privileged: true` in the pod specification matches on the `allowPrivilegedContainer` field of an SCC.
86104
====
87105

88-
SCCs are composed of settings and strategies that control the security features
106+
|`restricted`
107+
|Denies access to all host features and requires pods to be run with a UID, and SELinux context that are allocated to the namespace. This is the most restrictive SCC and it is used by default for authenticated users.
108+
109+
The `restricted` SCC:
110+
111+
* Ensures that pods cannot run as privileged
112+
* Ensures that pods cannot mount host directory volumes
113+
* Requires that a pod is run as a user in a pre-allocated range of UIDs
114+
* Requires that a pod is run with a pre-allocated MCS label
115+
* Allows pods to use any FSGroup
116+
* Allows pods to use any supplemental group
117+
118+
|===
119+
120+
[id="scc-settings_{context}"]
121+
== Security context constraints settings
122+
123+
Security context constraints (SCCs) are composed of settings and strategies that control the security features
89124
a pod has access to. These settings fall into three categories:
90125

91-
[cols="1,4",options="header"]
126+
[cols="1,3",options="header"]
92127
|===
93128

94129
|Category
@@ -126,42 +161,43 @@ CRI-O has the following default list of capabilities that are allowed for each c
126161
The containers use the capabilities from this default list, but pod manifest authors can alter it by requesting additional capabilities or removing some of the default behaviors. Use the `allowedCapabilities`, `defaultAddCapabilities`, and `requiredDropCapabilities` parameters to control such requests from the pods and to dictate which capabilities can be requested, which ones must be added to each container, and which ones must be forbidden.
127162

128163
[id="authorization-SCC-strategies_{context}"]
129-
== SCC Strategies
164+
== Security context constraints strategies
130165

131166
.RunAsUser
132167

133-
. `MustRunAs` - Requires a `runAsUser` to be configured. Uses the configured
168+
* `MustRunAs` - Requires a `runAsUser` to be configured. Uses the configured
134169
`runAsUser` as the default. Validates against the configured `runAsUser`.
135-
. `MustRunAsRange` - Requires minimum and maximum values to be defined if not
170+
* `MustRunAsRange` - Requires minimum and maximum values to be defined if not
136171
using pre-allocated values. Uses the minimum as the default. Validates against
137172
the entire allowable range.
138-
. `MustRunAsNonRoot` - Requires that the pod be submitted with a non-zero
173+
* `MustRunAsNonRoot` - Requires that the pod be submitted with a non-zero
139174
`runAsUser` or have the `USER` directive defined in the image. No default
140175
provided.
141-
. `RunAsAny` - No default provided. Allows any `runAsUser` to be specified.
176+
* `RunAsAny` - No default provided. Allows any `runAsUser` to be specified.
142177

143178
.SELinuxContext
144179

145-
. `MustRunAs` - Requires `seLinuxOptions` to be configured if not using
180+
* `MustRunAs` - Requires `seLinuxOptions` to be configured if not using
146181
pre-allocated values. Uses `seLinuxOptions` as the default. Validates against
147182
`seLinuxOptions`.
148-
. `RunAsAny` - No default provided. Allows any `seLinuxOptions` to be
183+
* `RunAsAny` - No default provided. Allows any `seLinuxOptions` to be
149184
specified.
150185

151186
.SupplementalGroups
152187

153-
. `MustRunAs` - Requires at least one range to be specified if not using
188+
* `MustRunAs` - Requires at least one range to be specified if not using
154189
pre-allocated values. Uses the minimum value of the first range as the default.
155190
Validates against all ranges.
156-
. `RunAsAny` - No default provided. Allows any `supplementalGroups` to be
191+
* `RunAsAny` - No default provided. Allows any `supplementalGroups` to be
157192
specified.
158193

159194
.FSGroup
160195

161-
. `MustRunAs` - Requires at least one range to be specified if not using
196+
* `MustRunAs` - Requires at least one range to be specified if not using
162197
pre-allocated values. Uses the minimum value of the first range as the default.
163198
Validates against the first ID in the first range.
164-
. `RunAsAny` - No default provided. Allows any `fsGroup` ID to be specified.
199+
* `RunAsAny` - No default provided. Allows any `fsGroup` ID to be specified.
200+
165201

166202
[id="authorization-controlling-volumes_{context}"]
167203
== Controlling volumes
@@ -170,42 +206,42 @@ The usage of specific volume types can be controlled by setting the `volumes`
170206
field of the SCC. The allowable values of this field correspond to the volume
171207
sources that are defined when creating a volume:
172208

173-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#azurefilevolume[`azureFile`]
174-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#azurediskvolume[`azureDisk`]
175-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#flocker[`flocker`]
176-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#flexvolume[`flexVolume`]
177-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#hostpath[`hostPath`]
209+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#awselasticblockstore[`awsElasticBlockStore`]
210+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#azuredisk[`azureDisk`]
211+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#azurefile[`azureFile`]
212+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#cephfs[`cephFS`]
213+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#cinder[`cinder`]
214+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#configmap[`configMap`]
215+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#downwardapi[`downwardAPI`]
178216
* link:https://kubernetes.io/docs/concepts/storage/volumes/#emptydir[`emptyDir`]
217+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#fc[`fc`]
218+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#flexvolume[`flexVolume`]
219+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#flocker[`flocker`]
179220
* link:https://kubernetes.io/docs/concepts/storage/volumes/#gcepersistentdisk[`gcePersistentDisk`]
180-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#awselasticblockstore[`awsElasticBlockStore`]
181221
* link:https://kubernetes.io/docs/concepts/storage/volumes/#gitrepo[`gitRepo`]
182-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#secret[`secret`]
183-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#nfs[`nfs`]
184-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#iscsi[`iscsi`]
185222
* link:https://kubernetes.io/docs/concepts/storage/volumes/#glusterfs[`glusterfs`]
223+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#hostpath[`hostPath`]
224+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#iscsi[`iscsi`]
225+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#nfs[`nfs`]
186226
* link:https://kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim[`persistentVolumeClaim`]
187-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#rbd[`rbd`]
188-
* `cinder`
189-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#cephfs[`cephFS`]
190-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#downwardapi[`downwardAPI`]
191-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#fc-fibre-channel[`fc`]
192-
* `configMap`
193-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#vspherevolume[`vsphereVolume`]
194-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#quobyte[`quobyte`]
195227
* `photonPersistentDisk`
196-
* link:https://kubernetes.io/docs/concepts/storage/volumes/#projected[`projected`]
197228
* link:https://kubernetes.io/docs/concepts/storage/volumes/#portworxvolume[`portworxVolume`]
229+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#projected[`projected`]
230+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#quobyte[`quobyte`]
231+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#rbd[`rbd`]
198232
* link:https://kubernetes.io/docs/concepts/storage/volumes/#scaleio[`scaleIO`]
233+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#secret[`secret`]
199234
* link:https://kubernetes.io/docs/concepts/storage/volumes/#storageos[`storageos`]
200-
* *** (a special value to allow the use of all volume types)
201-
* `none` (a special value to disallow the use of all volumes types. Exist only for backwards compatibility)
235+
* link:https://kubernetes.io/docs/concepts/storage/volumes/#vspherevolume[`vsphereVolume`]
236+
* *** (A special value to allow the use of all volume types.)
237+
* `none` (A special value to disallow the use of all volumes types. Exists only for backwards compatibility.)
202238

203239
The recommended minimum set of allowed volumes for new SCCs are `configMap`,
204240
`downwardAPI`, `emptyDir`, `persistentVolumeClaim`, `secret`, and `projected`.
205241

206242
[NOTE]
207243
====
208-
The list of allowable volume types is not exhaustive because new types are
244+
This list of allowable volume types is not exhaustive because new types are
209245
added with each release of {product-title}.
210246
====
211247

@@ -219,7 +255,7 @@ value will be removed from `volumes`.
219255

220256

221257
[id="admission_{context}"]
222-
== Admission
258+
== Admission control
223259
_Admission control_ with SCCs allows for control over the creation of resources
224260
based on the capabilities granted to a user.
225261

@@ -249,10 +285,10 @@ just two of the fields that must be validated:
249285

250286
[NOTE]
251287
====
252-
These examples are in the context of a strategy using the preallocated values.
288+
These examples are in the context of a strategy using the pre-allocated values.
253289
====
254290

255-
*A FSGroup SCC strategy of `MustRunAs`*
291+
*An FSGroup SCC strategy of `MustRunAs`*
256292

257293
If the pod defines a `fsGroup` ID, then that ID must equal the default
258294
`fsGroup` ID. Otherwise, the pod is not validated by that SCC and the next SCC
@@ -278,9 +314,9 @@ validation, other SCC settings will reject other pod fields and thus cause the
278314
pod to fail.
279315

280316
[id="scc-prioritization_{context}"]
281-
== SCC prioritization
317+
== Security context constraints prioritization
282318

283-
SCCs have a priority field that affects the ordering when attempting to
319+
Security context constraints (SCCs) have a priority field that affects the ordering when attempting to
284320
validate a request by the admission controller. A higher priority
285321
SCC is moved to the front of the set when sorting. When the complete set
286322
of available SCCs are determined they are ordered by:

modules/security-context-constraints-command-reference.adoc

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,16 @@
33
// * authentication/managing-security-context-constraints.adoc
44

55
[id="security-context-constraints-command-reference_{context}"]
6-
= Security context constraints reference commands
6+
= Reference of security context constraints commands
77

8-
You can manage SCCs in your instance as normal API objects using the CLI.
8+
You can manage security context constraints (SCCs) in your instance as normal API objects using the OpenShift CLI (`oc`).
99

1010
ifdef::openshift-enterprise,openshift-webscale,openshift-origin[]
1111
[NOTE]
1212
====
1313
You must have `cluster-admin` privileges to manage SCCs.
1414
====
1515

16-
[IMPORTANT]
17-
====
18-
Do not modify the default SCCs. Customizing the default SCCs can lead to issues when some of the platform pods deploy or {product-title} is upgraded. During upgrades between some versions of {product-title}, the values of the default SCCs are reset to the default values, which discards all customizations to those SCCs.
19-
====
2016
endif::openshift-enterprise,openshift-webscale,openshift-origin[]
2117

2218
ifdef::openshift-dedicated[]
@@ -26,7 +22,7 @@ endif::openshift-dedicated[]
2622

2723

2824
[id="listing-security-context-constraints_{context}"]
29-
== Listing SCCs
25+
== Listing security context constraints
3026

3127
To get a current list of SCCs:
3228

@@ -50,7 +46,7 @@ restricted false [] MustRunAs MustRunAsRange MustRunAs Run
5046
----
5147

5248
[id="examining-a-security-context-constraints-object_{context}"]
53-
== Examining an SCC
49+
== Examining security context constraints
5450

5551
You can view information about a particular SCC, including which users, service accounts, and groups the SCC is applied to.
5652

@@ -107,7 +103,7 @@ the default SCCs.
107103
====
108104

109105
[id="deleting-security-context-constraints_{context}"]
110-
== Deleting an SCC
106+
== Deleting security context constraints
111107

112108
To delete an SCC:
113109

@@ -123,7 +119,7 @@ If you delete a default SCC, it will regenerate when you restart the cluster.
123119

124120
[id="updating-security-context-constraints_{context}"]
125121

126-
== Updating an SCC
122+
== Updating security context constraints
127123

128124
To update an existing SCC:
129125

0 commit comments

Comments
 (0)