1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

backup-passwd: mask out all passwords in the diff

The previous expression borked if a username had a plus or hyphen in it.
This is needlessly restrictive- at leSt a hyphen in the middle is valid.
Instead of playing this game, let's just assume the username can't contain a
colon and mask out the second field.

Submitted by:	sigsys gmail com
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D23548
This commit is contained in:
Kyle Evans 2020-02-11 06:12:02 +00:00
parent 9f7cca9218
commit e9104c3142
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357756

View File

@ -42,7 +42,7 @@ case "$daily_backup_passwd_enable" in
[ $rc -lt 1 ] && rc=1
echo "$host passwd diffs:"
diff -uI '^#' $bak/master.passwd.bak /etc/master.passwd |\
sed 's/^\([-+ ][^-+:]*\):[^:]*:/\1:(password):/'
sed 's/^\([-+ ][^:]*\):[^:]*:/\1:(password):/'
mv $bak/master.passwd.bak $bak/master.passwd.bak2
cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3
fi