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

SLE Add rsyslog_remote_loghost droping remediations #10672

Conversation

teacup-on-rockingchair
Copy link
Contributor

Description:

  • Add rsyslog_remote_loghost droping remediations

Rationale:

  • Implement Bash and Ansible remediations that rely on drop-in configuration files

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Jun 2, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 2, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@github-actions
Copy link

github-actions bot commented Jun 2, 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

@jan-cerny jan-cerny added the SLES SUSE Linux Enterprise Server product related. label Jun 5, 2023
@jan-cerny jan-cerny added this to the 0.1.69 milestone Jun 5, 2023
@jan-cerny jan-cerny added Ansible Ansible remediation update. Bash Bash remediation update. labels Jun 5, 2023
Use it to remove all current rsyslog loghost settings in rsyslog_remote_loghost rule
@teacup-on-rockingchair teacup-on-rockingchair marked this pull request as ready for review June 12, 2023 09:04
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Jun 12, 2023
@jan-cerny jan-cerny self-assigned this Jun 13, 2023
Comment on lines 4 to 5
{{{ bash_comment_config_line("/etc/rsyslog.conf", '^*.*') }}}
{{{ bash_comment_config_line("/etc/rsyslog.d/*.conf", '^*.*') }}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The dots and asterisks need to be escaped

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the note, experienced some strange behaviour with \> so reworked that part in a28e9bc

@@ -1598,6 +1598,18 @@ fi
:type format: str

#}}

{{%- macro bash_comment_config_line(config_file, key) -%}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This macro needs to be tested by a BATS test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very useful indeed, haven't had the BATS pleasure so far 👍 done in 4438714

Strange enough usage of `\>` and `\` for escaping `.` and `*` produces unexpected results.
As in test string `*.* Something` does not match regex `^\*\.\*\>` but matches `^*.*\>`.
Since usage of the `\>` seems missin in other implmenetations(PCRE, Javascript etc), decided to change it to [[:blank:]],
and escape every special symbol like `*` or `.` with '\' for better readability.
@codeclimate
Copy link

codeclimate bot commented Jun 14, 2023

Code Climate has analyzed commit 4438714 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 52.8% (0.0% change).

View more on Code Climate.

@jan-cerny
Copy link
Collaborator

/packit retest

@jan-cerny jan-cerny merged commit f7faa88 into ComplianceAsCode:master Jun 21, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ansible Ansible remediation update. Bash Bash remediation update. SLES SUSE Linux Enterprise Server product related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants