Fix password masking by collect for gzipped files
The zgrep syntax for a regex search was incorrect. The -E argument is required. This meant that if a gzipped file (ie: bash.log.gz) was included in a collect, then its passwords would not be redacted. Closes-Bug: 1981101 Test Plan: Verify that a gzipped bash log has its password redacted when running collect on CentOS and Debian. Signed-off-by: Al Bailey <al.bailey@windriver.com> Change-Id: I497813949b65137a93a91bf58ede2c591fb15f62
This commit is contained in:
parent
0584e3d7b0
commit
1763064edc
@ -123,7 +123,7 @@ for f in ${COLLECT_NAME_DIR}/var/log/bash.log.*.gz \
|
||||
${COLLECT_NAME_DIR}/var/log/user.log.*.gz \
|
||||
${COLLECT_NAME_DIR}/var/log/ldapscripts.log.*.gz
|
||||
do
|
||||
zgrep -q 'snmp|password' $f || continue
|
||||
zgrep -q -E 'snmp|password' $f || continue
|
||||
gunzip $f
|
||||
unzipped=${f%%.gz}
|
||||
sed -i -r 's/(snmp-comm-(delete|show)) *((\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*) *){1,}/\1 xxxxxx/;
|
||||
|
@ -123,7 +123,7 @@ for f in ${COLLECT_NAME_DIR}/var/log/bash.log.*.gz \
|
||||
${COLLECT_NAME_DIR}/var/log/user.log.*.gz \
|
||||
${COLLECT_NAME_DIR}/var/log/ldapscripts.log.*.gz
|
||||
do
|
||||
zgrep -q 'snmp|password' $f || continue
|
||||
zgrep -q -E 'snmp|password' $f || continue
|
||||
gunzip $f
|
||||
unzipped=${f%%.gz}
|
||||
sed -i -r 's/(snmp-comm-(delete|show)) *((\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*) *){1,}/\1 xxxxxx/;
|
||||
|
Loading…
x
Reference in New Issue
Block a user