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

fix: use grep -E instead of deprecated egrep #10643

Merged
merged 1 commit into from
May 29, 2023

Conversation

maage
Copy link
Contributor

@maage maage commented May 28, 2023

Description:

Use grep -E instead of egrep.

Rationale:

From grep(1):

   In addition, the variant programs egrep and fgrep are the same as
   grep -E and grep -F, respectively. These variants are deprecated,
   but are provided for backward compatibility.

More context: https://www.phoronix.com/news/GNU-Grep-3.8-Stop-egrep-fgrep

Review Hints:

Changes are all over unfortunately.

From grep(1):

       In addition, the variant programs egrep and fgrep are the same as
       grep -E and grep -F, respectively. These variants are deprecated,
       but are provided for backward compatibility.

Made using:
    git grep -l egrep docs .github linux_os|xargs -r \
        sed -Ei 's/egrep -/grep -E/g;s/egrep /grep -E /g'
@openshift-ci
Copy link

openshift-ci bot commented May 28, 2023

Hi @maage. 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.

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label May 28, 2023
@github-actions
Copy link

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

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

Click here to see the full diff
OCIL for rule 'xccdf_org.ssgproject.content_rule_audit_rules_networkconfig_modification' differs.%0A--- ocil:ssg-audit_rules_networkconfig_modification_ocil:questionnaire:1%0A+++ ocil:ssg-audit_rules_networkconfig_modification_ocil:questionnaire:1%0A@@ -1,6 +1,6 @@%0A To determine if the system is configured to audit changes to its network configuration,%0A run the following command:%0A-auditctl -l | egrep '(/etc/issue|/etc/issue.net|/etc/hosts|/etc/sysconfig/network)'%0A+auditctl -l | grep -E '(/etc/issue|/etc/issue.net|/etc/hosts|/etc/sysconfig/network)'%0A If the system is configured to watch for network configuration changes, a line should be returned for%0A each file specified (and perm=wa should be indicated for each).%0A       Is it the case that the system is not configured to audit changes of the network configuration?%0A%0AOCIL for rule 'xccdf_org.ssgproject.content_rule_audit_rules_usergroup_modification' differs.%0A--- ocil:ssg-audit_rules_usergroup_modification_ocil:questionnaire:1%0A+++ ocil:ssg-audit_rules_usergroup_modification_ocil:questionnaire:1%0A@@ -1,6 +1,6 @@%0A To determine if the system is configured to audit account changes,%0A run the following command:%0A-auditctl -l | egrep '(/etc/passwd|/etc/shadow|/etc/group|/etc/gshadow|/etc/security/opasswd)'%0A+auditctl -l | grep -E '(/etc/passwd|/etc/shadow|/etc/group|/etc/gshadow|/etc/security/opasswd)'%0A If the system is configured to watch for account changes, lines should be returned for%0A each file specified (and with perm=wa for each).%0A       Is it the case that the system is not configured to audit account changes?%0A%0AOCIL for rule 'xccdf_org.ssgproject.content_rule_audit_rules_usergroup_modification_group' differs.%0A--- ocil:ssg-audit_rules_usergroup_modification_group_ocil:questionnaire:1%0A+++ ocil:ssg-audit_rules_usergroup_modification_group_ocil:questionnaire:1%0A@@ -1,6 +1,6 @@%0A Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/group" with the following command:%0A %0A-$ sudo auditctl -l | egrep '(/etc/group)'%0A+$ sudo auditctl -l | grep -E '(/etc/group)'%0A %0A -w /etc/group -p wa -k identity%0A       Is it the case that the command does not return a line, or the line is commented out?%0A%0AOCIL for rule 'xccdf_org.ssgproject.content_rule_audit_rules_usergroup_modification_gshadow' differs.%0A--- ocil:ssg-audit_rules_usergroup_modification_gshadow_ocil:questionnaire:1%0A+++ ocil:ssg-audit_rules_usergroup_modification_gshadow_ocil:questionnaire:1%0A@@ -1,6 +1,6 @@%0A Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/gshadow" with the following command:%0A %0A-$ sudo auditctl -l | egrep '(/etc/gshadow)'%0A+$ sudo auditctl -l | grep -E '(/etc/gshadow)'%0A %0A -w /etc/gshadow -p wa -k identity%0A %0A%0AOCIL for rule 'xccdf_org.ssgproject.content_rule_audit_rules_usergroup_modification_opasswd' differs.%0A--- ocil:ssg-audit_rules_usergroup_modification_opasswd_ocil:questionnaire:1%0A+++ ocil:ssg-audit_rules_usergroup_modification_opasswd_ocil:questionnaire:1%0A@@ -1,6 +1,6 @@%0A Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/security/opasswd" with the following command:%0A %0A-$ sudo auditctl -l | egrep '(/etc/security/opasswd)'%0A+$ sudo auditctl -l | grep -E '(/etc/security/opasswd)'%0A %0A -w /etc/security/opasswd -p wa -k identity%0A       Is it the case that the command does not return a line, or the line is commented out?%0A%0AOCIL for rule 'xccdf_org.ssgproject.content_rule_audit_rules_usergroup_modification_passwd' differs.%0A--- ocil:ssg-audit_rules_usergroup_modification_passwd_ocil:questionnaire:1%0A+++ ocil:ssg-audit_rules_usergroup_modification_passwd_ocil:questionnaire:1%0A@@ -1,6 +1,6 @@%0A Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd" with the following command:%0A %0A-$  sudo auditctl -l | egrep '(/etc/passwd)'%0A+$  sudo auditctl -l | grep -E '(/etc/passwd)'%0A %0A -w /etc/passwd -p wa -k identity%0A       Is it the case that the command does not return a line, or the line is commented out?%0A%0AOCIL for rule 'xccdf_org.ssgproject.content_rule_audit_rules_usergroup_modification_shadow' differs.%0A--- ocil:ssg-audit_rules_usergroup_modification_shadow_ocil:questionnaire:1%0A+++ ocil:ssg-audit_rules_usergroup_modification_shadow_ocil:questionnaire:1%0A@@ -1,6 +1,6 @@%0A Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd with the following command:%0A %0A-$  sudo auditctl -l | egrep '(/etc/shadow)'%0A+$  sudo auditctl -l | grep -E '(/etc/shadow)'%0A %0A -w /etc/shadow -p wa -k identity%0A       Is it the case that command does not return a line, or the line is commented out?

@codeclimate
Copy link

codeclimate bot commented May 28, 2023

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

View more on Code Climate.

@evgenyz evgenyz self-assigned this May 29, 2023
@evgenyz evgenyz self-requested a review May 29, 2023 14:27
Copy link
Member

@evgenyz evgenyz left a comment

Choose a reason for hiding this comment

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

As good as it comes. No backward compatibility problems expected as egrep was the alias for grep -E for ages.

Thank you for the contribution.

@evgenyz evgenyz merged commit d3fc3c8 into ComplianceAsCode:master May 29, 2023
25 of 28 checks passed
@evgenyz evgenyz added bugfix Fixes to reported bugs. Infrastructure Our content build system Bash Bash remediation update. labels May 29, 2023
@maage
Copy link
Contributor Author

maage commented May 29, 2023

Thanks

@maage maage deleted the egrep-1 branch May 29, 2023 20:11
@Mab879 Mab879 added this to the 0.1.69 milestone May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bash Bash remediation update. bugfix Fixes to reported bugs. Infrastructure Our content build system needs-ok-to-test Used by openshift-ci bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants