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

Remove quotes from journald config parameters #10790

Merged
merged 1 commit into from
Jul 3, 2023

Conversation

Mackemania
Copy link
Contributor

Description:

  • The quotes may lead to unexpected behaviour such as config not being applied.

Rationale:

  • The default journald config does not use quotes around the parameter values.

The quotes may lead to unexpected behaviour such as config
not being applied.
The default journald config does not use quotes around the
parameter values.
@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Jul 3, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jul 3, 2023

Hi @Mackemania. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@github-actions
Copy link

github-actions bot commented Jul 3, 2023

Start a new ephemeral environment with changes proposed in this pull request:

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@github-actions
Copy link

github-actions bot commented Jul 3, 2023

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
bash remediation for rule 'xccdf_org.ssgproject.content_rule_journald_compress' differs.
--- xccdf_org.ssgproject.content_rule_journald_compress
+++ xccdf_org.ssgproject.content_rule_journald_compress
@@ -16,10 +16,10 @@
 if [ -z "$line_number" ]; then
     # There was no match of '^#\s*Compress', insert at
     # the end of the file.
-    printf '%s\n' "Compress='yes'" >> "/etc/systemd/journald.conf"
+    printf '%s\n' "Compress=yes" >> "/etc/systemd/journald.conf"
 else
     head -n "$(( line_number - 1 ))" "/etc/systemd/journald.conf.bak" > "/etc/systemd/journald.conf"
-    printf '%s\n' "Compress='yes'" >> "/etc/systemd/journald.conf"
+    printf '%s\n' "Compress=yes" >> "/etc/systemd/journald.conf"
     tail -n "+$(( line_number ))" "/etc/systemd/journald.conf.bak" >> "/etc/systemd/journald.conf"
 fi
 # Clean up after ourselves.

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_journald_compress' differs.
--- xccdf_org.ssgproject.content_rule_journald_compress
+++ xccdf_org.ssgproject.content_rule_journald_compress
@@ -1,4 +1,4 @@
-- name: Setting shell-quoted shell-style assignment of 'Compress' to 'yes' in '/etc/systemd/journald.conf'
+- name: Setting unquoted shell-style assignment of 'Compress' to 'yes' in '/etc/systemd/journald.conf'
   block:
 
   - name: Check for duplicate values
@@ -24,7 +24,7 @@
       path: /etc/systemd/journald.conf
       create: true
       regexp: ^\s*Compress=
-      line: Compress="yes"
+      line: Compress=yes
       state: present
       insertbefore: ^# Compress
       validate: /usr/bin/bash -n %s

bash remediation for rule 'xccdf_org.ssgproject.content_rule_journald_forward_to_syslog' differs.
--- xccdf_org.ssgproject.content_rule_journald_forward_to_syslog
+++ xccdf_org.ssgproject.content_rule_journald_forward_to_syslog
@@ -16,10 +16,10 @@
 if [ -z "$line_number" ]; then
     # There was no match of '^#\s*ForwardToSyslog', insert at
     # the end of the file.
-    printf '%s\n' "ForwardToSyslog='yes'" >> "/etc/systemd/journald.conf"
+    printf '%s\n' "ForwardToSyslog=yes" >> "/etc/systemd/journald.conf"
 else
     head -n "$(( line_number - 1 ))" "/etc/systemd/journald.conf.bak" > "/etc/systemd/journald.conf"
-    printf '%s\n' "ForwardToSyslog='yes'" >> "/etc/systemd/journald.conf"
+    printf '%s\n' "ForwardToSyslog=yes" >> "/etc/systemd/journald.conf"
     tail -n "+$(( line_number ))" "/etc/systemd/journald.conf.bak" >> "/etc/systemd/journald.conf"
 fi
 # Clean up after ourselves.

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_journald_forward_to_syslog' differs.
--- xccdf_org.ssgproject.content_rule_journald_forward_to_syslog
+++ xccdf_org.ssgproject.content_rule_journald_forward_to_syslog
@@ -1,5 +1,4 @@
-- name: Setting shell-quoted shell-style assignment of 'ForwardToSyslog' to 'yes'
-    in '/etc/systemd/journald.conf'
+- name: Setting unquoted shell-style assignment of 'ForwardToSyslog' to 'yes' in '/etc/systemd/journald.conf'
   block:
 
   - name: Check for duplicate values
@@ -25,7 +24,7 @@
       path: /etc/systemd/journald.conf
       create: true
       regexp: ^\s*ForwardToSyslog=
-      line: ForwardToSyslog="yes"
+      line: ForwardToSyslog=yes
       state: present
       insertbefore: ^# ForwardToSyslog
       validate: /usr/bin/bash -n %s

bash remediation for rule 'xccdf_org.ssgproject.content_rule_journald_storage' differs.
--- xccdf_org.ssgproject.content_rule_journald_storage
+++ xccdf_org.ssgproject.content_rule_journald_storage
@@ -16,10 +16,10 @@
 if [ -z "$line_number" ]; then
     # There was no match of '^#\s*Storage', insert at
     # the end of the file.
-    printf '%s\n' "Storage='persistent'" >> "/etc/systemd/journald.conf"
+    printf '%s\n' "Storage=persistent" >> "/etc/systemd/journald.conf"
 else
     head -n "$(( line_number - 1 ))" "/etc/systemd/journald.conf.bak" > "/etc/systemd/journald.conf"
-    printf '%s\n' "Storage='persistent'" >> "/etc/systemd/journald.conf"
+    printf '%s\n' "Storage=persistent" >> "/etc/systemd/journald.conf"
     tail -n "+$(( line_number ))" "/etc/systemd/journald.conf.bak" >> "/etc/systemd/journald.conf"
 fi
 # Clean up after ourselves.

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_journald_storage' differs.
--- xccdf_org.ssgproject.content_rule_journald_storage
+++ xccdf_org.ssgproject.content_rule_journald_storage
@@ -1,5 +1,4 @@
-- name: Setting shell-quoted shell-style assignment of 'Storage' to 'persistent' in
-    '/etc/systemd/journald.conf'
+- name: Setting unquoted shell-style assignment of 'Storage' to 'persistent' in '/etc/systemd/journald.conf'
   block:
 
   - name: Check for duplicate values
@@ -25,7 +24,7 @@
       path: /etc/systemd/journald.conf
       create: true
       regexp: ^\s*Storage=
-      line: Storage="persistent"
+      line: Storage=persistent
       state: present
       insertbefore: ^# Storage
       validate: /usr/bin/bash -n %s

@codeclimate
Copy link

codeclimate bot commented Jul 3, 2023

Code Climate has analyzed commit ab7ec1f and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 53.5% (0.0% change).

View more on Code Climate.

@marcusburghardt marcusburghardt added the Update Rule Issues or pull requests related to Rules updates. label Jul 3, 2023
@marcusburghardt marcusburghardt added this to the 0.1.69 milestone Jul 3, 2023
@Mab879 Mab879 self-assigned this Jul 3, 2023
@Mab879
Copy link
Member

Mab879 commented Jul 3, 2023

The Automatus failure is not related to this PR.

Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@Mab879 Mab879 merged commit 17bc123 into ComplianceAsCode:master Jul 3, 2023
@jan-cerny
Copy link
Collaborator

This PR is also related to: https://bugzilla.redhat.com/show_bug.cgi?id=2169857

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Used by openshift-ci bot. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants