FreeBSD Bugzilla – Attachment 213047 Details for
Bug 245283
sysutils/checkrestart: improve rc script
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Alternate patch to 0.5.0_1 with security periodic script
sysutils-checkrestart-0.5.0_1-alt.patch (text/plain), 5.06 KB, created by
Thomas Hurst
on 2020-04-04 03:36:50 UTC
(
hide
)
Description:
Alternate patch to 0.5.0_1 with security periodic script
Filename:
MIME Type:
Creator:
Thomas Hurst
Created:
2020-04-04 03:36:50 UTC
Size:
5.06 KB
patch
obsolete
>Index: sysutils/checkrestart/Makefile >=================================================================== >--- sysutils/checkrestart/Makefile (revision 530401) >+++ sysutils/checkrestart/Makefile (working copy) >@@ -3,6 +3,7 @@ > PORTNAME= checkrestart > DISTVERSIONPREFIX= v > DISTVERSION= 0.5.0 >+PORTREVISION= 1 > CATEGORIES= sysutils > > MAINTAINER= tom@hur.st >@@ -18,14 +19,14 @@ > > 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> >Index: sysutils/checkrestart/files/checkrestart.in >=================================================================== >--- sysutils/checkrestart/files/checkrestart.in (revision 530401) >+++ sysutils/checkrestart/files/checkrestart.in (working copy) >@@ -6,13 +6,13 @@ > 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 @@ > > 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_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_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 @@ > fi > } > >-checkday() { >- if echo "${daily_checkrestart_weekdays}" | grep -vq '^[1-7, ]*$'; then >- echo "daily_checkrestart_weekdays must have values 1-7" >- exit 2 >- fi >+if check_yesno_period security_checkrestart_enable >+then >+ echo >+ echo 'Checking for stale processes:' >+ checkrestart_start >+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 >- > exit $rc >Index: sysutils/checkrestart/pkg-message >=================================================================== >--- sysutils/checkrestart/pkg-message (revision 530401) >+++ sysutils/checkrestart/pkg-message (working copy) >@@ -4,13 +4,33 @@ > In order to enable periodic(8) checks, set the following in /etc/periodic.conf > > # Required >+security_checkrestart_enable="YES" >+ >+# Optional >+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" > >-# 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 >+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 > } > ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
tom
:
maintainer-approval+
Actions:
View
|
Diff
Attachments on
bug 245283
:
212982
| 213047