161981Sbrian#!/bin/sh
261981Sbrian#
361981Sbrian# This is defaults/periodic.conf - a file full of useful variables that
461981Sbrian# you can set to change the default behaviour of periodic jobs on your
561981Sbrian# system.  You should not edit this file!  Put any overrides into one of the
661981Sbrian# $periodic_conf_files instead and you will be able to update these defaults
761981Sbrian# later without spamming your local configuration information.
861981Sbrian#
961981Sbrian# The $periodic_conf_files files should only contain values which override
1061981Sbrian# values set in this file.  This eases the upgrade path when defaults
1161981Sbrian# are changed and new features are added.
1261981Sbrian#
13140771Skeramida# For a more detailed explanation of all the periodic.conf variables, please
14140771Skeramida# refer to the periodic.conf(5) manual page.
15140771Skeramida#
1661981Sbrian# $FreeBSD: stable/11/etc/defaults/periodic.conf 317857 2017-05-05 21:59:34Z asomers $
1761981Sbrian#
1861981Sbrian
1961981Sbrian# What files override these defaults ?
2061981Sbrianperiodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local"
2161981Sbrian
2261981Sbrian# periodic script dirs
23170085Sdougblocal_periodic="/usr/local/etc/periodic"
2461981Sbrian
25317373Sasomers# Max time to sleep to avoid causing congestion on download servers
26317373Sasomersanticongestion_sleeptime=3600
2761981Sbrian
2861981Sbrian# Daily options
2961981Sbrian
3065843Sbrian# These options are used by periodic(8) itself to determine what to do
3165843Sbrian# with the output of the sub-programs that are run, and where to send
3265843Sbrian# that output.  $daily_output might be set to /var/log/daily.log if you
3365843Sbrian# wish to log the daily output and have the files rotated by newsyslog(8)
3465843Sbrian#
3565843Sbriandaily_output="root"					# user or /file
3665843Sbriandaily_show_success="YES"				# scripts returning 0
3765843Sbriandaily_show_info="YES"					# scripts returning 1
3865843Sbriandaily_show_badconfig="NO"				# scripts returning 2
3965843Sbrian
4061981Sbrian# 100.clean-disks
4161981Sbriandaily_clean_disks_enable="NO"				# Delete files daily
4261981Sbriandaily_clean_disks_files="[#,]* .#* a.out *.core *.CKP .emacs_[0-9]*"
4361981Sbriandaily_clean_disks_days=3				# If older than this
4461981Sbriandaily_clean_disks_verbose="YES"				# Mention files deleted
4561981Sbrian
4661981Sbrian# 110.clean-tmps
4761981Sbriandaily_clean_tmps_enable="NO"				# Delete stuff daily
4861981Sbriandaily_clean_tmps_dirs="/tmp"				# Delete under here
4961981Sbriandaily_clean_tmps_days="3"				# If not accessed for
50174028Sjhbdaily_clean_tmps_ignore=".X*-lock .X11-unix .ICE-unix .font-unix .XIM-unix"
51205509Sjoergdaily_clean_tmps_ignore="$daily_clean_tmps_ignore quota.user quota.group .snap"
52236284Seadlerdaily_clean_tmps_ignore="$daily_clean_tmps_ignore .sujournal"
53174028Sjhb							# Don't delete these
5461981Sbriandaily_clean_tmps_verbose="YES"				# Mention files deleted
5561981Sbrian
5661981Sbrian# 120.clean-preserve
5761981Sbriandaily_clean_preserve_enable="YES"			# Delete files daily
5861981Sbriandaily_clean_preserve_days=7				# If not modified for
5961981Sbriandaily_clean_preserve_verbose="YES"			# Mention files deleted
6061981Sbrian
6161981Sbrian# 130.clean-msgs
6261981Sbriandaily_clean_msgs_enable="YES"				# Delete msgs daily
6361981Sbriandaily_clean_msgs_days=					# If not modified for
6461981Sbrian
6561981Sbrian# 140.clean-rwho
6661981Sbriandaily_clean_rwho_enable="YES"				# Delete rwho daily
6761981Sbriandaily_clean_rwho_days=7					# If not modified for
6861981Sbriandaily_clean_rwho_verbose="YES"				# Mention files deleted
6961981Sbrian
7061981Sbrian# 150.clean-hoststat
71108959Swollmandaily_clean_hoststat_enable="YES"			# Purge sendmail host
72108959Swollman							# status cache daily
7361981Sbrian
7461981Sbrian# 200.backup-passwd
7561981Sbriandaily_backup_passwd_enable="YES"			# Backup passwd & group
7661981Sbrian
7761981Sbrian# 210.backup-aliases
7861981Sbriandaily_backup_aliases_enable="YES"			# Backup mail aliases
7961981Sbrian
8061981Sbrian# 300.calendar
8161981Sbriandaily_calendar_enable="NO"				# Run calendar -a
8261981Sbrian
8361981Sbrian# 310.accounting
8461981Sbriandaily_accounting_enable="YES"				# Rotate acct files
8562054Sbriandaily_accounting_compress="NO"				# Gzip rotated files
8677496Sbriandaily_accounting_flags=-q				# Flags to /usr/sbin/sa
8777492Sbriandaily_accounting_save=3					# How many files to save
8861981Sbrian
8961981Sbrian# 330.news
9061981Sbriandaily_news_expire_enable="YES"				# Run news.expire
9161981Sbrian
9261981Sbrian# 400.status-disks
9361981Sbriandaily_status_disks_enable="YES"				# Check disk status
94279952Sjhbdaily_status_disks_df_flags="-l -h"			# df(1) flags for check
9561981Sbrian
96249095Smav# 401.status-graid
97249095Smavdaily_status_graid_enable="NO"				# Check graid(8)
98249095Smav
99168412Spjd# 404.status-zfs
100168412Spjddaily_status_zfs_enable="NO"				# Check ZFS
101231171Sgjbdaily_status_zfs_zpool_list_enable="YES"		# List ZFS pools
102168412Spjd
103154304Swollman# 406.status-gmirror
104154304Swollmandaily_status_gmirror_enable="NO"			# Check gmirror(8)
105154304Swollman
106156216Sbrueffer# 407.status-graid3
107156216Sbruefferdaily_status_graid3_enable="NO" 			# Check graid3(8)
108156216Sbrueffer
109156216Sbrueffer# 408.status-gstripe
110156216Sbruefferdaily_status_gstripe_enable="NO"			# Check gstripe(8)
111156216Sbrueffer
112156216Sbrueffer# 409.status-gconcat
113156216Sbruefferdaily_status_gconcat_enable="NO"			# Check gconcat(8)
114156216Sbrueffer
115317857Sasomers# 410.status-mfi
116317857Sasomersdaily_status_mfi_enable="NO"				# Check mfiutil(8)
117317857Sasomers
11861981Sbrian# 420.status-network
11961981Sbriandaily_status_network_enable="YES"			# Check network status
12061981Sbriandaily_status_network_usedns="YES"			# DNS lookups are ok
121280721Sjhbdaily_status_network_netstat_flags="-d"			# netstat(1) flags
12261981Sbrian
123290252Sngie# 430.status-uptime
124290252Sngiedaily_status_uptime_enable="YES"			# Check system uptime
12561981Sbrian
12661981Sbrian# 440.status-mailq
12761981Sbriandaily_status_mailq_enable="YES"				# Check mail status
12861981Sbriandaily_status_mailq_shorten="NO"				# Shorten output
12994342Sgshapirodaily_status_include_submit_mailq="YES"			# Also submit queue
13061981Sbrian
13161981Sbrian# 450.status-security
13261981Sbriandaily_status_security_enable="YES"			# Security check
133254974Sjlh# See also "Security options" below for more options
134254974Sjlhdaily_status_security_inline="NO"			# Run inline ?
135254974Sjlhdaily_status_security_output="root"			# user or /file
13661981Sbrian
13761981Sbrian# 460.status-mail-rejects
13861981Sbriandaily_status_mail_rejects_enable="YES"			# Check mail rejects
13962274Sbriandaily_status_mail_rejects_logs=3			# How many logs to check
140175153Sddsdaily_status_mail_rejects_shorten="NO"			# Shorten output
14161981Sbrian
142294773Scy# 480.leapfile-ntpd
143301295Scydaily_ntpd_leapfile_enable="YES"			# Fetch NTP leapfile
144294773Scy
145169517Smaxim# 480.status-ntpd
146169517Smaximdaily_status_ntpd_enable="NO"				# Check NTP status
147169517Smaxim
14872677Speter# 500.queuerun
14972677Speterdaily_queuerun_enable="YES"				# Run mail queue
15094342Sgshapirodaily_submit_queuerun="YES"				# Also submit queue
15172677Speter
152277216Sgjb# 510.status-world-kernel
153277216Sgjbdaily_status_world_kernel="YES"				# Check the running
154277216Sgjb							# userland/kernel version
155277216Sgjb
156226471Sse# 800.scrub-zfs
157226471Ssedaily_scrub_zfs_enable="NO"
158226471Ssedaily_scrub_zfs_pools=""			# empty string selects all pools
159226865Sdelphijdaily_scrub_zfs_default_threshold="35"		# days between scrubs
160226865Sdelphij#daily_scrub_zfs_${poolname}_threshold="35"	# pool specific threshold
161226471Sse
16261981Sbrian# 999.local
16361981Sbriandaily_local="/etc/daily.local"				# Local scripts
16461981Sbrian
16561981Sbrian
166255169Sjlh# Weekly options
167255169Sjlh
168255169Sjlh# These options are used by periodic(8) itself to determine what to do
169255169Sjlh# with the output of the sub-programs that are run, and where to send
170255169Sjlh# that output.  $weekly_output might be set to /var/log/weekly.log if you
171255169Sjlh# wish to log the weekly output and have the files rotated by newsyslog(8)
172255169Sjlh#
173255169Sjlhweekly_output="root"					# user or /file
174255169Sjlhweekly_show_success="YES"				# scripts returning 0
175255169Sjlhweekly_show_info="YES"					# scripts returning 1
176255169Sjlhweekly_show_badconfig="NO"				# scripts returning 2
177255169Sjlh
178255169Sjlh# 310.locate
179255169Sjlhweekly_locate_enable="YES"				# Update locate weekly
180255169Sjlh
181255169Sjlh# 320.whatis
182255169Sjlhweekly_whatis_enable="YES"				# Update whatis weekly
183255169Sjlh
184255169Sjlh# 330.catman
185255169Sjlhweekly_catman_enable="NO"				# Preformat man pages
186255169Sjlh
187255169Sjlh# 340.noid
188255169Sjlhweekly_noid_enable="NO"					# Find unowned files
189255169Sjlhweekly_noid_dirs="/"					# Look here
190255169Sjlh
191255169Sjlh# 450.status-security
192255169Sjlhweekly_status_security_enable="YES"			# Security check
193255169Sjlh# See also "Security options" above for more options
194255169Sjlhweekly_status_security_inline="NO"			# Run inline ?
195255169Sjlhweekly_status_security_output="root"			# user or /file
196255169Sjlh
197255169Sjlh# 999.local
198255169Sjlhweekly_local="/etc/weekly.local"			# Local scripts
199255169Sjlh
200255169Sjlh
201255169Sjlh# Monthly options
202255169Sjlh
203255169Sjlh# These options are used by periodic(8) itself to determine what to do
204255169Sjlh# with the output of the sub-programs that are run, and where to send
205255169Sjlh# that output.  $monthly_output might be set to /var/log/monthly.log if you
206255169Sjlh# wish to log the monthly output and have the files rotated by newsyslog(8)
207255169Sjlh#
208255169Sjlhmonthly_output="root"					# user or /file
209255169Sjlhmonthly_show_success="YES"				# scripts returning 0
210255169Sjlhmonthly_show_info="YES"					# scripts returning 1
211255169Sjlhmonthly_show_badconfig="NO"				# scripts returning 2
212255169Sjlh
213255169Sjlh# 200.accounting
214255169Sjlhmonthly_accounting_enable="YES"				# Login accounting
215255169Sjlh
216255169Sjlh# 450.status-security
217255169Sjlhmonthly_status_security_enable="YES"			# Security check
218255169Sjlh# See also "Security options" above for more options
219255169Sjlhmonthly_status_security_inline="NO"			# Run inline ?
220255169Sjlhmonthly_status_security_output="root"			# user or /file
221255169Sjlh
222255169Sjlh# 999.local
223255169Sjlhmonthly_local="/etc/monthly.local"			# Local scripts
224255169Sjlh
225255169Sjlh
22687514Scjc# Security options
22787514Scjc
228300356Sasomerssecurity_show_success="YES"				# scripts returning 0
229300356Sasomerssecurity_show_info="YES"				# scripts returning 1
230300356Sasomerssecurity_show_badconfig="NO"				# scripts returning 2
231300356Sasomers
232101607Sfanf# These options are used by the security periodic(8) scripts spawned in
233254974Sjlh# daily and weekly 450.status-security.
234254974Sjlhsecurity_status_logdir="/var/log"			# Directory for logs
235254974Sjlhsecurity_status_diff_flags="-b -u"			# flags for diff output
23687514Scjc
237255169Sjlh# Each of the security_status_*_period options below can have one of the
238254974Sjlh# following values:
239255169Sjlh# - NO: do not run at all
240254974Sjlh# - daily: only run during the daily security status
241254974Sjlh# - weekly: only run during the weekly security status
242255169Sjlh# - monthly: only run during the monthly security status
243255169Sjlh# Note that if periodic security scripts are run from crontab(5) directly,
244255169Sjlh# they will be run unless _enable or _period is set to "NO".
245254974Sjlh
24687514Scjc# 100.chksetuid
247254974Sjlhsecurity_status_chksetuid_enable="YES"
248254974Sjlhsecurity_status_chksetuid_period="daily"
24987514Scjc
250215213Sbrooks# 110.neggrpperm
251254974Sjlhsecurity_status_neggrpperm_enable="YES"
252254974Sjlhsecurity_status_neggrpperm_period="daily"
253215213Sbrooks
25487514Scjc# 200.chkmounts
255254974Sjlhsecurity_status_chkmounts_enable="YES"
256254974Sjlhsecurity_status_chkmounts_period="daily"
257254974Sjlh#security_status_chkmounts_ignore="^amd:"		# Don't check matching
25887514Scjc							# FS types
259254974Sjlhsecurity_status_noamd="NO"				# Don't check amd mounts
26087514Scjc
26187514Scjc# 300.chkuid0
262254974Sjlhsecurity_status_chkuid0_enable="YES"
263254974Sjlhsecurity_status_chkuid0_period="daily"
26487514Scjc
26587514Scjc# 400.passwdless
266254974Sjlhsecurity_status_passwdless_enable="YES"
267254974Sjlhsecurity_status_passwdless_period="daily"
26887514Scjc
269161602Strhodes# 410.logincheck
270254974Sjlhsecurity_status_logincheck_enable="YES"
271254974Sjlhsecurity_status_logincheck_period="daily"
272161602Strhodes
27387514Scjc# 500.ipfwdenied
274254974Sjlhsecurity_status_ipfwdenied_enable="YES"
275254974Sjlhsecurity_status_ipfwdenied_period="daily"
27687514Scjc
277105937Sthomas# 510.ipfdenied
278254974Sjlhsecurity_status_ipfdenied_enable="YES"
279254974Sjlhsecurity_status_ipfdenied_period="daily"
280105937Sthomas
281138061Smlaier# 520.pfdenied
282254974Sjlhsecurity_status_pfdenied_enable="YES"
283254974Sjlhsecurity_status_pfdenied_period="daily"
284138061Smlaier
28587514Scjc# 550.ipfwlimit
286254974Sjlhsecurity_status_ipfwlimit_enable="YES"
287254974Sjlhsecurity_status_ipfwlimit_period="daily"
28887514Scjc
289128473Sdarrenr# 610.ipf6denied
290254974Sjlhsecurity_status_ipf6denied_enable="YES"
291254974Sjlhsecurity_status_ipf6denied_period="daily"
292128473Sdarrenr
29387514Scjc# 700.kernelmsg
294254974Sjlhsecurity_status_kernelmsg_enable="YES"
295254974Sjlhsecurity_status_kernelmsg_period="daily"
29687514Scjc
29787514Scjc# 800.loginfail
298254974Sjlhsecurity_status_loginfail_enable="YES"
299254974Sjlhsecurity_status_loginfail_period="daily"
30087514Scjc
30187514Scjc# 900.tcpwrap
302254974Sjlhsecurity_status_tcpwrap_enable="YES"
303254974Sjlhsecurity_status_tcpwrap_period="daily"
30487514Scjc
30587514Scjc
30661981Sbrian
30761981Sbrian# Define source_periodic_confs, the mechanism used by /etc/periodic/*/*
30861981Sbrian# scripts to source defaults/periodic.conf overrides safely.
30961981Sbrian
31061981Sbrianif [ -z "${source_periodic_confs_defined}" ]; then
31161981Sbrian        source_periodic_confs_defined=yes
312254974Sjlh
313317373Sasomers	# Sleep for a random amount of time in order to mitigate the thundering
314317373Sasomers	# herd problem of multiple hosts running periodic simultaneously.
315317373Sasomers	# Will not sleep when used interactively.
316317373Sasomers	# Will sleep at most once per invocation of periodic
317317373Sasomers	anticongestion() {
318317373Sasomers		[ -n "$PERIODIC_IS_INTERACTIVE" ] && return
319317373Sasomers		if [ -f "$PERIODIC_ANTICONGESTION_FILE" ]; then
320317373Sasomers			rm -f $PERIODIC_ANTICONGESTION_FILE
321317373Sasomers			sleep `jot -r 1 0 ${anticongestion_sleeptime}`
322317373Sasomers		fi
323317373Sasomers	}
324317373Sasomers
325254974Sjlh	# Compatibility with old daily variable names.
326254974Sjlh	# They can be removed in stable/11.
327254974Sjlh	security_daily_compat_var() {
328254974Sjlh		local var=$1 dailyvar value
329254974Sjlh
330257361Sjlh		dailyvar=daily_status_security${var#security_status}
331254974Sjlh		periodvar=${var%enable}period
332254974Sjlh		eval value=\"\$$dailyvar\"
333254974Sjlh		[ -z "$value" ] && return
334254974Sjlh		echo "Warning: Variable \$$dailyvar is deprecated," \
335254974Sjlh		    "use \$$var instead." >&2
336254974Sjlh		case "$value" in
337254974Sjlh		[Yy][Ee][Ss])
338290515Sjilles			eval $var=YES
339290515Sjilles			eval $periodvar=daily
340254974Sjlh			;;
341254974Sjlh		*)
342257364Sjlh			eval $var=\"$value\"
343254974Sjlh			;;
344254974Sjlh		esac
345254974Sjlh	}
346254974Sjlh
347254974Sjlh	check_yesno_period() {
348254974Sjlh		local var="$1" periodvar value period
349254974Sjlh
350254974Sjlh		eval value=\"\$$var\"
351254974Sjlh		case "$value" in
352254974Sjlh		[Yy][Ee][Ss]) ;;
353254974Sjlh		*) return 1 ;;
354254974Sjlh		esac
355254974Sjlh
356254974Sjlh		periodvar=${var%enable}period
357254974Sjlh		eval period=\"\$$periodvar\"
358254974Sjlh		case "$PERIODIC" in
359254974Sjlh		"security daily")
360254974Sjlh			case "$period" in
361254974Sjlh			[Dd][Aa][Ii][Ll][Yy]) return 0 ;;
362254974Sjlh			*) return 1 ;;
363254974Sjlh			esac
364254974Sjlh			;;
365254974Sjlh		"security weekly")
366254974Sjlh			case "$period" in
367254974Sjlh			[Ww][Ee][Ee][Kk][Ll][Yy]) return 0 ;;
368254974Sjlh			*) return 1 ;;
369254974Sjlh			esac
370254974Sjlh			;;
371254974Sjlh		"security monthly")
372254974Sjlh			case "$period" in
373254974Sjlh			[Mm][Oo][Nn][Tt][Hh][Ll][Yy]) return 0 ;;
374254974Sjlh			*) return 1 ;;
375254974Sjlh			esac
376254974Sjlh			;;
377254974Sjlh		security)
378254974Sjlh			# Run directly from crontab(5).
379254974Sjlh			case "$period" in
380254974Sjlh			[Nn][Oo]) return 1 ;;
381254974Sjlh			*) return 0 ;;
382254974Sjlh			esac
383254974Sjlh			;;
384285444Sjlh                '')
385285444Sjlh                        # Script run manually.
386285444Sjlh                        return 0
387285444Sjlh                        ;;
388254974Sjlh		*)
389285444Sjlh			echo "ASSERTION FAILED: Unexpected value for" \
390254974Sjlh			    "\$PERIODIC: '$PERIODIC'" >&2
391254974Sjlh			exit 127
392254974Sjlh			;;
393254974Sjlh		esac
394254974Sjlh	}
395254974Sjlh
396238416Skevlo        source_periodic_confs() {
39761981Sbrian                local i sourced_files
39861981Sbrian
39961981Sbrian                for i in ${periodic_conf_files}; do
40061981Sbrian                        case ${sourced_files} in
40161981Sbrian                        *:$i:*)
40261981Sbrian                                ;;
40361981Sbrian                        *)
40461981Sbrian                                sourced_files="${sourced_files}:$i:"
40561981Sbrian                                [ -r $i ] && . $i
40661981Sbrian                                ;;
40761981Sbrian                        esac
40861981Sbrian                done
40961981Sbrian        }
41061981Sbrianfi
411