Merge "Masking passwords with collect script"
This commit is contained in:
commit
2cd822ce73
@ -97,17 +97,21 @@ sed -i -r 's/(trap2sink *[^ ]*).*/\1 xxxxxx/' ${COLLECT_NAME_DIR}/var/extra/pla
|
||||
USER_HISTORY_FILES=$(find ${COLLECT_NAME_DIR} -type f -name .bash_history 2>/dev/null)
|
||||
sed -i -r 's/(snmp-comm-(delete|show)) *((\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*) *){1,}/\1 xxxxxx/;
|
||||
s/(snmp.*) *(--community|-c) *(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1 \2 xxxxxx/;
|
||||
s/(password)=(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1=xxxxxx/;
|
||||
s/(-password)=(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1=xxxxxx/;
|
||||
s/(-password) (\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1 xxxxxx/g;
|
||||
s/(password)'\'': (\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1'\':' xxxxxx/g;
|
||||
s/(openstack.*) *(--password) *(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1 \2 xxxxxx/;
|
||||
s/(ldapmodifyuser.*userPassword *)(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1 xxxxxx/' \
|
||||
${USER_HISTORY_FILES} \
|
||||
${COLLECT_NAME_DIR}/var/extra/history.info \
|
||||
${COLLECT_NAME_DIR}/var/log/bash.log \
|
||||
${COLLECT_NAME_DIR}/var/log/auth.log \
|
||||
${COLLECT_NAME_DIR}/var/log/user.log
|
||||
${COLLECT_NAME_DIR}/var/log/ldapscripts.log
|
||||
|
||||
for f in ${COLLECT_NAME_DIR}/var/log/bash.log.*.gz \
|
||||
${COLLECT_NAME_DIR}/var/log/auth.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
|
||||
@ -115,9 +119,10 @@ do
|
||||
unzipped=${f%%.gz}
|
||||
sed -i -r 's/(snmp-comm-(delete|show)) *((\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*) *){1,}/\1 xxxxxx/;
|
||||
s/(snmp.*) *(--community|-c) *(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1 \2 xxxxxx/;
|
||||
s/(password)=(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1=xxxxxx/;
|
||||
s/(-password)=(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1=xxxxxx/;
|
||||
s/(-password) (\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1 xxxxxx/g;
|
||||
s/(password)'\'': (\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1'\':' xxxxxx/g;
|
||||
s/(openstack.*) *(--password) *(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1 \2 xxxxxx/;
|
||||
s/(ldapmodifyuser.*userPassword *)(\"[^\"]*\"|'\''[^'"'"']*'"'"'|[^ ]*)/\1 xxxxxx/' $unzipped
|
||||
gzip $unzipped
|
||||
done
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user