DLPX-86528 CIS: journald configuration #496
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
1. ForwardToSyslog
Default: yes
By default, only forwarding to syslog and wall is enabled
Other Options:
yes: (default) Forwards logs to a syslog service like rsyslog or syslog-ng if it's running.
no: Logs are not forwarded to syslog and remain only within journals.
2. Compress
Default: yes
By default, journald compresses older log files to save disk space.
Other Options:
yes: (default) Enables compression of rotated journal files.
no: Disables compression, keeping logs uncompressed, which may use more disk space.
3. Storage
Default: auto
The default auto setting makes journald decide between volatile (in-memory) or persistent (on-disk) storage based on system configuration.
If /var/log/journal/ exists, logs are stored persistently on disk.
If /var/log/journal/ does not exist, logs are stored in memory (volatile) and will be lost on reboot.
Other Options:
persistent: Forces logs to be stored on disk in /var/log/journal/. If the directory does not exist, it will attempt to create it.
volatile: Stores logs only in memory (/run/log/journal/), which are lost on reboot.
none: Disables all log storage; logs will only be available while they remain in the journal buffer.
auto: (default) Automatically uses persistent storage if /var/log/journal/ exists, otherwise falls back to volatile storage.
Solution
/etc/systemd/journald.conf
as the CIS benchmark test expects. We place configuration fragments (overrides) in/lib/systemd/journald.conf.d/override.conf
. In fact, the Storage attribute is already set to persistent in there (see override.conf ), so add ForwardToSyslog and Compress there.NOTE
There is a bug in the CIS test that we use, which causes it to fail even though we set these configurations in
/lib/systemd/journald.conf.d/override.conf.
The test fails because the configurations are not present in/etc/systemd/journald.conf
. As long as our configuration aligns with the CIS specifications, we are fine. If necessary, we can always work with CIS or Qualys to get their tests fixed.Testing
Manual
/lib/systemd/journald.conf.d/override.conf
/lib/systemd/journald.conf.d/override.conf
- It has all 3 params as expected.Cons of this change