Docker
TMA-DOCKER-5.7
Ensure sshd is not run within containers
Trung bìnhCấp 1Tự độngdocker
Mô tả
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.
Cách kiểm tra
Phương pháp kiểm tra: Lệnh shell
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"- Đầ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
Remove the SSH server from the image and use docker exec (or an orchestrator equivalent) for administrative access.
Thuộc tính
- Hệ điều hành
- Bất kỳ
- Thẻ
- dockerruntime
- Tham chiếu
- CIS Docker Benchmark v1.9.0 - 5.7 Ensure sshd is not run within containers
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