Docker
TMA-DOCKER-3.9
Ensure that TLS CA certificate file ownership is set to root:root
高级别 1自动化docker
说明
The TLS CA certificate file must be owned by root:root so that it cannot be replaced by unprivileged users. The path is taken from --tlscacert on the dockerd command line or "tlscacert" in /etc/docker/daemon.json (default /root/.docker/ca.pem); compliant when no such file exists (TLS not configured).
检查方式
审计方法: 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/.*--tlscacert[= ]\([^ ]*\).*/\1/p' -e 's/.*"tlscacert"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1); [ -n "$p" ] || p=/root/.docker/ca.pem; [ -e "$p" ] || { echo compliant; exit 0; }; o=$(stat -Lc '%U:%G' "$p") || exit 1; [ "$o" = root:root ] && echo compliant || echo "$p $o"- 预期输出
compliant
修复方式
修复方法: 操作指南或基础设施补丁
chown root:root <path of the tlscacert file> (as configured for dockerd).
属性
- 操作系统
- 任意
- 标签
- dockerpermissionstls
- 参考
- CIS Docker Benchmark v1.9.0 - 3.9 Ensure that TLS CA certificate file ownership is set to root:root
检查本机
请在您有权审计的机器上运行此命令。扫描为只读操作。
shell
tmaegis scan --target docker