Skip to content

DLPX-86528 CIS: journald configuration #496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

dbshah12
Copy link
Contributor

@dbshah12 dbshah12 commented Sep 23, 2024

Problem

  • Below 3 journald configuration must be set:

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

  • Delphix does not place journald configuration directly in /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

  • Tested the below thing from ab-pre-push image with this change:
    • Created new engine and verified all 3 params in /lib/systemd/journald.conf.d/override.conf
    • Cloned v26 DE and upgraded to latest one and then checked /lib/systemd/journald.conf.d/override.conf - It has all 3 params as expected.

Cons of this change

  • Storage is already persistent so no effect because of that.
  • Compress is also the same as default so no effect because of that, we just meet the CIS benchmark.
  • ForwardToSyslog is also the same as default so there is no effect because of that, we just meet the CIS benchmark.

@dbshah12 dbshah12 force-pushed the dlpx/pr/dbshah12/a88adb21-433f-4f61-80d3-04d415db0f18 branch from f2f7762 to 5f589ff Compare September 23, 2024 14:05
@dbshah12 dbshah12 merged commit 9e78010 into develop Sep 24, 2024
15 checks passed
@dbshah12 dbshah12 deleted the dlpx/pr/dbshah12/a88adb21-433f-4f61-80d3-04d415db0f18 branch September 24, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants