5.6 Ensure ssh is not run within containers

Information

SSH server should not be running within the container. You should SSH into the Docker host, and use nsenter tool to enter a container from a remote host.
Rationale:
Running SSH within the container increases the complexity of security management by making it
Difficult to manage access policies and security compliance for SSH server
Difficult to manage keys and passwords across various containers
Difficult to manage security upgrades for SSH server
It is possible to have shell access to a container without using SSH, the needlessly increasing the complexity of security management should be avoided.

Solution

Uninstall SSH server from the container and use nsenteror any other commands such as docker exec or docker attach to interact with the container instance.
docker exec --interactive --tty $INSTANCE_ID sh
OR
docker attach $INSTANCE_ID
Impact:
None.
Default Value:
By default, SSH server is not running inside the container. Only one process per container is allowed.

See Also

https://workbench.cisecurity.org/files/1726

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-7b., CSCv6|9.1

Plugin: Unix

Control ID: 2a1bffaf2cbba30e8e24cd49443b0e32e5abed6fae078b32a9faea0f21c78eb0