142328Sbostic#!/bin/sh - 242328Sbostic# 3*52573Sbostic# @(#)security 5.9 (Berkeley) 02/19/92 442328Sbostic# 542328SbosticPATH=/sbin:/bin:/usr/bin 642328Sbostic 752151Sbostichost=`hostname` 842328Sbosticecho "Subject: $host security check output" 942328Sbostic 1052215Sbosticumask 22 1152215Sbostic 12*52573Sbosticecho "" 13*52573Sbosticecho "Checking for uids of 0:" 14*52573Sbosticawk -F: "\$3==\"0\" {print \"user: \" \$1 \", uid: \" \$3 }" /etc/master.passwd 1542328Sbostic 1652151Sbosticecho "" 17*52573Sbosticecho "Checking for uids without passwords:" 18*52573Sbosticawk -F: "\$2==\"\" {print \"user: \" \$1 \", uid: \" \$3 }" /etc/master.passwd 19*52573Sbostic 20*52573SbosticDONE=/tmp/_secure1.$$ 21*52573SbosticLIST=/tmp/_secure2.$$ 22*52573SbosticTMP=/tmp/_secure3.$$ 23*52573Sbostic 24*52573Sbostictrap 'rm -f $DONE $LIST $TMP' 0 25*52573Sbostic 26*52573Sbosticecho "" 2752143Sbosticecho "Checking setuid files and devices:" 28*52573Sbostic(find /sbin \( ! -fstype local \) -a -prune -o \ 29*52573Sbostic \( -perm -u+s -o -perm -g+s -o ! -type d -a ! -type f -a ! -type l \) | \ 30*52573Sbostic sort | sed -e 's/^/ls -lgT /' | sh >$LIST) 2>$TMP 3142328Sbostic 32*52573Sbosticif [ -s $TMP ] ; then 3352215Sbostic echo "$host setuid/device find errors:" 34*52573Sbostic cat $TMP 35*52573Sbostic echo "" 3642328Sbosticfi 3742328Sbostic 38*52573Sbosticif [ -s $LIST ] ; then 39*52573Sbostic SETCUR=/var/log/setuid.current 40*52573Sbostic SETBACK=/var/log/setuid.backup 4152215Sbostic 42*52573Sbostic if [ -s $SETCUR ] ; then 43*52573Sbostic if cmp -s $SETCUR $LIST ; then 44*52573Sbostic : 45*52573Sbostic else 46*52573Sbostic :> $DONE 47*52573Sbostic join -110 -210 -v2 $SETCUR $LIST >$TMP 48*52573Sbostic if [ -s $TMP ] ; then 49*52573Sbostic echo "$host setuid/device additions:" 50*52573Sbostic tee -a $DONE < $TMP 51*52573Sbostic echo "" 52*52573Sbostic fi 53*52573Sbostic 54*52573Sbostic join -110 -210 -v1 $SETCUR $LIST >$TMP 55*52573Sbostic if [ -s $TMP ] ; then 56*52573Sbostic echo "$host setuid/device deletions:" 57*52573Sbostic tee -a $DONE < $TMP 58*52573Sbostic echo "" 59*52573Sbostic fi 60*52573Sbostic 61*52573Sbostic sort +9 $DONE $SETCUR $LIST | uniq -u >$TMP 62*52573Sbostic if [ -s $TMP ] ; then 63*52573Sbostic echo "$host setuid/device changes:" 64*52573Sbostic cat $TMP 65*52573Sbostic echo "" 66*52573Sbostic fi 67*52573Sbostic 68*52573Sbostic mv $SETCUR $SETBACK 69*52573Sbostic mv $LIST $SETCUR 70*52573Sbostic fi 71*52573Sbostic else 72*52573Sbostic echo "$host setuid/device additions:" 73*52573Sbostic cat $LIST 74*52573Sbostic echo "" 75*52573Sbostic mv $LIST $SETCUR 76*52573Sbostic fi 7752215Sbosticfi 7852215Sbostic 79