Skip to content

Verify User Who Owns /etc/chrony.keys File

An XCCDF Rule

Description

To properly set the owner of /etc/chrony.keys, run the command:

$ sudo chown root /etc/chrony.keys 

Rationale

The ownership of the /etc/chrony.keys file by the root user 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 cryptographic keys.

ID
xccdf_org.ssgproject.content_rule_file_owner_etc_chrony_keys
Severity
Medium
References
Updated



Remediation - Ansible

- 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:

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then

chown -L 0 /etc/chrony.keys

else