Description
When rsyslog is the chosen logging system, its service must be enabled and running, and the
files it creates must not be readable by other users: the last $FileCreateMode in
/etc/rsyslog.conf and /etc/rsyslog.d/*.conf must be 0640 or stricter.
The choice between the journal alone and rsyslog is left to the administrator: this control does not install rsyslog. CB-UBU-AUDIT-002 aligns the journal forwarding with that choice.
Rationale
rsyslog is what writes /var/log/syslog, /var/log/auth.log and forwards messages to a log
server. When it is stopped, those files and the remote copy stop without any error. A restrictive
creation mode keeps new and rotated log files private to root and the adm group.
Impact
None known. Ubuntu already ships $FileCreateMode 0640 (files owned by syslog:adm).
Applies when
Detected: when: rsyslog is installed A scanner reports the control not applicable when one is false.
Only when rsyslog is installed. Ubuntu Server installs rsyslog by default, which is then the chosen logging system; removing it leaves the systemd journal alone.
Setting
| Location | rsyslog.service, /etc/rsyslog.conf, /etc/rsyslog.d/ |
| Default | Enabled, $FileCreateMode 0640 |
| Recommended | Enabled and active, $FileCreateMode 0640 or stricter |
Audit
- Run
systemctl is-enabled rsyslogandsystemctl is-active rsyslog. They must printenabledandactive. - Run
grep -h '^\s*\$FileCreateMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf | tail -n 1. The mode must be0640or stricter.
Automated: every check must pass. Scanners report each check by its id.
service
rsyslog.service is enabled.
unit: rsyslog.service
state: enabled
active
rsyslog.service is running.
script: |
o=$(systemctl is-active rsyslog 2>/dev/null)
echo "rsyslog: ${o:-unknown}"
[ "$o" = active ]
file-mode
Last $FileCreateMode of the rsyslog configuration.
script: |
m=$(cat /etc/rsyslog.conf /etc/rsyslog.d/*.conf 2>/dev/null | sed -n 's/^[[:space:]]*\$FileCreateMode[[:space:]]\{1,\}\([0-7]\{3,4\}\).*/\1/p' | tail -n 1)
echo "\$FileCreateMode ${m:-unset (rsyslog default 0644)}"
[ -n "$m" ] && [ $((0$m & 0137)) -eq 0 ]
Remediation
- Run
systemctl enable --now rsyslog. - Create
/etc/rsyslog.d/60-cirsec.confwith$FileCreateMode 0640and runsystemctl restart rsyslog.
| Restart | service: rsyslog |
| Disruption | none |
Rollback
Delete /etc/rsyslog.d/60-cirsec.conf and run systemctl restart rsyslog.
service
Generated from check service: the engine writes the fix for every output, it sets the expected value and the check runs again after.
file-mode
f=/etc/rsyslog.d/60-cirsec.conf
cb_backup "$f"
printf '%s\n' '# Written by CIRSEC Baselines CB-UBU-AUDIT-005' '$FileCreateMode 0640' >"$f"
chmod 644 "$f"
Handwritten code reads parameters from CB_<NAME> environment variables. Each release turns these fixes into remediate.sh and an Ansible role per profile: dry run by default, a fix runs only when its check fails.
References
- rsyslog.conf(5), Ubuntu manual pages Canonical, vendor-doc, accessed 2026-10-19
- ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R71) ANSSI, guide, accessed 2026-10-19
Mappings
| Framework | ID | Relation | Note |
|---|---|---|---|
| ANSSI-BP-028 - Recommandations de configuration d'un système GNU/Linux2.0 | R71 | partial | |
| NIST SP 800-53 Rev. 55.1.1 | AU-9 | related |
How this control relates to the other framework's: equivalent, stricter, looser, partial or related.
Threats mitigated
Related controls
- related
CB-UBU-AUDIT-002Forward the journal to rsyslog only when rsyslog is the chosen logger
People and lifecycle
| Authors |
|
| Verified | 2026-10-19 by Sn0wAlice on 20.04, Proxmox VM, Ubuntu 20.04 cloud image, kernel 5.4.0-216-generic. Passes on stock image (rsyslog active, $FileCreateMode 0640); kept after remediation and reboot. |
| Verified | 2026-10-19 by Sn0wAlice on 22.04, Proxmox VM, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic. Passes on stock image (rsyslog active, $FileCreateMode 0640); kept after remediation and reboot. |
| Verified | 2026-10-19 by Sn0wAlice on 24.04, Proxmox VM, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic. Passes on stock image (rsyslog active, $FileCreateMode 0640); kept after remediation and reboot. |
| Verified | 2026-10-19 by Sn0wAlice on 26.04, Proxmox VM, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic. Passes on stock image (rsyslog active, $FileCreateMode 0640); kept after remediation and reboot. |
| Introduced in | v0.1.0 |
| Created, updated | 2026-10-19, 2026-10-19 |
| Translations | fr |