Skip to content
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

CIS-CAT-PRO audit finding 4.2.2.3 #279

Closed
bbaassssiiee opened this issue Apr 17, 2023 · 3 comments
Closed

CIS-CAT-PRO audit finding 4.2.2.3 #279

bbaassssiiee opened this issue Apr 17, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@bbaassssiiee
Copy link
Member

bbaassssiiee commented Apr 17, 2023

Describe the Issue

Description:

The journald system includes the capability of compressing overly large files to avoid filling up the system with logs or making the logs unmanageably large.

Uncompressed large files may unexpectedly fill a filesystem leading to resource unavailability. Compressing logs prior to write can prevent sudden, unexpected filesystem impacts.

Edit the /etc/systemd/journald.conf file and add the following line:

Compress=yes 

Expected Behavior
Explicitly defined. No quotes around yes, not commented.

Actual Behavior
The line is still commented and shouldn't be.

Control(s) Affected
What controls are being affected by the issue: CIS 4.2.2.3

Environment (please complete the following information):

  • Ansible Version: [core 2.11.12]
  • Host Python Version: [Python 3.6.8]
  • Ansible Server Python Version: [Python 3.6.8]
  • Using branch: [release 2.2.1]
  • Additional Details:

Additional Notes
CIS-CAT_PRO is the official audit tool for CIS members.

Possible Solution
Enter a suggested fix here

- name: Insert correct line to /etc/systemd/journald.conf
  ansible.builtin.lineinfile:
    path: /etc/systemd/journald.conf
    create: true
    regexp: 'Compress='
    line: Compress=yes
    state: present
    insertafter: ^#Compress
    validate: /usr/bin/bash -n %s
@bbaassssiiee bbaassssiiee added the bug Something isn't working label Apr 17, 2023
@bbaassssiiee
Copy link
Member Author

- name: "4.2.2.3 | PATCH | Ensure journald is configured to compress large log files"

@bbaassssiiee
Copy link
Member Author

Contents of /etc/systemd/journald.conf after applying RHEL8-CIS on AlmaLinux 8.7:

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See journald.conf(5) for details.

[Journal]
#Storage=auto
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=10000
#SystemMaxUse=
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
#MaxRetentionSec=
#MaxFileSec=1month
ForwardToSyslog=yes
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#LineMax=48K

bbaassssiiee added a commit to TeamSalvador/RHEL8-CIS that referenced this issue Apr 17, 2023
@bbaassssiiee
Copy link
Member Author

The line is commented and shouldn't:

#Compress=yes

bbaassssiiee added a commit to TeamSalvador/RHEL8-CIS that referenced this issue Apr 17, 2023
Signed-off-by: Bas Meijer <bas.meijer@enexis.nl>
uk-bolly added a commit that referenced this issue Apr 25, 2023
@uk-bolly uk-bolly self-assigned this Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants