aboutsummaryrefslogtreecommitdiff
path: root/etc/periodic/weekly
diff options
context:
space:
mode:
authorJeremie Le Hen <jlh@FreeBSD.org>2013-08-27 21:20:28 +0000
committerJeremie Le Hen <jlh@FreeBSD.org>2013-08-27 21:20:28 +0000
commit69b55c23cb93350a21cd39c317881cda0b9187ca (patch)
treeaeca29c177cf44d51cbba1cb6a179a3bb74302ef /etc/periodic/weekly
parentf729ede69e0e05c8b11660bb2bc6b87b800b7dbb (diff)
downloadsrc-69b55c23cb93350a21cd39c317881cda0b9187ca.tar.gz
src-69b55c23cb93350a21cd39c317881cda0b9187ca.zip
Make the period of each periodic security script configurable.
There are now six additional variables weekly_status_security_enable weekly_status_security_inline weekly_status_security_output monthly_status_security_enable monthly_status_security_inline monthly_status_security_output alongside their existing daily counterparts. They all have the same default values. All other "daily_status_security_${scriptname}_${whatever}" variables have been renamed to "security_status_${name}_${whatever}". A compatibility shim has been introduced for the old variable names, which we will be able to remove in 11.0-RELEASE. "security_status_${name}_enable" is still a boolean but a new "security_status_${name}_period" allows to define the period of each script. The value is one of "daily" (the default for backward compatibility), "weekly", "monthly" and "NO". Note that when the security periodic scripts are run directly from crontab(5) (as opposed to being called by daily or weekly periodic scripts), they will run unless the test is explicitely disabled with a "NO", either for in the "_enable" or the "_period" variable. When the security output is not inlined, the mail subject has been changed from "$host $arg run output" to "$host $arg $period run output". For instance: myfbsd security run output -> myfbsd security daily run output I don't think this is considered as a stable API, but feel free to correct me if I'm wrong. Finally, I will rearrange periodic.conf(5) and default/periodic.conf to put the security options in their own section. I left them in place for this commit to make reviewing easier. Reviewed by: hackers@
Notes
Notes: svn path=/head/; revision=254974
Diffstat (limited to 'etc/periodic/weekly')
-rwxr-xr-xetc/periodic/weekly/450.status-security41
-rw-r--r--etc/periodic/weekly/Makefile1
2 files changed, 42 insertions, 0 deletions
diff --git a/etc/periodic/weekly/450.status-security b/etc/periodic/weekly/450.status-security
new file mode 100755
index 000000000000..513fbda7b60d
--- /dev/null
+++ b/etc/periodic/weekly/450.status-security
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
+
+case "$weekly_status_security_enable" in
+ [Yy][Ee][Ss])
+ echo ""
+ echo "Security check:"
+
+ case "$weekly_status_security_inline" in
+ [Yy][Ee][Ss])
+ weekly_status_security_output="";;
+ esac
+
+ export security_output="${weekly_status_security_output}"
+ case "${weekly_status_security_output}" in
+ "")
+ rc=3;;
+ /*)
+ echo " (output logged separately)"
+ rc=0;;
+ *)
+ echo " (output mailed separately)"
+ rc=0;;
+ esac
+
+ periodic security || rc=3;;
+
+ *) rc=0;;
+esac
+
+exit $rc
diff --git a/etc/periodic/weekly/Makefile b/etc/periodic/weekly/Makefile
index 7f2eae22de3e..057653d590f3 100644
--- a/etc/periodic/weekly/Makefile
+++ b/etc/periodic/weekly/Makefile
@@ -3,6 +3,7 @@
.include <bsd.own.mk>
FILES= 340.noid \
+ 450.status-security \
999.local
# NB: keep these sorted by MK_* knobs