Skip to content

Commit 2bd62e6

Browse files
jessfrazsteveperry-53
authored andcommitted
add docs for AllowPrivilegeEscalation (#5448)
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
1 parent c3947d5 commit 2bd62e6

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

docs/concepts/policy/pod-security-policy.md

+33-17
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,24 @@ actions that a pod can perform and what it has the ability to access. The
2121
run with in order to be accepted into the system. They allow an
2222
administrator to control the following:
2323

24-
| Control Aspect | Field Name |
25-
| ------------------------------------------------------------- | --------------------------------- |
26-
| Running of privileged containers | `privileged` |
27-
| Default set of capabilities that will be added to a container | `defaultAddCapabilities` |
28-
| Capabilities that will be dropped from a container | `requiredDropCapabilities` |
29-
| Capabilities a container can request to be added | `allowedCapabilities` |
30-
| Controlling the usage of volume types | [`volumes`](#controlling-volumes) |
31-
| The use of host networking | [`hostNetwork`](#host-network) |
32-
| The use of host ports | `hostPorts` |
33-
| The use of host's PID namespace | `hostPID` |
34-
| The use of host's IPC namespace | `hostIPC` |
35-
| The SELinux context of the container | [`seLinux`](#selinux) |
36-
| The user ID | [`runAsUser`](#runasuser) |
37-
| Configuring allowable supplemental groups | [`supplementalGroups`](#supplementalgroups) |
38-
| Allocating an FSGroup that owns the pod's volumes | [`fsGroup`](#fsgroup) |
39-
| Requiring the use of a read only root file system | `readOnlyRootFilesystem` |
24+
| Control Aspect | Field Name |
25+
| ---------------------------------------------------------------------- | ------------------------------------------- |
26+
| Running of privileged containers | `privileged` |
27+
| Default set of capabilities that will be added to a container | `defaultAddCapabilities` |
28+
| Capabilities that will be dropped from a container | `requiredDropCapabilities` |
29+
| Capabilities a container can request to be added | `allowedCapabilities` |
30+
| Controlling the usage of volume types | [`volumes`](#controlling-volumes) |
31+
| The use of host networking | [`hostNetwork`](#host-network) |
32+
| The use of host ports | `hostPorts` |
33+
| The use of host's PID namespace | `hostPID` |
34+
| The use of host's IPC namespace | `hostIPC` |
35+
| The SELinux context of the container | [`seLinux`](#selinux) |
36+
| The user ID | [`runAsUser`](#runasuser) |
37+
| Configuring allowable supplemental groups | [`supplementalGroups`](#supplementalgroups) |
38+
| Allocating an FSGroup that owns the pod's volumes | [`fsGroup`](#fsgroup) |
39+
| Requiring the use of a read only root file system | `readOnlyRootFilesystem` |
40+
| Running of a container that allow privilege escalation from its parent | [`allowPrivilegeEscalation`](#allowPrivilegeEscalation) |
41+
| Control whether a process can gain more privileges than its parent process | [`defaultAllowPrivilegeEscalation`](#defaultAllowPrivilegeEscalation) |
4042

4143
_Pod Security Policies_ are comprised of settings and strategies that
4244
control the security features a pod has access to. These settings fall
@@ -124,7 +126,21 @@ configMap, downwardAPI, emptyDir, persistentVolumeClaim, secret, and projected.
124126

125127
### Host Network
126128
- *HostPorts*, default `empty`. List of `HostPortRange`, defined by `min`(inclusive) and `max`(inclusive), which define the allowed host ports.
127-
129+
130+
### AllowPrivilegeEscalation
131+
132+
Gates whether or not a user is allowed to set the security context of a container
133+
to `allowPrivilegeEscalation=true`. This field defaults to `false`.
134+
135+
### DefaultAllowPrivilegeEscalation
136+
137+
Sets the default for the security context `AllowPrivilegeEscalation` of a container.
138+
This bool directly controls whether the `no_new_privs` flag gets set on the
139+
container process. It defaults to `nil`. The default behavior of `nil`
140+
allows privilege escalation so as to not break setuid binaries. Setting it to `false`
141+
ensures that no child process of a container can gain more privileges than
142+
its parent.
143+
128144
## Admission
129145

130146
_Admission control_ with `PodSecurityPolicy` allows for control over the
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: Pod
33
metadata:
4-
name: security-context-demo-2
4+
name: security-context-demo-2
55
spec:
66
securityContext:
77
runAsUser: 1000
@@ -10,3 +10,4 @@ spec:
1010
image: gcr.io/google-samples/node-hello:1.0
1111
securityContext:
1212
runAsUser: 2000
13+
allowPrivilegeEscalation: false

docs/tasks/configure-pod-container/security-context.md

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ a Pod or Container. Security context settings include:
2424

2525
* [Seccomp](https://en.wikipedia.org/wiki/Seccomp): Limit a process's access to open file descriptors.
2626

27+
* AllowPrivilegeEscalation: Controls whether a process can gain more privileges than its parent process. This bool directly controls whether the [`no_new_privs`](https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt) flag gets set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged OR 2) has `CAP_SYS_ADMIN`.
28+
2729
For more information about security mechanisms in Linux, see
2830
[Overview of Linux Kernel Security Features](https://www.linux.com/learn/overview-linux-kernel-security-features)
2931

@@ -345,6 +347,8 @@ label given to all Containers in the Pod as well as the Volumes.
345347
* [Security Contexts design document](https://git.k8s.io/community/contributors/design-proposals/security_context.md)
346348
* [Ownership Management design document](https://git.k8s.io/community/contributors/design-proposals/volume-ownership-management.md)
347349
* [Pod Security Policies](/docs/concepts/policy/pod-security-policy/)
350+
* [AllowPrivilegeEscalation design
351+
document](https://git.k8s.io/community/contributors/design-proposals/auth/no-new-privs.md)
348352

349353

350354
{% endcapture %}

docs/tasks/configure-pod-container/security-context.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: Pod
33
metadata:
4-
name: security-context-demo
4+
name: security-context-demo
55
spec:
66
securityContext:
77
runAsUser: 1000
@@ -15,3 +15,4 @@ spec:
1515
volumeMounts:
1616
- name: sec-ctx-vol
1717
mountPath: /data/demo
18+
allowPrivilegeEscalation: false

0 commit comments

Comments
 (0)