Skip to content

Commit fbc85a7

Browse files
liggittMisty Stanley-Jones
authored and
Misty Stanley-Jones
committed
PSP readOnly hostPath (#8898)
1 parent 06c00e7 commit fbc85a7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

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

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

427-
_Note: There are many ways a container with unrestricted access to the host
429+
{{< warning >}}**Warning:** There are many ways a container with unrestricted access to the host
428430
filesystem can escalate privileges, including reading data from other
429-
containers, and abusing the credentials of system services, such as Kubelet._
431+
containers, and abusing the credentials of system services, such as Kubelet.
432+
433+
Writeable hostPath directory volumes allow containers to write
434+
to the filesystem in ways that let them traverse the host filesystem outside the `pathPrefix`.
435+
`readOnly: true`, available in Kubernetes 1.11+, must be used on **all** `allowedHostPaths`
436+
to effectively limit access to the specified `pathPrefix`.
437+
{{< /warning >}}
430438

431439
**ReadOnlyRootFilesystem** - Requires that containers must run with a read-only
432440
root filesystem (i.e. no writable layer).

0 commit comments

Comments
 (0)