110.neggrpperm revision 87514
187514Scjc#!/bin/sh - 287514Scjc# 387514Scjc# Copyright (c) 2001 The FreeBSD Project 487514Scjc# All rights reserved. 587514Scjc# 687514Scjc# Redistribution and use in source and binary forms, with or without 787514Scjc# modification, are permitted provided that the following conditions 887514Scjc# are met: 987514Scjc# 1. Redistributions of source code must retain the above copyright 1087514Scjc# notice, this list of conditions and the following disclaimer. 1187514Scjc# 2. Redistributions in binary form must reproduce the above copyright 1287514Scjc# notice, this list of conditions and the following disclaimer in the 1387514Scjc# documentation and/or other materials provided with the distribution. 1487514Scjc# 1587514Scjc# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1687514Scjc# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1787514Scjc# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1887514Scjc# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1987514Scjc# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2087514Scjc# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2187514Scjc# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2287514Scjc# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2387514Scjc# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2487514Scjc# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2587514Scjc# SUCH DAMAGE. 2687514Scjc# 2787514Scjc# $FreeBSD: head/etc/periodic/security/100.chksetuid 87514 2001-12-07 23:57:39Z cjc $ 2887514Scjc# 2987514Scjc 3087514Scjc# If there is a global system configuration file, suck it in. 3187514Scjc# 3287514Scjcif [ -r /etc/defaults/periodic.conf ] 3387514Scjcthen 3487514Scjc . /etc/defaults/periodic.conf 3587514Scjc source_periodic_confs 3687514Scjcfi 3787514Scjc 3887514ScjcTMP=/var/run/_secure.$$ 3987514ScjcLOG="${daily_status_security_logdir}" 4087514Scjcrc=0 4187514Scjc 4287514Scjccase "$daily_status_security_chksetuid_enable" in 4387514Scjc [Yy][Ee][Ss]) 4487514Scjc echo "" 4587514Scjc echo 'Checking setuid files and devices:' 4687514Scjc # XXX Note that there is the possibility of overrunning the args to ls 4787514Scjc MP=`mount -t ufs | grep -v " nosuid" | awk '{ print $3 }' | sort` 4887514Scjc set ${MP} 4987514Scjc while [ $# -ge 1 ]; do 5087514Scjc mount=$1 5187514Scjc shift 5287514Scjc find $mount -xdev -type f \ 5387514Scjc \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ 5487514Scjc \( -perm -u+s -or -perm -g+s \) -print0 5587514Scjc done | xargs -0 -n 20 ls -liTd | sort +10 > ${TMP} 5687514Scjc 5787514Scjc if [ ! -f ${LOG}/setuid.today ]; then 5887514Scjc rc=1 5987514Scjc echo "No ${LOG}/setuid.today" 6087514Scjc cp ${TMP} ${LOG}/setuid.today || rc=3 6187514Scjc fi 6287514Scjc 6387514Scjc if ! cmp ${LOG}/setuid.today ${TMP} >/dev/null 6487514Scjc then 6587514Scjc [ $rc -lt 1 ] && rc=1 6687514Scjc echo "${host} setuid diffs:" 6787514Scjc diff -w ${LOG}/setuid.today ${TMP} 6887514Scjc mv ${LOG}/setuid.today ${LOG}/setuid.yesterday || rc=3 6987514Scjc mv ${TMP} ${LOG}/setuid.today || rc=3 7087514Scjc fi 7187514Scjc rm -f ${TMP};; 7287514Scjc *) rc=0;; 7387514Scjcesac 7487514Scjc 7587514Scjcexit $rc 76