Skip to content

Install the cron service

An XCCDF Rule

Description

The Cron service should be installed.

Rationale

The cron service allow periodic job execution, needed for almost all administrative tasks and services (software update, log rotating, etc.). Access to cron service should be restricted to administrative accounts only.

ID
xccdf_org.ssgproject.content_rule_package_cron_installed
Severity
Medium
References
Updated



Remediation - Ansible

- name: Ensure cron is installed
  package:
    name: cron
    state: present
  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

if ! rpm -q --quiet "cron" ; then
    yum install -y "cron"
fi

Remediation - Anaconda Pre-Install Instructions


package --add=cron

Remediation - OS Build Blueprint


[[packages]]
name = "cron"
version = "*"

Remediation - Puppet

include install_cron

class install_cron {
  package { 'cron':
    ensure => 'installed',
  }