Verify Permissions on SSH Server Public *.pub Key Files
An XCCDF Rule
Description
To properly set the permissions of /etc/ssh/*.pub
, run the command:
$ sudo chmod 0644 /etc/ssh/*.pub
Rationale
If a public host key file is modified by an unauthorized user, the SSH service may be compromised.
- ID
- xccdf_org.ssgproject.content_rule_file_permissions_sshd_pub_key
- Severity
- Medium
- References
- Updated
Remediation - Shell Script
# Remediation is applicable only in certain platforms
if rpm --quiet -q kernel-default; then
find -L /etc/ssh/ -maxdepth 1 -perm /u+xs,g+xws,o+xwt -type f -regextype posix-extended -regex '^.*\.pub$' -exec chmod u-xs,g-xws,o-xwt {} \;
else
Remediation - Puppet
include ssh_public_key_perms
class ssh_public_key_perms {
exec { 'sshd_pub_key':
command => "chmod 0644 /etc/ssh/*.pub",
path => '/bin:/usr/bin'
Remediation - Ansible
- name: Gather the package facts
package_facts:
manager: auto
tags:
- CCE-85643-5
- DISA-STIG-SLES-15-040240