Rule ID
SV-258895r933746_rule
Version
V1R1
CCIs
CCI-000366
If a public host key file is modified by an unauthorized user, the SSH service may be compromised.
At the command line, run the following command: # stat -c "%n permissions are %a and owned by %U:%G" /etc/ssh/*key.pub Example result: /etc/ssh/ssh_host_dsa_key.pub permissions are 644 and owned by root:root /etc/ssh/ssh_host_ecdsa_key.pub permissions are 644 and owned by root:root /etc/ssh/ssh_host_ed25519_key.pub permissions are 644 and owned by root:root /etc/ssh/ssh_host_rsa_key.pub permissions are 644 and owned by root:root If any "key.pub" file listed is not owned by root or not group owned by root or does not have permissions of "0644", this is a finding.
At the command line, run the following commands for each returned file: # chmod 644 <file> # chown root:root <file> # systemctl restart sshd.service