200.chkmounts revision 184265
1227983Stheraven#!/bin/sh -
2227983Stheraven#
3236442Sdim# Copyright (c) 2001  The FreeBSD Project
4236442Sdim# All rights reserved.
5236442Sdim#
6236442Sdim# Redistribution and use in source and binary forms, with or without
7227983Stheraven# modification, are permitted provided that the following conditions
8227983Stheraven# are met:
9227983Stheraven# 1. Redistributions of source code must retain the above copyright
10236442Sdim#    notice, this list of conditions and the following disclaimer.
11236442Sdim# 2. Redistributions in binary form must reproduce the above copyright
12253917Sdim#    notice, this list of conditions and the following disclaimer in the
13227983Stheraven#    documentation and/or other materials provided with the distribution.
14236442Sdim#
15236442Sdim# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16236442Sdim# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17236442Sdim# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18236442Sdim# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19236442Sdim# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20236442Sdim# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21236442Sdim# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22236442Sdim# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23236442Sdim# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24236442Sdim# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25236442Sdim# SUCH DAMAGE.
26236442Sdim#
27236442Sdim# $FreeBSD: head/etc/periodic/security/200.chkmounts 184265 2008-10-25 18:45:40Z ed $
28262801Sdim#
29236442Sdim
30236442Sdim# Show changes in the way filesystems are mounted
31262801Sdim#
32236442Sdim
33236442Sdim# If there is a global system configuration file, suck it in.
34236442Sdim#
35236442Sdimif [ -r /etc/defaults/periodic.conf ]
36236442Sdimthen
37236442Sdim    . /etc/defaults/periodic.conf
38236442Sdim    source_periodic_confs
39236442Sdimfi
40227983Stheraven
41239680Sdim. /etc/periodic/security/security.functions
42239680Sdim
43239680Sdimignore="${daily_status_security_chkmounts_ignore}"
44239680Sdimrc=0
45239680Sdim
46239680Sdimcase "$daily_status_security_chkmounts_enable" in
47239680Sdim    [Yy][Ee][Ss])
48239680Sdim	case "$daily_status_security_noamd" in
49239680Sdim	    [Yy][Ee][Ss])
50239680Sdim		ignore="${ignore}|^amd:"
51239680Sdim	esac
52239680Sdim	[ -n "$ignore" ] && cmd="egrep -v ${ignore#|}" || cmd=cat
53239680Sdim	mount -p | sort | ${cmd} |
54239680Sdim	  check_diff mount - "${host} changes in mounted filesystems:"
55239680Sdim	rc=$?;;
56239680Sdim    *)	rc=0;;
57236442Sdimesac
58239680Sdim
59242472Sdimexit "$rc"
60239680Sdim