Ensure Users Cannot Change GNOME3 Screensaver Settings

Classification:

compliance

Framework:

Control:

Description

If not already configured, ensure that users cannot change GNOME3 screensaver lock settings by adding /org/gnome/desktop/screensaver/lock-delay to /etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. For example:

/org/gnome/desktop/screensaver/lock-delay

After the settings have been set, run dconf update.

Rationale

A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not logout because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, GNOME desktops can be configured to identify when a user’s session has idled and take action to initiate the session lock. As such, users should not be allowed to change session settings.

Remediation

Shell script

The following script can be run on the host to remediate the issue.

# Remediation is applicable only in certain platforms
if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then

# Check for setting in any of the DConf db directories
LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-delay$" "/etc/dconf/db/" \
 | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1)
LOCKSFOLDER="/etc/dconf/db/local.d/locks"

mkdir -p "${LOCKSFOLDER}"

# Comment out the configurations in databases different from the target one
if [[ ! -z "${LOCKFILES}" ]]
then
 sed -i -E "s|^/org/gnome/desktop/screensaver/lock-delay$|#&|" "${LOCKFILES[@]}"
fi

if ! grep -qr "^/org/gnome/desktop/screensaver/lock-delay$" /etc/dconf/db/local.d/
then
 echo "/org/gnome/desktop/screensaver/lock-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
fi

dconf update

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

Ansible playbook

The following playbook can be run with Ansible to remediate the issue.

- name: Gather the package facts
 package\_facts:
 manager: auto
 tags:
 - CCE-87491-7
 - NIST-800-171-3.1.10
 - NIST-800-53-CM-6(a)
 - dconf\_gnome\_screensaver\_user\_locks
 - low\_complexity
 - medium\_disruption
 - medium\_severity
 - no\_reboot\_needed
 - unknown\_strategy

- name: Prevent user modification of GNOME lock-delay
 lineinfile:
 path: /etc/dconf/db/local.d/locks/00-security-settings-lock
 regexp: ^/org/gnome/desktop/screensaver/lock-delay$
 line: /org/gnome/desktop/screensaver/lock-delay
 create: true
 when:
 - '"gdm" in ansible\_facts.packages'
 - ansible\_virtualization\_type not in ["docker", "lxc", "openvz", "podman", "container"]
 tags:
 - CCE-87491-7
 - NIST-800-171-3.1.10
 - NIST-800-53-CM-6(a)
 - dconf\_gnome\_screensaver\_user\_locks
 - low\_complexity
 - medium\_disruption
 - medium\_severity
 - no\_reboot\_needed
 - unknown\_strategy

- name: Dconf Update
 command: dconf update
 when:
 - '"gdm" in ansible\_facts.packages'
 - ansible\_virtualization\_type not in ["docker", "lxc", "openvz", "podman", "container"]
 tags:
 - CCE-87491-7
 - NIST-800-171-3.1.10
 - NIST-800-53-CM-6(a)
 - dconf\_gnome\_screensaver\_user\_locks
 - low\_complexity
 - medium\_disruption
 - medium\_severity
 - no\_reboot\_needed
 - unknown\_strategy