-
Notifications
You must be signed in to change notification settings - Fork 728
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
Update regex to support RainerScript in rsyslog_cron_logging #13172
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Armando Acosta <[email protected]>
Signed-off-by: Armando Acosta <[email protected]>
Signed-off-by: Armando Acosta <[email protected]>
Hi @mrkanon. 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 Once the patch is verified, the new status will be reflected by the 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-sigs/prow repository. |
This datastream diff is auto generated by the check Click here to see the full diffbash remediation for rule 'xccdf_org.ssgproject.content_rule_rsyslog_cron_logging' differs.
--- xccdf_org.ssgproject.content_rule_rsyslog_cron_logging
+++ xccdf_org.ssgproject.content_rule_rsyslog_cron_logging
@@ -1,7 +1,8 @@
# Remediation is applicable only in certain platforms
if rpm --quiet -q kernel && rpm --quiet -q rsyslog; then
-if ! grep -s "^\s*cron\.\*\s*/var/log/cron$" /etc/rsyslog.conf /etc/rsyslog.d/*.conf; then
+if ! grep -Pzo '(?m)^\s*cron\.\*\s*(/var/log/cron|action\(\s*.*(?i:\btype\b)="omfile"\s*.*(?i:\bfile\b)="/var/log/cron"\s*\))\s*$' /etc/rsyslog.conf /etc/rsyslog.d/*.conf; then
+
mkdir -p /etc/rsyslog.d
echo "cron.* /var/log/cron" >> /etc/rsyslog.d/cron.conf
fi
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_rsyslog_cron_logging' differs.
--- xccdf_org.ssgproject.content_rule_rsyslog_cron_logging
+++ xccdf_org.ssgproject.content_rule_rsyslog_cron_logging
@@ -13,8 +13,8 @@
- rsyslog_cron_logging
- name: Ensure cron Is Logging To Rsyslog - Search if cron configuration exists
- ansible.builtin.command: grep -s "^\s*cron\.\*\s*/var/log/cron$" /etc/rsyslog.conf
- /etc/rsyslog.d/*.conf
+ ansible.builtin.command: grep -Pzo '(?m)^\s*cron\.\*\s*(/var/log/cron|action\(\s*.*(?i:\btype\b)="omfile"\s*.*(?i:\bfile\b)="/var/log/cron"\s*\))\s*$'
+ /etc/rsyslog.conf /etc/rsyslog.d/*.conf
register: cron_log_config_exists
failed_when: false
when: |
Change in Ansible Please consider using more suitable Ansible module than |
Code Climate has analyzed commit c0a72c1 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 62.0% (0.0% change). View more on Code Climate. |
Description:
Rationale:
The current regex only checks for the legacy configuration and does not include support for RainerScript. Additionally, the OVAL file contains a condition for OL products that redirects all facility logs to /var/log/messages. This scenario is not currently supported by the remediation scripts.
The RainerScript accepts multi-line configurations, we need to ensure the correct behavior of the rule.