Ensure logrotate is Installed
An XCCDF Rule
Description
logrotate is installed by default. Thelogrotate
package can be installed with the following command: $ apt-get install logrotate
Rationale
The logrotate package provides the logrotate services.
- ID
- xccdf_org.ssgproject.content_rule_package_logrotate_installed
- Severity
- Medium
- References
- Updated
Remediation Templates
OS Build Blueprint
[[packages]]
name = "logrotate"
version = "*"
A Puppet Snippet
include install_logrotate
class install_logrotate {
package { 'logrotate':
ensure => 'installed',
}
}
An Ansible Snippet
- name: Ensure logrotate is installed
package:
name: logrotate
state: present
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
DEBIAN_FRONTEND=noninteractive apt-get install -y "logrotate"
else
>&2 echo 'Remediation is not applicable, nothing was done'
fi