xref: /freebsd/usr.sbin/periodic/etc/weekly/450.status-security (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
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 "$weekly_status_security_enable" in
15    [Yy][Ee][Ss])
16	echo ""
17	echo "Security check:"
18
19	case "$weekly_status_security_inline" in
20	    [Yy][Ee][Ss])
21		weekly_status_security_output="";;
22	esac
23
24	export security_output="${weekly_status_security_output}"
25	rc=0
26	case "${weekly_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