110.neggrpperm revision 306642
1202437Strasz#!/bin/sh -
2202437Strasz#
3202437Strasz# Copyright (c) 2001  The FreeBSD Project
4202437Strasz# All rights reserved.
5202437Strasz#
6202437Strasz# Redistribution and use in source and binary forms, with or without
7202437Strasz# modification, are permitted provided that the following conditions
8202437Strasz# are met:
9202437Strasz# 1. Redistributions of source code must retain the above copyright
10202437Strasz#    notice, this list of conditions and the following disclaimer.
11202437Strasz# 2. Redistributions in binary form must reproduce the above copyright
12202437Strasz#    notice, this list of conditions and the following disclaimer in the
13202437Strasz#    documentation and/or other materials provided with the distribution.
14202437Strasz#
15202437Strasz# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16202437Strasz# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17202437Strasz# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18202437Strasz# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19202437Strasz# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20202437Strasz# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21202437Strasz# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22202437Strasz# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23202437Strasz# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24202437Strasz# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25202437Strasz# SUCH DAMAGE.
26202437Strasz#
27202437Strasz# $FreeBSD: stable/11/etc/periodic/security/110.neggrpperm 306642 2016-10-03 14:59:32Z asomers $
28202437Strasz#
29202437Strasz
30202437Strasz# If there is a global system configuration file, suck it in.
31202437Strasz#
32202437Straszif [ -r /etc/defaults/periodic.conf ]
33202437Straszthen
34202437Strasz    . /etc/defaults/periodic.conf
35202437Strasz    source_periodic_confs
36202437Straszfi
37202437Strasz
38202437Straszsecurity_daily_compat_var security_status_neggrpperm_enable
39202437Strasz
40202437Straszrc=0
41202437Strasz
42202437Straszif check_yesno_period security_status_neggrpperm_enable
43202437Straszthen
44202437Strasz	echo ""
45202437Strasz	echo 'Checking negative group permissions:'
46212554Spjd	MP=`mount -t ufs,zfs | awk '$0 !~ /no(suid|exec)/ { print $3 }'`
47202437Strasz	n=$(find -sx $MP /dev/null \( ! -fstype local \) -prune -o -type f \
48202437Strasz	    \( \( ! -perm +010 -and -perm +001 \) -or \
49202437Strasz	    \( ! -perm +020 -and -perm +002 \) -or \
50202437Strasz	    \( ! -perm +040 -and -perm +004 \) \) \
51202437Strasz	    -exec ls -liTd \{\} \+ | tee /dev/stderr | wc -l)
52202437Strasz	[ $n -gt 0 ] && rc=1 || rc=0
53212554Spjdfi
54202437Strasz
55202437Straszexit $rc
56202437Strasz