1997-08-16 17:04:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
1997-08-16 17:04:02 +00:00
|
|
|
#
|
2000-06-23 01:18:31 +00:00
|
|
|
|
|
|
|
# If there is a global system configuration file, suck it in.
|
|
|
|
#
|
|
|
|
if [ -r /etc/defaults/periodic.conf ]
|
|
|
|
then
|
|
|
|
. /etc/defaults/periodic.conf
|
|
|
|
source_periodic_confs
|
1997-08-16 17:04:02 +00:00
|
|
|
fi
|
2000-06-23 01:18:31 +00:00
|
|
|
|
|
|
|
case "$daily_backup_passwd_enable" in
|
|
|
|
[Yy][Ee][Ss])
|
2000-09-14 17:19:15 +00:00
|
|
|
if [ ! -f /etc/master.passwd ]
|
2000-06-23 01:18:31 +00:00
|
|
|
then
|
2000-09-14 17:19:15 +00:00
|
|
|
echo '$daily_backup_passwd_enable" is set but /etc/master.passwd' \
|
|
|
|
"doesn't exist"
|
|
|
|
rc=2
|
|
|
|
elif [ ! -f /etc/group ]
|
|
|
|
then
|
|
|
|
echo '$daily_backup_passwd_enable" is set but /etc/group' \
|
|
|
|
"doesn't exist"
|
|
|
|
rc=2
|
|
|
|
else
|
2000-06-23 01:18:31 +00:00
|
|
|
bak=/var/backups
|
2000-09-14 17:19:15 +00:00
|
|
|
rc=0
|
2000-06-23 01:18:31 +00:00
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Backup passwd and group files:"
|
|
|
|
|
|
|
|
if [ ! -f $bak/master.passwd.bak ]
|
|
|
|
then
|
2000-09-14 17:19:15 +00:00
|
|
|
rc=1
|
2000-06-23 01:18:31 +00:00
|
|
|
echo "no $bak/master.passwd.bak"
|
2000-09-14 17:19:15 +00:00
|
|
|
cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3
|
2000-06-23 01:18:31 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! cmp -s $bak/master.passwd.bak /etc/master.passwd
|
|
|
|
then
|
2000-09-14 17:19:15 +00:00
|
|
|
[ $rc -lt 1 ] && rc=1
|
2000-06-23 01:18:31 +00:00
|
|
|
echo "$host passwd diffs:"
|
|
|
|
diff $bak/master.passwd.bak /etc/master.passwd |\
|
|
|
|
sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/'
|
|
|
|
mv $bak/master.passwd.bak $bak/master.passwd.bak2
|
2000-09-14 17:19:15 +00:00
|
|
|
cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3
|
2000-06-23 01:18:31 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f $bak/group.bak ]
|
|
|
|
then
|
2000-09-14 17:19:15 +00:00
|
|
|
[ $rc -lt 1 ] && rc=1
|
2000-06-23 01:18:31 +00:00
|
|
|
echo "no $bak/group.bak"
|
2000-09-14 17:19:15 +00:00
|
|
|
cp -p /etc/group $bak/group.bak || rc=3
|
2000-06-23 01:18:31 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! cmp -s $bak/group.bak /etc/group
|
|
|
|
then
|
2000-09-14 17:19:15 +00:00
|
|
|
[ $rc -lt 1 ] && rc=1
|
2000-06-23 01:18:31 +00:00
|
|
|
echo "$host group diffs:"
|
|
|
|
diff $bak/group.bak /etc/group
|
|
|
|
mv $bak/group.bak $bak/group.bak2
|
2000-09-14 17:19:15 +00:00
|
|
|
cp -p /etc/group $bak/group.bak || rc=3
|
2000-06-23 01:18:31 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/group ]
|
|
|
|
then
|
|
|
|
echo ""
|
|
|
|
echo "Verifying group file syntax:"
|
2000-09-14 17:19:15 +00:00
|
|
|
chkgrp /etc/group || rc=3
|
2000-06-23 01:18:31 +00:00
|
|
|
fi
|
|
|
|
fi;;
|
2000-09-14 17:19:15 +00:00
|
|
|
|
|
|
|
*) rc=0;;
|
2000-06-23 01:18:31 +00:00
|
|
|
esac
|
2000-09-14 17:19:15 +00:00
|
|
|
|
|
|
|
exit $rc
|