TMAegis
Thêm quy tắc cho docker

TMA-DOCKER-3.11

Ensure that Docker server certificate file ownership is set to root:root

CaoCấp 1Tự độngdocker

Mô tả

The Docker server certificate file must be owned by root:root so that it cannot be replaced by unprivileged users. The path is taken from --tlscert on the dockerd command line or "tlscert" in /etc/docker/daemon.json (default /root/.docker/cert.pem); compliant when no such file exists (TLS not configured).

Cách kiểm tra

Phương pháp kiểm tra: Lệnh shell

shell
args=$(ps -eo args 2>/dev/null) || exit 1; s=$(printf '%s\n' "$args" | grep '[d]ockerd'; cat /etc/docker/daemon.json 2>/dev/null); p=$(printf '%s\n' "$s" | sed -n -e 's/.*--tlscert[= ]\([^ ]*\).*/\1/p' -e 's/.*"tlscert"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1); [ -n "$p" ] || p=/root/.docker/cert.pem; [ -e "$p" ] || { echo compliant; exit 0; }; o=$(stat -Lc '%U:%G' "$p") || exit 1; [ "$o" = root:root ] && echo compliant || echo "$p $o"
Đầu ra mong đợi
compliant

Cách khắc phục

Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng

chown root:root <path of the tlscert file> (as configured for dockerd).

Thuộc tính

Hệ điều hành
Bất kỳ
Thẻ
dockerpermissionstls
Tham chiếu
CIS Docker Benchmark v1.9.0 - 3.11 Ensure that Docker server certificate file ownership is set to root:root

Kiểm tra máy này

Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.

shell
tmaegis scan --target docker