Date: Sun, 29 Aug 1999 18:18:54 -0600 From: Warner Losh <imp@village.org> To: dynamo@ime.net Cc: security@freebsd.org Subject: Re: Not sure if you got it... Message-ID: <199908300018.SAA90400@harmony.village.org> In-Reply-To: Your message of "Sat, 28 Aug 1999 22:22:12 EDT." <Pine.BSI.4.02.9908282221020.15859-100000@ime.net> References: <Pine.BSI.4.02.9908282221020.15859-100000@ime.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <Pine.BSI.4.02.9908282221020.15859-100000@ime.net> dynamo@ime.net writes: : this is my second try -- if you can gimmie an "ok" so i know you got this : i would appreciate it. Since this has been disclosed before I could put a fix in for rc, I'll post my fixes here. It also increases the paranoia of clearing flags from files as well as correct a minor grammar problem in a comment. Sorry to jumble together the patches like this, but the /etc/rc* have been "locked" under review lately until just recently. Look at thest test -f addition. Warner Index: rc =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/etc/rc,v retrieving revision 1.195 diff -u -r1.195 rc --- rc 1999/08/27 23:23:43 1.195 +++ rc 1999/08/30 00:14:44 @@ -129,8 +129,11 @@ clean_var() { if [ ! -f /var/run/clean_var ]; then + chflags -R 0 /var/run/* > /dev/null 2>&1 rm -rf /var/run/* + chflags 0 /var/spool/lock/* > /dev/null 2>&1 rm -f /var/spool/lock/* + chflags -R 0 /var/spool/uucp/.Temp/* > /dev/null 2>&1 rm -rf /var/spool/uucp/.Temp/* # Keep a copy of the boot messages around dmesg >/var/run/dmesg.boot @@ -178,8 +181,8 @@ mount -a -t nfs echo . -# Whack the pty perms back into shape. -chflags 0 /dev/tty[pqrsPQRS]* +# Put the pty perms back into shape. +chflags 0 /dev/tty[pqrsPQRS]* > /dev/null 2>&1 chmod 666 /dev/tty[pqrsPQRS]* chown root:wheel /dev/tty[pqrsPQRS]* @@ -200,14 +203,17 @@ # prune quickly with one rm, then use find to clean up /tmp/[lq]* # (not needed with mfs /tmp, but doesn't hurt there...) - (cd /tmp && rm -rf [a-km-pr-zA-Z]* && + (cd /tmp && chflags -R 0 [a-km-pr-zA-Z]* && rm -rf [a-km-pr-zA-Z]* && find -d . ! -name . ! -name lost+found ! -name quota.user \ - ! -name quota.group -exec rm -rf -- {} \;) + ! -name quota.group -execdir chflags -R 0 {} \; && + find -d . ! -name . ! -name lost+found ! -name quota.user \ + ! -name quota.group -execdir rm -rf -- {} \;) > /dev/null 2>&1 fi # Remove X lock files, since they will prevent you from restarting X11 # after a system crash. +chflags 0 /tmp/.X*-lock /tmp/.X11-unix/* > /dev/null 2>&1 rm -f /tmp/.X*-lock /tmp/.X11-unix/* # snapshot any kernel -c changes back to disk here <someday> @@ -348,7 +354,7 @@ echo 'Recovering vi editor sessions' for i in ${vibackup}; do # Only test files that are readable. - if test ! -r ${i}; then + if test ! -r ${i} -o ! -f ${i}; then continue fi @@ -376,6 +382,7 @@ if test -n "${recfile}" -a -s "${recfile}"; then sendmail -t < ${i} else + chflags 0 ${i} > /dev/null 2>&1 rm -f ${i} fi done @@ -400,7 +407,7 @@ fi if [ "${update_motd}" != "NO" ]; then - T=`mktemp /tmp/_motd.XXXXXX` + T=`mktemp /var/run/_motd.XXXXXX` if [ $? -eq 0 ]; then uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T} awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T} To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-security" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908300018.SAA90400>