harbian-audit
harbian-audit copied to clipboard
14.1 grep returns line format that will never match the regex filter applied
I'm getting a false postive failure for 14.1 due to the grep method being used returning the full path of the matching lines, followed by a colon. The grep expects the line output to start with blacklist but that will never match because grepping a folder will return <full file path>:blacklist - this grep needs to either change the regex to not expect blacklist to be the first word, or it needs to parse the results with cut and remove everything up to and including the : in the returned lines.
# grep -w nf_nat_sip -r /etc/modprobe.d/* | grep "^blacklist" | wc -l
0
# grep -w nf_nat_sip -r /etc/modprobe.d/* | grep "^blacklist"
# cat /etc/modprobe.d/cis-blacklist.conf
blacklist nf_nat_sip
blacklist nf_conntrack_sip
# grep -w nf_nat_sip -r /etc/modprobe.d/*
/etc/modprobe.d/CIS.conf:install nf_nat_sip /bin/true
/etc/modprobe.d/cis-blacklist.conf:blacklist nf_nat_sip