Vulnerability Discussion
Even though the communications channel may be encrypted, an additional layer of security is gained by extending the policy of not logging directly on as root. In addition, logging in with a user-specific account provides individual accountability of actions performed on the system and also helps to minimize direct attack attempts on root's password.
Satisfies: SRG-OS-000109-GPOS-00056, SRG-OS-000480-GPOS-00227
Check
Verify that RHEL 9 remote access using SSH prevents users from logging on directly as "root" with the following command:
$ sudo /usr/sbin/sshd -dd 2>&1 | awk '/filename/ {print $4}' | tr -d '\r' | tr '\n' ' ' | xargs sudo grep -iH '^\s*permitrootlogin'
PermitRootLogin no
If the "PermitRootLogin" keyword is set to "yes", is missing, or is commented out, this is a finding.
Fix
To configure the system to prevent SSH users from logging on directly as root add or modify the following line in "/etc/ssh/sshd_config".
PermitRootLogin no
Restart the SSH daemon for the settings to take effect:
$ sudo systemctl restart sshd.service