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