Replaced usage outdate egrep to grep

Change-Id: I023b86a3423491156f8a0f5151eddb8d81868aa9
Signed-off-by: Ivan Anfimov <lazekteam@gmail.com>
This commit is contained in:
Ivan Anfimov
2025-07-16 21:47:41 +00:00
parent 394652de90
commit bf3c45f121
3 changed files with 11 additions and 11 deletions

View File

@@ -4892,7 +4892,7 @@ user 'smithj': directory '/home/smithj' does not exist
Ask the System Administrator (SA) if any users found without home directories are local interactive users. If the SA is unable to provide a response, check for users with a User Identifier (UID) of 1000 or greater with the following command:
# cut -d: -f 1,3 /etc/passwd | egrep ":[1-4][0-9]{2}$|:[0-9]{1,2}$"
# cut -d: -f 1,3 /etc/passwd | grep -E ":[1-4][0-9]{2}$|:[0-9]{1,2}$"
If any interactive users do not have a home directory assigned, this is a finding.</check-content>
</check>
@@ -4960,7 +4960,7 @@ Note: The example will be for the user smithj, who has a home directory of "/hom
Check the home directory assignment for all local interactive non-privileged users on the system with the following command:
# cut -d: -f 1,3 /etc/passwd | egrep ":[1-9][0-9]{2}$|:[0-9]{1,2}$"
# cut -d: -f 1,3 /etc/passwd | grep -E ":[1-9][0-9]{2}$|:[0-9]{1,2}$"
smithj /home/smithj
Note: This may miss interactive users that have been assigned a privileged UID. Evidence of interactive use may be obtained from a number of log files containing system logon information.
@@ -5003,7 +5003,7 @@ Check the home directory assignment for all non-privileged users on the system w
Note: This may miss interactive users that have been assigned a privileged User Identifier (UID). Evidence of interactive use may be obtained from a number of log files containing system logon information.
# ls -ld $(egrep ':[0-9]{4}' /etc/passwd | cut -d: -f6)
# ls -ld $(grep -E ':[0-9]{4}' /etc/passwd | cut -d: -f6)
-rwxr-x--- 1 smithj users 18 Mar 5 17:06 /home/smithj
If home directories referenced in "/etc/passwd" do not have a mode of "0750" or less permissive, this is a finding.</check-content>
@@ -5039,7 +5039,7 @@ Check the home directory assignment for all local interactive non-privileged use
Note: This may miss interactive users that have been assigned a privileged UID. Evidence of interactive use may be obtained from a number of log files containing system logon information.
# ls -ld $(egrep ':[0-9]{4}' /etc/passwd | cut -d: -f6)
# ls -ld $(grep -E ':[0-9]{4}' /etc/passwd | cut -d: -f6)
-rwxr-x--- 1 smithj users 18 Mar 5 17:06 /home/smithj
If any home directories referenced in "/etc/passwd" are returned as not defined, this is a finding.</check-content>
@@ -5075,7 +5075,7 @@ Check the home directory assignment for all non-privileged users on the system w
Note: This may miss local interactive users that have been assigned a privileged UID. Evidence of interactive use may be obtained from a number of log files containing system logon information.
# ls -ld $(egrep ':[0-9]{4}' /etc/passwd | cut -d: -f6)
# ls -ld $(grep -E ':[0-9]{4}' /etc/passwd | cut -d: -f6)
-rwxr-x--- 1 smithj users 18 Mar 5 17:06 /home/smithj
Check the user's primary group with the following command:
@@ -5276,7 +5276,7 @@ Check the home directory assignment for all non-privileged users on the system w
Note: The example will be for the smithj user, who has a home directory of "/home/smithj" and a primary group of "users".
# cut -d: -f 1,4,6 /etc/passwd | egrep ":[1-4][0-9]{3}"
# cut -d: -f 1,4,6 /etc/passwd | grep -E ":[1-4][0-9]{3}"
smithj:1000:/home/smithj
# grep 1000 /etc/group
@@ -5479,7 +5479,7 @@ Find the file system(s) that contain the user home directories with the followin
Note: If a separate file system has not been created for the user home directories (user home directories are mounted under "/"), this is not a finding as the "nosuid" option cannot be used on the "/" system.
# cut -d: -f 1,3,6 /etc/passwd | egrep ":[1-4][0-9]{3}"
# cut -d: -f 1,3,6 /etc/passwd | grep -E ":[1-4][0-9]{3}"
smithj:1001:/home/smithj
thomasr:1002:/home/thomasr
@@ -5807,7 +5807,7 @@ If the service is active and is not documented, this is a finding.</check-conten
Check the home directory assignment for all non-privileged users (those with a UID greater than 1000) on the system with the following command:
#cut -d: -f 1,3,6,7 /etc/passwd | egrep ":[1-4][0-9]{3}" | tr ":" "\t"
#cut -d: -f 1,3,6,7 /etc/passwd | grep -E ":[1-4][0-9]{3}" | tr ":" "\t"
adamsj /home/adamsj /bin/bash
jacksonm /home/jacksonm /bin/bash

View File

@@ -106,7 +106,7 @@
# those lines that have a '#' as the first character or '#' as the first
# character following a space (or series of spaces).
- name: Check for 'nopasswd' in sudoers files
ansible.builtin.shell: 'grep -ir nopasswd /etc/sudoers /etc/sudoers.d/ | egrep -v "^([[:space:]]*)?(#|$)" || echo "not found"'
ansible.builtin.shell: 'grep -ir nopasswd /etc/sudoers /etc/sudoers.d/ | grep -Ev "^([[:space:]]*)?(#|$)" || echo "not found"'
register: sudoers_nopasswd_check
changed_when: false
when:

View File

@@ -203,7 +203,7 @@
- V-72213
- name: Check if ClamAV update process is already running
ansible.builtin.shell: "set -o pipefail; ps -ef | egrep [f]reshclam -q"
ansible.builtin.shell: "set -o pipefail; ps -ef | grep -E [f]reshclam -q"
register: freshclam_proc
changed_when: false
failed_when: false
@@ -438,7 +438,7 @@
- V-72305
- name: Check to see if snmpd config contains public/private
ansible.builtin.command: 'egrep "^[^#].*(public|private)" /etc/snmp/snmpd.conf'
ansible.builtin.command: 'grep -E "^[^#].*(public|private)" /etc/snmp/snmpd.conf'
register: snmp_public_private_check
changed_when: false
failed_when: false