mediumloggingverified ✓
Ensure systemd journal files and directories are not more permissive than 0640
journal-file-permissions · UBUNTU ≥ 24 · 1 impl
Description
All directories and files under /run/log/journal and /var/log/journal must have permissions no more permissive than 0640.
Rationale
The systemd journal can contain security-relevant and sensitive event data. Restricting journal file and directory permissions prevents unauthorized users from reading the audit and system event history.
Check → Remediate
Checkcommand
# Fail if any journal dir/file carries permission bits beyond 0640
# (rw-r-----). The low three octal digits are tested; the setgid/sticky
# bit is ignored for the permissiveness comparison.
bad=$(find /run/log/journal /var/log/journal \( -type d -o -type f \) 2>/dev/null | while IFS= read -r p; do
m=$(stat -c '%a' "$p" 2>/dev/null)
perm=$(printf '%s' "$m" | tail -c 3)
if [ $(( 0$perm & ~0640 & 0777 )) -ne 0 ]; then printf '%s %s\n' "$p" "$m"; fi
done)
[ -z "$bad" ] || { echo "FAIL: journal paths more permissive than 0640:"; printf '%s\n' "$bad"; exit 1; }
echo "OK: journal files/dirs are 0640 or less permissive"; exit 0
- expected_exit:
- 0
Remediatemanual
- note:
- Tighten permissions to 0640 via a /etc/tmpfiles.d drop-in for /run/log/journal and /var/log/journal (and their contents), then run systemd-tmpfiles --create.
Framework references
STIG
V-270757 / UBTU-24-700020
NIST 800-53
SI-11
Live verification
ubuntu24:check
#journald#log-permissions#stig