aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando ApesteguĂ­a <fernape@FreeBSD.org>2020-04-04 11:58:03 +0000
committerFernando ApesteguĂ­a <fernape@FreeBSD.org>2020-04-04 11:58:03 +0000
commit5ae9a25b2ddb21201390771d5ae9409b98344380 (patch)
tree32c6d03e5e35247ec3f6ebec6d9d11584bb009b9
parenta12b280cb5929b9435b84edc74e4775cbb1b024b (diff)
Notes
-rw-r--r--sysutils/checkrestart/Makefile9
-rw-r--r--sysutils/checkrestart/files/checkrestart.in46
-rw-r--r--sysutils/checkrestart/pkg-message30
3 files changed, 47 insertions, 38 deletions
diff --git a/sysutils/checkrestart/Makefile b/sysutils/checkrestart/Makefile
index a533d89be565..5f0e52ef62e1 100644
--- a/sysutils/checkrestart/Makefile
+++ b/sysutils/checkrestart/Makefile
@@ -3,6 +3,7 @@
PORTNAME= checkrestart
DISTVERSIONPREFIX= v
DISTVERSION= 0.5.0
+PORTREVISION= 1
CATEGORIES= sysutils
MAINTAINER= tom@hur.st
@@ -18,14 +19,14 @@ SUB_FILES= checkrestart
PLIST_FILES= bin/checkrestart \
share/man/man1/checkrestart.1.gz \
- etc/periodic/daily/checkrestart
+ ${PERIODIC_SECURITY}/checkrestart
-PERIODIC_DAILY= etc/periodic/daily
+PERIODIC_SECURITY= etc/periodic/security/
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/checkrestart ${STAGEDIR}${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/checkrestart.1 ${STAGEDIR}${MAN1PREFIX}/share/man/man1
- @${MKDIR} ${STAGEDIR}${PREFIX}/${PERIODIC_DAILY}
- ${INSTALL_SCRIPT} ${WRKDIR}/checkrestart ${STAGEDIR}${PREFIX}/${PERIODIC_DAILY}
+ @${MKDIR} ${STAGEDIR}${PREFIX}/${PERIODIC_SECURITY}
+ ${INSTALL_SCRIPT} ${WRKDIR}/checkrestart ${STAGEDIR}${PREFIX}/${PERIODIC_SECURITY}
.include <bsd.port.mk>
diff --git a/sysutils/checkrestart/files/checkrestart.in b/sysutils/checkrestart/files/checkrestart.in
index 349ed8d44f62..a7fd51870eca 100644
--- a/sysutils/checkrestart/files/checkrestart.in
+++ b/sysutils/checkrestart/files/checkrestart.in
@@ -6,13 +6,13 @@ if [ -r /etc/defaults/periodic.conf ]; then
source_periodic_confs
fi
-: "${daily_checkrestart_enable:=NO}"
-: "${daily_checkrestart_weekdays:=1234567}" # Days of the week to run, Monday=1
-: "${daily_checkrestart_users:=}" # User names or IDs to check
-: "${daily_checkrestart_jails:=}" # Jail names or IDs to check
-: "${daily_checkrestart_procs:=}" # Process names or IDs to check
+: "${security_checkrestart_enable:=NO}"
+: "${security_checkrestart_period:=DAILY}"
+: "${security_checkrestart_users:=}" # User names or IDs to check
+: "${security_checkrestart_jails:=}" # Jail names or IDs to check
+: "${security_checkrestart_procs:=}" # Process names or IDs to check
-checkrestartcmd=/usr/local/bin/checkrestart
+checkrestartcmd=%%PREFIX%%/bin/checkrestart
hflag=""
rc=0
@@ -20,7 +20,7 @@ export COLUMNS=80
checkrestart() {
local result
- result="$(${checkrestartcmd} ${hflag} "$@" -- ${daily_checkrestart_procs} 2>&1)"
+ result="$(${checkrestartcmd} ${hflag} "$@" -- ${security_checkrestart_procs} 2>&1)"
if [ "$result" ]; then
echo "${result}"
rc=3
@@ -29,8 +29,8 @@ checkrestart() {
}
checkrestart_each_user() {
- if [ -n "${daily_checkrestart_users}" ]; then
- for user in ${daily_checkrestart_users}; do
+ if [ -n "${security_checkrestart_users}" ]; then
+ for user in ${security_checkrestart_users}; do
checkrestart -u "${user}" "$@"
done
else
@@ -39,8 +39,8 @@ checkrestart_each_user() {
}
checkrestart_start() {
- if [ -n "${daily_checkrestart_jails}" ]; then
- for jail in ${daily_checkrestart_jails}; do
+ if [ -n "${security_checkrestart_jails}" ]; then
+ for jail in ${security_checkrestart_jails}; do
checkrestart_each_user -j "${jail}"
done
else
@@ -48,23 +48,11 @@ checkrestart_start() {
fi
}
-checkday() {
- if echo "${daily_checkrestart_weekdays}" | grep -vq '^[1-7, ]*$'; then
- echo "daily_checkrestart_weekdays must have values 1-7"
- exit 2
- fi
-
- echo "${daily_checkrestart_weekdays}" | grep -Fq "$(date +%u)"
-}
-
-case "${daily_checkrestart_enable}" in
- [Yy][Ee][Ss])
- if checkday; then
- echo
- echo 'Checking for stale processes:'
- checkrestart_start
- fi
- ;;
-esac
+if check_yesno_period security_checkrestart_enable
+then
+ echo
+ echo 'Checking for stale processes:'
+ checkrestart_start
+fi
exit $rc
diff --git a/sysutils/checkrestart/pkg-message b/sysutils/checkrestart/pkg-message
index dd8510c29198..ea27f981f067 100644
--- a/sysutils/checkrestart/pkg-message
+++ b/sysutils/checkrestart/pkg-message
@@ -4,13 +4,33 @@
In order to enable periodic(8) checks, set the following in /etc/periodic.conf
# Required
-daily_checkrestart_enable="YES"
+security_checkrestart_enable="YES"
# Optional
-daily_checkrestart_weekdays="1 4" # only run on Monday and Thursday
-daily_checkrestart_jails="0 web" # limit to jails 0 and web
-daily_checkrestart_users="root www" # limit to root and www users
-daily_checkrestart_procs="smbd httpd" # limit to samba and httpd
+security_checkrestart_period="DAILY" # or WEEKY, or MONTHLY
+security_checkrestart_jails="0 web" # limit to jails 0 and web
+security_checkrestart_users="root www" # limit to root and www users
+security_checkrestart_procs="smbd httpd" # limit to samba and httpd
+EOM,
+},
+{ type: upgrade,
+ maximum_version: "0.5.0_1",
+ message: <<EOM
+The periodic(8) script is now a security script. All 'daily_checkrestart_'
+instances in /etc/periodic.conf should be changed to 'security_checkrestart_'.
+
+i.e.
+
+daily_checkrestart_enable="YES"
+
+is now:
+
+security_checkrestart_enable="YES"
+
+daily_checkrestart_weekdays is no longer supported. The security period
+mechanism should be used instead:
+
+security_checkrestart_period="DAILY" # or WEEKLY, or MONTHLY
EOM
}
]