Docker
TMA-DOCKER-5.7
Ensure sshd is not run within containers
中レベル 1自動docker
説明
Running an SSH server inside a container adds attack surface and complicates credential and patch management; use docker exec instead. The audit lists processes of every running container with docker top (no exec into the container) and flags those running sshd.
チェック方法
監査方法: シェルコマンド
shell
ids=$(docker ps -q) || exit 1; bad=''; for i in $ids; do p=$(docker top "$i" -eo comm 2>/dev/null || docker top "$i") || exit 1; printf '%s\n' "$p" | grep -Eq '(^|[ /])sshd( |$)' && bad="$bad $i"; done; [ -z "$bad" ] && echo compliant || echo "sshd running in:$bad"- 期待される出力
compliant
修正方法
修正方法: ガイダンスまたは IaC パッチ
Remove the SSH server from the image and use docker exec (or an orchestrator equivalent) for administrative access.
プロパティ
- オペレーティングシステム
- すべて
- タグ
- dockerruntime
- 参照
- CIS Docker Benchmark v1.9.0 - 5.7 Ensure sshd is not run within containers
このホストをチェック
監査が許可されているマシンで実行してください。スキャンは読み取り専用です。
shell
tmaegis scan --target docker