DKER-EE-002030 - All Docker Enterprise containers root filesystem must be mounted as read only.

Warning! Audit Deprecated

This audit has been deprecated and will be removed in a future update.

View Next Audit Version

Information

The container's root filesystem should be treated as a 'golden image' by using Docker run's --read-only option. This prevents any writes to the container's root filesystem at container runtime and enforces the principle of immutable infrastructure.

Enabling this option forces containers at runtime to explicitly define their data writing strategy to persist or not persist their data. This also reduces security attack vectors since the container instance's filesystem cannot be tampered with or written to unless it has explicit read-write permissions on its filesystem folder and directories.

Enabling --read-only at container runtime may break some container OS packages if a data writing strategy is not defined. Define what the container's data should and should not persist at runtime to determine which recommendation procedure to utilize.

Example:

- Enable use --tmpfs for temporary file writes to /tmp
- Use Docker shared data volumes for persistent data writes

By default, a container will have its root filesystem writable allowing all container processes to write files owned by the container's runtime user.

Solution

Add a --read-only flag at a container's runtime to enforce the container's root filesystem to be mounted as read only.

docker run <Run arguments> --read-only <Container Image Name or ID> <Command>

Enabling the --read-only option at a container's runtime should be used by administrators to force a container's executable processes to only write container data to explicit storage locations during the container's runtime.

Examples of explicit storage locations during a container's runtime include, but are not limited to:

1. Use the --tmpfs option to mount a temporary file system for non-persistent data writes.

Example:
docker run --interactive --tty --read-only --tmpfs '/run' --tmpfs '/tmp' [image] [command]

2. Enabling Docker rw mounts at a container's runtime to persist container data directly on the Docker host filesystem.

Example:
docker run --interactive --tty --read-only -v /opt/app/data:/run/app/data:rw [image] [command]

3. Utilizing Docker shared-storage volume plugins for Docker data volume to persist container data.

docker volume create -d convoy --opt o=size=20GB my-named-volume

docker run --interactive --tty --read-only -v my-named-volume:/run/app/data [image] [command]

See Also

https://dl.dod.cyber.mil/wp-content/uploads/stigs/zip/U_Docker_Enterprise_2-x_Linux-UNIX_V2R1_STIG.zip

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-7, CAT|I, CCI|CCI-000381, Rule-ID|SV-235808r627551_rule, STIG-ID|DKER-EE-002030, STIG-Legacy|SV-104789, STIG-Legacy|V-95651, Vuln-ID|V-235808

Plugin: Unix

Control ID: b6ebe8f48930a81bfbab8122eca7bb4d360995eab2a7fffebd8431a21c967fc6