Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Apr 2017 01:37:03 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316548 - in head/etc/periodic: daily monthly weekly
Message-ID:  <201704060137.v361b3Q5080989@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Thu Apr  6 01:37:03 2017
New Revision: 316548
URL: https://svnweb.freebsd.org/changeset/base/316548

Log:
  Quiet 450.status-security when *_inline="YES"
  
  Previously, 450.status-security would always set rc=3 in inline mode,
  because it doesn't know whether "periodic security" is going to find
  anything interesting. But this annoyingly results in daily reports that
  simply say "Security check: \n\n-- End of daily output --".
  
  This change fixes that by testing whether "periodic security" printed
  anything, and setting 450.status-security's exit status to 3 if it did. An
  alternative would be to change the exit status of periodic(8) to be the
  worst of its scripts' exit statuses, but that would be a more intrusive
  change.
  
  Reviewed by:	brian
  MFC after:	3 weeks
  Differential Revision:	https://reviews.freebsd.org/D10267

Modified:
  head/etc/periodic/daily/450.status-security
  head/etc/periodic/monthly/450.status-security
  head/etc/periodic/weekly/450.status-security

Modified: head/etc/periodic/daily/450.status-security
==============================================================================
--- head/etc/periodic/daily/450.status-security	Thu Apr  6 01:35:42 2017	(r316547)
+++ head/etc/periodic/daily/450.status-security	Thu Apr  6 01:37:03 2017	(r316548)
@@ -22,19 +22,25 @@ case "$daily_status_security_enable" in
 	esac
 
 	export security_output="${daily_status_security_output}"
+	rc=0
 	case "${daily_status_security_output}" in
 	    "")
-		rc=3;;
+		if tempfile=`mktemp ${TMPDIR:-/tmp}/450.status-security.XXXXXX`
+		then
+			periodic security > $tempfile || rc=3
+			if [ -s "$tempfile" ]; then
+				cat "$tempfile"
+				rc=3
+			fi
+			rm -f "$tempfile"
+		fi;;
 	    /*)
 		echo "    (output logged separately)"
-		rc=0;;
+		periodic security || rc=3;;
 	    *)
 		echo "    (output mailed separately)"
-		rc=0;;
-	esac
-
-	periodic security || rc=3;;
-
+		periodic security || rc=3;;
+	esac;;
     *)  rc=0;;
 esac
 

Modified: head/etc/periodic/monthly/450.status-security
==============================================================================
--- head/etc/periodic/monthly/450.status-security	Thu Apr  6 01:35:42 2017	(r316547)
+++ head/etc/periodic/monthly/450.status-security	Thu Apr  6 01:37:03 2017	(r316548)
@@ -22,19 +22,25 @@ case "$monthly_status_security_enable" i
 	esac
 
 	export security_output="${monthly_status_security_output}"
+	rc=0
 	case "${monthly_status_security_output}" in
 	    "")
-		rc=3;;
+		if tempfile=`mktemp ${TMPDIR:-/tmp}/450.status-security.XXXXXX`
+		then
+			periodic security > $tempfile || rc=3
+			if [ -s "$tempfile" ]; then
+				cat "$tempfile"
+				rc=3
+			fi
+			rm -f "$tempfile"
+		fi;;
 	    /*)
 		echo "    (output logged separately)"
-		rc=0;;
+		periodic security || rc=3;;
 	    *)
 		echo "    (output mailed separately)"
-		rc=0;;
-	esac
-
-	periodic security || rc=3;;
-
+		periodic security || rc=3;;
+	esac;;
     *)  rc=0;;
 esac
 

Modified: head/etc/periodic/weekly/450.status-security
==============================================================================
--- head/etc/periodic/weekly/450.status-security	Thu Apr  6 01:35:42 2017	(r316547)
+++ head/etc/periodic/weekly/450.status-security	Thu Apr  6 01:37:03 2017	(r316548)
@@ -22,19 +22,25 @@ case "$weekly_status_security_enable" in
 	esac
 
 	export security_output="${weekly_status_security_output}"
+	rc=0
 	case "${weekly_status_security_output}" in
 	    "")
-		rc=3;;
+		if tempfile=`mktemp ${TMPDIR:-/tmp}/450.status-security.XXXXXX`
+		then
+			periodic security > $tempfile || rc=3
+			if [ -s "$tempfile" ]; then
+				cat "$tempfile"
+				rc=3
+			fi
+			rm -f "$tempfile"
+		fi;;
 	    /*)
 		echo "    (output logged separately)"
-		rc=0;;
+		periodic security || rc=3;;
 	    *)
 		echo "    (output mailed separately)"
-		rc=0;;
-	esac
-
-	periodic security || rc=3;;
-
+		periodic security || rc=3;;
+	esac;;
     *)  rc=0;;
 esac
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704060137.v361b3Q5080989>