Skip to content

Verify Group Who Owns /etc/chrony.keys File

An XCCDF Rule

Description

To properly set the group owner of /etc/chrony.keys, run the command:
$ sudo chgrp root /etc/chrony.keys

Rationale

The ownership of the /etc/chrony.keys file by the root group is important because this file hosts chrony cryptographic keys. Protection of this file is critical for system security. Assigning the ownership to root ensures exclusive control of the chrony cryptography keys.

ID
xccdf_org.ssgproject.content_rule_file_groupowner_etc_chrony_keys
Severity
Medium
References
Updated

Remediation Templates

An Ansible Snippet

- name: Test for existence /etc/chrony.keys
  stat:
    path: /etc/chrony.keys
  register: file_exists
  when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
  tags:

A Shell Script

# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
chgrp -L root /etc/chrony.keys

else
    >&2 echo 'Remediation is not applicable, nothing was done'
fi