Skip to content

Commit 32bba0f

Browse files
committed
PSP readOnly hostPath
1 parent 7549d77 commit 32bba0f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -413,20 +413,28 @@ minimum value of the first range as the default. Validates against all ranges.
413413
to be used by hostPath volumes. An empty list means there is no restriction on
414414
host paths used. This is defined as a list of objects with a single `pathPrefix`
415415
field, which allows hostPath volumes to mount a path that begins with an
416-
allowed prefix. For example:
416+
allowed prefix, and a `readOnly` field indicating it must be mounted read-only.
417+
For example:
417418

418419
```yaml
419420
allowedHostPaths:
420421
# This allows "/foo", "/foo/", "/foo/bar" etc., but
421422
# disallows "/fool", "/etc/foo" etc.
422423
# "/foo/../" is never valid.
423424
- pathPrefix: "/foo"
425+
readOnly: true # only allow read-only mounts
424426
```
425427

426428
_Note: There are many ways a container with unrestricted access to the host
427429
filesystem can escalate privileges, including reading data from other
428430
containers, and abusing the credentials of system services, such as Kubelet._
429431

432+
{{< warning >}}**WARNING:** writeable hostPath directory volumes allow containers to write
433+
to the filesystem in ways that let them traverse the host filesystem outside the `pathPrefix`.
434+
`readOnly: true`, available in Kubernetes 1.11+, must be used on **all** `allowedHostPaths`
435+
to effectively limit access to the specified `pathPrefix`.
436+
{{< /warning >}}
437+
430438
**ReadOnlyRootFilesystem** - Requires that containers must run with a read-only
431439
root filesystem (i.e. no writable layer).
432440

0 commit comments

Comments
 (0)