1164022Sdds#!/bin/sh -
2164022Sdds#
3164022Sdds# Copyright (c) 2001  The FreeBSD Project
4164022Sdds# All rights reserved.
5164022Sdds#
6164022Sdds# Redistribution and use in source and binary forms, with or without
7164022Sdds# modification, are permitted provided that the following conditions
8164022Sdds# are met:
9164022Sdds# 1. Redistributions of source code must retain the above copyright
10164022Sdds#    notice, this list of conditions and the following disclaimer.
11164022Sdds# 2. Redistributions in binary form must reproduce the above copyright
12164022Sdds#    notice, this list of conditions and the following disclaimer in the
13164022Sdds#    documentation and/or other materials provided with the distribution.
14164022Sdds#
15164022Sdds# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16164022Sdds# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17164022Sdds# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18164022Sdds# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19164022Sdds# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20164022Sdds# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21164022Sdds# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22164022Sdds# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23164022Sdds# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24164022Sdds# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25164022Sdds# SUCH DAMAGE.
26164022Sdds#
27164022Sdds# $FreeBSD$
28164022Sdds#
29164022Sdds
30164022Sdds# If there is a global system configuration file, suck it in.
31164022Sdds#
32164022Sddsif [ -r /etc/defaults/periodic.conf ]
33164022Sddsthen
34164022Sdds    . /etc/defaults/periodic.conf
35164022Sdds    source_periodic_confs
36164022Sddsfi
37164022Sdds
38164022Sddsrc=0
39164022Sdds
40164022Sddscase "$daily_status_security_neggrpperm_enable" in
41164022Sdds    [Yy][Ee][Ss])
42164022Sdds	echo ""
43164022Sdds	echo 'Checking negative group permissions:'
44164022Sdds	MP=`mount -t ufs,zfs | awk '$0 !~ /no(suid|exec)/ { print $3 }'`
45164022Sdds	n=$(find -sx $MP /dev/null -type f \
46164022Sdds	    \( \( ! -perm +010 -and -perm +001 \) -or \
47164022Sdds	    \( ! -perm +020 -and -perm +002 \) -or \
48164022Sdds	    \( ! -perm +040 -and -perm +004 \) \) \
49164022Sdds	    -exec ls -liTd \{\} \+ | tee /dev/stderr | wc -l)
50164022Sdds	[ $n -gt 0 ] && rc=1 || rc=0
51	;;
52esac
53
54exit $rc
55