Docker
TMA-DOCKER-5.7
Ensure sshd is not run within containers
OrtaDüzey 1Otomatikdocker
Açıklama
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.
Nasıl denetlenir
Denetim yöntemi: Kabuk komutu
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"- Beklenen çıktı
compliant
Nasıl düzeltilir
Düzeltme yöntemi: Kılavuz veya altyapı yaması
Remove the SSH server from the image and use docker exec (or an orchestrator equivalent) for administrative access.
Özellikler
- İşletim sistemleri
- Herhangi biri
- Etiketler
- dockerruntime
- Referans
- CIS Docker Benchmark v1.9.0 - 5.7 Ensure sshd is not run within containers
Bu ana makineyi denetle
Bunu denetleme izniniz olan bir makinede çalıştırın. Tarama salt okunurdur.
shell
tmaegis scan --target docker