xref: /freebsd/usr.sbin/periodic/etc/daily/450.status-security (revision a7623790fb345e6dc986dfd31df0ace115e6f2e4)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# If there is a global system configuration file, suck it in.
7#
8if [ -r /etc/defaults/periodic.conf ]
9then
10    . /etc/defaults/periodic.conf
11    source_periodic_confs
12fi
13
14case "$daily_status_security_enable" in
15    [Yy][Ee][Ss])
16	echo ""
17	echo "Security check:"
18
19	case "$daily_status_security_inline" in
20	    [Yy][Ee][Ss])
21		daily_status_security_output="";;
22	esac
23
24	export security_output="${daily_status_security_output}"
25	rc=0
26	case "${daily_status_security_output}" in
27	    "")
28		if tempfile=`mktemp ${TMPDIR:-/tmp}/450.status-security.XXXXXX`
29		then
30			periodic security > $tempfile || rc=3
31			if [ -s "$tempfile" ]; then
32				cat "$tempfile"
33				rc=3
34			fi
35			rm -f "$tempfile"
36		fi;;
37	    /*)
38		echo "    (output logged separately)"
39		periodic security || rc=3;;
40	    *)
41		echo "    (output mailed separately)"
42		periodic security || rc=3;;
43	esac;;
44    *)  rc=0;;
45esac
46
47exit $rc
48