diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5 index 46174da2772a..ef80578e5372 100644 --- a/share/man/man5/periodic.conf.5 +++ b/share/man/man5/periodic.conf.5 @@ -1,1078 +1,1078 @@ .\"- .\" Copyright (c) 2000 Brian Somers .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd November 7, 2020 .Dt PERIODIC.CONF 5 .Os .Sh NAME .Nm periodic.conf .Nd periodic job configuration information .Sh DESCRIPTION The file .Nm contains a description of how daily, weekly and monthly system maintenance jobs should run. It resides in the .Pa /etc/defaults directory and parts may be overridden by a file of the same name in .Pa /etc , which itself may be overridden by the .Pa /etc/periodic.conf.local file. .Pp The .Nm file is actually sourced as a shell script from each of the periodic scripts and is intended to simply provide default configuration variables. .Pp The following variables are used by .Xr periodic 8 itself: .Bl -tag -offset 4n -width 2n .It Va local_periodic .Pq Vt str List of directories to search for periodic scripts. This list is always prefixed with .Pa /etc/periodic , and is only used when an argument to .Xr periodic 8 is not an absolute directory name. .It Ao Ar dir Ac Ns Va _output .Pq Vt path No or Vt list What to do with the output of the scripts executed from the directory .Ar dir . If this variable is set to an absolute path name, output is logged to that file, otherwise it is taken as one or more space separated email addresses and mailed to those users. If this variable is not set or is empty, output is sent to standard output. .Pp For an unattended machine, suitable values for .Va daily_output , .Va weekly_output , and .Va monthly_output might be .Dq Li /var/log/daily.log , .Dq Li /var/log/weekly.log , and .Dq Li /var/log/monthly.log respectively, as .Xr newsyslog 8 will rotate these files (if they exists) at the appropriate times. .It Ao Ar dir Ac Ns Va _show_success .It Ao Ar dir Ac Ns Va _show_info .It Ao Ar dir Ac Ns Va _show_badconfig .Pq Vt bool These variables control whether .Xr periodic 8 will mask the output of the executed scripts based on their return code (where .Ar dir is the base directory name in which each script resides). If the return code of a script is .Sq 0 and .Ao Ar dir Ac Ns Va _show_success is set to .Dq Li NO , .Xr periodic 8 will mask the script's output. If the return code of a script is .Sq 1 and .Ao Ar dir Ac Ns Va _show_info is set to .Dq Li NO , .Xr periodic 8 will mask the script's output. If the return code of a script is .Sq 2 and .Ao Ar dir Ac Ns Va _show_badconfig is set to .Dq Li NO , .Xr periodic 8 will mask the script's output. If these variables are set to neither .Dq Li YES nor .Dq Li NO , they default to .Dq Li YES , .Dq Li YES and .Dq Li NO respectively. .Pp Refer to the .Xr periodic 8 manual page for how script return codes are interpreted. .It Va anticongestion_sleeptime .Pq Vt int The maximum number of seconds to randomly sleep in order to smooth bursty loads on a shared resource, such as a download mirror. .El .Pp The following variables are used by the standard scripts that reside in .Pa /etc/periodic/daily : .Bl -tag -offset 4n -width 2n .It Va daily_clean_disks_enable .Pq Vt bool Set to .Dq Li YES if you want to remove all files matching .Va daily_clean_disks_files daily. .It Va daily_clean_disks_files .Pq Vt str Set to a list of file names to match. Wild cards are permitted. .It Va daily_clean_disks_days .Pq Vt num When .Va daily_clean_disks_enable is set to .Dq Li YES , this must also be set to the number of days old that a file's access and modification times must be before it is deleted. .It Va daily_clean_disks_verbose .Pq Vt bool Set to .Dq Li YES if you want the removed files to be reported in your daily output. .It Va daily_clean_tmps_enable .Pq Vt bool Set to .Dq Li YES if you want to clear temporary directories daily. .It Va daily_clean_tmps_dirs .Pq Vt str Set to the list of directories to clear if .Va daily_clean_tmps_enable is set to .Dq Li YES . .It Va daily_clean_tmps_days .Pq Vt num When .Va daily_clean_tmps_enable is set, this must also be set to the number of days old that a file's access and modification times must be before it is deleted. .It Va daily_clean_tmps_ignore .Pq Vt str Set to the list of files that should not be deleted when .Va daily_clean_tmps_enable is set to .Dq Li YES . Wild card characters are permitted. .It Va daily_clean_tmps_verbose .Pq Vt bool Set to .Dq Li YES if you want the removed files to be reported in your daily output. .It Va daily_clean_preserve_enable .Pq Vt bool Set to .Dq Li YES if you wish to remove old files from .Pa /var/preserve . .It Va daily_clean_preserve_days .Pq Vt num Set to the number of days that files must not have been modified before they are deleted. .It Va daily_clean_preserve_verbose .Pq Vt bool Set to .Dq Li YES if you want the removed files to be reported in your daily output. .It Va daily_clean_msgs_enable .Pq Vt bool Set to .Dq Li YES if you wish old system messages to be purged. .It Va daily_clean_msgs_days .Pq Vt num Set to the number of days that files must not have been modified before they are deleted. If this variable is left blank, the .Xr msgs 1 default is used. .It Va daily_clean_rwho_enable .Pq Vt bool Set to .Dq Li YES if you wish old files in .Pa /var/who to be purged. .It Va daily_clean_rwho_days .Pq Vt num Set to the number of days that files must not have been modified before they are deleted. .It Va daily_clean_rwho_verbose .Pq Vt bool Set to .Dq Li YES if you want the removed files to be reported in your daily output. .It Va daily_clean_hoststat_enable .Pq Vt bool Set to .Dq Li YES to run .Nm sendmail Fl bH to automatically purge stale entries from .Xr sendmail 8 Ns 's host status cache. Files will be deleted using the same criteria as .Xr sendmail 8 would normally use when determining whether to believe the cached information, as configured in .Pa /etc/mail/sendmail.cf . .It Va daily_backup_efi_enable .Pq Vt bool Set to .Dq Li YES to create backup of EFI System Partition (ESP). .It Va daily_backup_gmirror_enable .Pq Vt bool Set to .Dq Li YES to create backup of gmirror information (i.e., output of .Nm gmirror Cm list ) , see .Xr gmirror 8 . .It Va daily_backup_gmirror_verbose .Pq Vt bool Set to .Dq Li YES to report a diff between the new backup and the existing backup in the daily output. .It Va daily_backup_gpart_enable .Pq Vt bool Set to .Dq Li YES to create backups of partition tables, and bootcode partition contents. .It Va daily_backup_gpart_verbose .Pq Vt bool Set to .Dq Li YES to be verbose if existing backups for kern.geom.conftxt or the partition tables differ from the new backups. .It Va daily_backup_passwd_enable .Pq Vt bool Set to .Dq Li YES if you want the .Pa /etc/master.passwd and .Pa /etc/group files backed up and reported on. Reporting consists of checking both files for modifications and running .Xr chkgrp 8 on the .Pa group file. .It Va daily_backup_aliases_enable .Pq Vt bool Set to .Dq Li YES if you want the .Pa /etc/mail/aliases file backed up and modifications to be displayed in your daily output. .It Va daily_backup_zfs_enable .Pq Vt bool Set to .Dq Li YES to create backup of the output generated from the .Xr zfs-list 8 and .Xr zpool-list 8 utilities. .It Va daily_backup_zfs_list_flags .Pq Vt str Set to the arguments for the .Xr zfs-list 8 utility. The default is standard behavior. .It Va daily_backup_zpool_list_flags .Pq Vt str Set to the arguments for the .Xr zpool-list 8 utility. The default is .Fl v . .It Va daily_backup_zfs_props_enable .Pq Vt bool Set to .Dq Li YES to create backup of the output generated from the .Xr zfs-get 8 and .Xr zpool-get 8 utilities. .It Va daily_backup_zfs_get_flags .Pq Vt str Set to the arguments for the .Xr zfs-get 8 utility. The default is .Cm all . .It Va daily_backup_zpool_get_flags .Pq Vt str Set to the arguments for the .Xr zpool-get 8 utility. The default is .Cm all . .It Va daily_backup_zfs_verbose .Pq Vt bool Set to .Dq Li YES to report a diff between the new backup and the existing backup in the daily output. .It Va daily_calendar_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Nm calendar Fl a daily. .It Va daily_accounting_enable .Pq Vt bool Set to .Dq Li YES -if you want to rotate your daily accounting files. +if you want to rotate your daily process accounting files. No rotations are necessary unless .Va accounting_enable is enabled in .Xr rc.conf 5 . .It Va daily_accounting_compress .Pq Vt bool Set to .Dq Li YES if you want your daily accounting files to be compressed using .Xr gzip 1 . .It Va daily_accounting_save .Pq Vt num When .Va daily_accounting_enable is set, this may also be set to the number of daily accounting files that are to be saved. The default is .Dq Li 3 . .It Va daily_accounting_flags .Pq Vt str Set to the arguments to pass to the .Xr sa 8 utility (in addition to .Fl s ) when .Va daily_accounting_enable is set to .Dq Li YES . The default is .Fl q . .It Va daily_news_expire_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Pa /etc/news.expire . .It Va daily_status_disks_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Xr df 1 (with the arguments supplied in .Va daily_status_disks_df_flags ) and .Nm dump Fl W . .It Va daily_status_disks_df_flags .Pq Vt str Set to the arguments for the .Xr df 1 utility when .Va daily_status_disks_enable is set to .Dq Li YES . The default is .Fl l Fl h . .It Va daily_status_zfs_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Nm zpool Cm status on your .Xr zfs 8 pools. .It Va daily_status_zfs_zpool_list_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Nm zpool Cm list on your .Xr zfs 8 pools. Requires .Va daily_status_zfs_enable to be set to .Li YES . .It Va daily_status_gmirror_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Nm gmirror Cm status on your .Xr gmirror 8 devices. .It Va daily_status_graid3_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Nm graid3 Cm status on your .Xr graid3 8 devices. .It Va daily_status_gstripe_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Nm gstripe Cm status on your .Xr gstripe 8 devices. .It Va daily_status_gconcat_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Nm gconcat Cm status on your .Xr gconcat 8 devices. .It Va daily_status_mfi_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Nm mfiutil Cm status on your .Xr mfi 4 devices. .It Va daily_status_network_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Nm netstat Fl i . .It Va daily_status_network_netstat_flags .Pq Vt str Set to additional arguments for the .Xr netstat 1 utility when .Va daily_status_network_enable is set to .Dq Li YES . The default is .Fl d W . .It Va daily_status_network_usedns .Pq Vt bool Set to .Dq Li YES if you want to run .Xr netstat 1 without the .Fl n option (to do DNS lookups). .It Va daily_status_uptime_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Xr uptime 1 (or .Xr ruptime 1 if .Va rwhod_enable is set to .Dq Li YES in .Pa /etc/rc.conf ) . .It Va daily_status_mailq_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Xr mailq 1 . .It Va daily_status_mailq_shorten .Pq Vt bool Set to .Dq Li YES if you want to shorten the .Xr mailq 1 output when .Va daily_status_mailq_enable is set to .Dq Li YES . .It Va daily_status_include_submit_mailq .Pq Vt bool Set to .Dq Li YES if you also want to run .Xr mailq 1 on the submit mail queue when .Va daily_status_mailq_enable is set to .Dq Li YES . This may not work with MTAs other than .Xr sendmail 8 . .It Va daily_status_security_enable .Pq Vt bool Set to .Dq Li YES if you want to run the security check. The security check is another set of .Xr periodic 8 scripts. The system defaults are in .Pa /etc/periodic/security . Local scripts should be placed in .Pa /usr/local/etc/periodic/security . See the .Xr periodic 8 manual page for more information. .It Va daily_status_security_inline .Pq Vt bool Set to .Dq Li YES if you want the security check output inline. The default is to either mail or log the output according to the value of .Va daily_status_security_output . .It Va daily_status_security_output .Pq Vt str Where to send the output of the security check if .Va daily_status_security_inline is set to .Dq Li NO . This variable behaves in the same way as the .Va *_output variables above, namely it can be set either to one or more email addresses or to an absolute file name. .It Va daily_status_mail_rejects_enable .Pq Vt bool Set to .Dq Li YES if you want to summarise mail rejections logged to .Pa /var/log/maillog for the previous day. .It Va daily_status_mail_rejects_logs .Pq Vt num Set to the number of maillog files that should be checked for yesterday's mail rejects. .It Va daily_status_ntpd_enable .Pq Vt bool Set to .Dq Li YES if you want to enable NTP status check. .It Va daily_status_world_kernel .Pq Vt bool Set to .Dq Li YES to check the running userland and kernel are in sync. .It Va daily_queuerun_enable .Pq Vt bool Set to .Dq Li YES if you want to manually run the mail queue at least once a day. .It Va daily_submit_queuerun .Pq Vt bool Set to .Dq Li YES if you also want to manually run the submit mail queue at least once a day when .Va daily_queuerun_enable is set to .Dq Li YES . .It Va daily_scrub_zfs_enable .Pq Vt bool Set to .Dq Li YES if you want to run a zfs scrub periodically. .It Va daily_scrub_zfs_pools .Pq Vt str A space separated list of names of zfs pools to scrub. If the list is empty or not set, all zfs pools are scrubbed. .It Va daily_scrub_zfs_default_threshold .Pq Vt int Number of days between a scrub if no pool-specific threshold is set. If not set, the default value is 35, corresponding to 5 weeks. .It Va daily_scrub_zfs_ Ns Ao Ar poolname Ac Ns Va _threshold .Pq Vt int The same as .Va daily_scrub_zfs_default_threshold but specific to the pool .Ao Ar poolname Ac Ns . .It Va daily_local .Pq Vt str Set to a list of extra scripts that should be run after all other daily scripts. All scripts must be absolute path names. .El .Pp The following variables are used by the standard scripts that reside in .Pa /etc/periodic/weekly : .Bl -tag -offset 4n -width 2n .It Va weekly_locate_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Pa /usr/libexec/locate.updatedb . This script is run using .Nm nice Fl 5 as user .Dq Li nobody , and generates the table used by the .Xr locate 1 command. .It Va weekly_whatis_enable .Pq Vt bool Set to .Dq Li YES if you want to run .Pa /usr/libexec/makewhatis.local . This script regenerates the database used by the .Xr apropos 1 command. .It Va weekly_noid_enable .Pq Vt bool Set to .Dq Li YES if you want to locate orphaned files on the system. An orphaned file is one with an invalid owner or group. .It Va weekly_noid_dirs .Pq Vt str A list of directories under which orphaned files are searched for. This would usually be set to .Pa / . .It Va weekly_status_security_enable .Pq Vt bool Weekly counterpart of .Va daily_status_security_enable . .It Va weekly_status_security_inline .Pq Vt bool Weekly counterpart of .Va daily_status_security_inline . .It Va weekly_status_security_output .Pq Vt str Weekly counterpart of .Va daily_status_security_output . .It Va weekly_status_pkg_enable .Pq Vt bool Set to .Dq Li YES if you want to use .Xr pkg-version 8 to list installed packages which are out of date. .It Va pkg_version .Pq Vt str When .Va weekly_status_pkg_enable is set to .Dq Li YES , this variable specifies the program that is used to determine the out of date packages. If unset, the .Xr pkg-version 8 program is used. As an example, this variable might be set to .Dq Li portversion if the .Pa ports/sysutils/portupgrade port has been installed. .It Va pkg_version_index .Pq Vt str This variable specifies the .Pa INDEX file from .Pa /usr/ports that should be used by .Xr pkg-version 8 . Because the dependency tree may be substantially different between versions of .Fx , there may be more than one .Pa INDEX file in .Pa /usr/ports . .Pp Note, if the .Va pkg_version variable is set to .Dq Li portversion , it will also be necessary to arrange that the correct .Pa INDEX file is specified using environment variables and that .Va pkg_version_index is cleared in .Pa /etc/periodic.conf .Pq Dq Li pkg_version_index= . .It Va weekly_local .Pq Vt str Set to a list of extra scripts that should be run after all other weekly scripts. All scripts must be absolute path names. .El .Pp The following variables are used by the standard scripts that reside in .Pa /etc/periodic/monthly : .Bl -tag -offset 4n -width 2n .It Va monthly_accounting_enable .Pq Vt bool Set to .Dq Li YES if you want to do login accounting using the .Xr ac 8 command. .It Va monthly_status_security_enable .Pq Vt bool Monthly counterpart of .Va daily_status_security_enable . .It Va monthly_status_security_inline .Pq Vt bool Monthly counterpart of .Va daily_status_security_inline . .It Va monthly_status_security_output .Pq Vt str Monthly counterpart of .Va daily_status_security_output . .It Va monthly_local .Pq Vt str Set to a list of extra scripts that should be run after all other monthly scripts. All scripts must be absolute path names. .El .Pp The following variables are used by the standard scripts that reside in .Pa /etc/periodic/security . Those scripts are usually run from daily .Pq Va daily_status_security_enable , weekly .Pq Va weekly_status_security_enable , and monthly .Pq Va monthly_status_security_enable periodic hooks. The .Va ..._period of each script can be configured as .Dq daily , .Dq weekly , .Dq monthly or .Dq NO . Note that when periodic security scripts are run from .Xr crontab 5 , they will be always run unless their .Va ..._enable or .Va ..._period variable is set to .Dq NO . .Bl -tag -offset 4n -width 2n .It Va security_status_diff_flags .Pq Vt str Set to the arguments to pass to the .Xr diff 1 utility when generating differences. The default is .Fl b u . .It Va security_status_chksetuid_enable .Pq Vt bool Set to .Dq Li YES to compare the modes and modification times of setuid executables with the previous day's values. .It Va security_status_chksetuid_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_chkportsum_enable .Pq Vt bool Set to .Dq Li YES to verify checksums of all installed packages against the known checksums in .Pa /var/db/pkg . .It Va security_status_chkportsum_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_neggrpperm_enable .Pq Vt bool Set to .Dq Li YES to check for files where the group of a file has less permissions than the world at large. When users are in more than 14 supplemental groups these negative permissions may not be enforced via NFS shares. .It Va security_status_neggrpperm_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_chkmounts_enable .Pq Vt bool Set to .Dq Li YES to check for changes mounted file systems to the previous day's values. .It Va security_status_chkmounts_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_noamd .Pq Vt bool Set to .Dq Li YES if you want to ignore .Xr amd 8 mounts when comparing against yesterday's file system mounts in the .Va security_status_chkmounts_enable check. .It Va security_status_chkuid0_enable .Pq Vt bool Set to .Dq Li YES to check .Pa /etc/master.passwd for accounts with UID 0. .It Va security_status_chkuid0_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_passwdless_enable .Pq Vt bool Set to .Dq Li YES to check .Pa /etc/master.passwd for accounts with empty passwords. .It Va security_status_passwdless_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_logincheck_enable .Pq Vt bool Set to .Dq Li YES to check .Pa /etc/login.conf ownership, see .Xr login.conf 5 for more information. .It Va security_status_logincheck_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_ipfwdenied_enable .Pq Vt bool Set to .Dq Li YES to show log entries for packets denied by .Xr ipfw 8 since yesterday's check. .It Va security_status_ipfwdenied_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_ipfdenied_enable .Pq Vt bool Set to .Dq Li YES to show log entries for packets denied by .Xr ipf 8 since yesterday's check. .It Va security_status_ipfdenied_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_pfdenied_enable .Pq Vt bool Set to .Dq Li YES to show log entries for packets denied by .Xr pf 4 since yesterday's check. .It Va security_status_pfdenied_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_ipfwlimit_enable .Pq Vt bool Set to .Dq Li YES to display .Xr ipfw 8 rules that have reached their verbosity limit. .It Va security_status_ipfwlimit_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_kernelmsg_enable .Pq Vt bool Set to .Dq Li YES to show new .Xr dmesg 8 entries since yesterday's check. .It Va security_status_kernelmsg_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_loginfail_enable .Pq Vt bool Set to .Dq Li YES to display failed logins from .Pa /var/log/messages in the previous day. .It Va security_status_loginfail_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .It Va security_status_tcpwrap_enable .Pq Vt bool Set to .Dq Li YES to display connections denied by tcpwrappers (see .Xr hosts_access 5 ) from .Pa /var/log/messages during the previous day. .It Va security_status_tcpwrap_period .Pq Vt str Set to either .Dq Li daily , .Dq Li weekly , .Dq Li monthly or .Dq Li NO . .El .Sh FILES .Bl -tag -width ".Pa /etc/defaults/periodic.conf" .It Pa /etc/defaults/periodic.conf The default configuration file. This file contains all default variables and values. .It Pa /etc/periodic.conf The usual system specific variable override file. .It Pa /etc/periodic.conf.local An additional override file, useful when .Pa /etc/periodic.conf is shared or distributed. .El .Sh SEE ALSO .Xr apropos 1 , .Xr calendar 1 , .Xr df 1 , .Xr diff 1 , .Xr gzip 1 , .Xr locate 1 , .Xr man 1 , .Xr msgs 1 , .Xr netstat 1 , .Xr nice 1 , .Xr login.conf 5 , .Xr rc.conf 5 , .Xr ac 8 , .Xr chkgrp 8 , .Xr dump 8 , .Xr newsyslog 8 , .Xr periodic 8 , .Xr pkg-version 8 , .Xr sendmail 8 .Sh HISTORY The .Nm file appeared in .Fx 4.1 . .Sh AUTHORS .An Brian Somers Aq Mt brian@Awfulhak.org diff --git a/usr.sbin/newsyslog/newsyslog.conf.5 b/usr.sbin/newsyslog/newsyslog.conf.5 index b897389b99dd..cf1a36305b00 100644 --- a/usr.sbin/newsyslog/newsyslog.conf.5 +++ b/usr.sbin/newsyslog/newsyslog.conf.5 @@ -1,435 +1,436 @@ .\" This file was split from the newsyslog(8) manual page by Tom Rhodes .\" and includes modifications as appropriate. .\" The original header is included below: .\" .\" This file contains changes from the Open Software Foundation. .\" .\" from: @(#)newsyslog.8 .\" $FreeBSD$ .\" .\" Copyright 1988, 1989 by the Massachusetts Institute of Technology .\" .\" Permission to use, copy, modify, and distribute this software .\" and its documentation for any purpose and without fee is .\" hereby granted, provided that the above copyright notice .\" appear in all copies and that both that copyright notice and .\" this permission notice appear in supporting documentation, .\" and that the names of M.I.T. and the M.I.T. S.I.P.B. not be .\" used in advertising or publicity pertaining to distribution .\" of the software without specific, written prior permission. .\" M.I.T. and the M.I.T. S.I.P.B. make no representations about .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" .Dd February 26, 2021 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME .Nm newsyslog.conf .Nd .Xr newsyslog 8 configuration file .Sh DESCRIPTION The .Nm file is used to set log file rotation configuration for the .Xr newsyslog 8 utility. Configuration may designate that logs are rotated based on size, last rotation time, or time of day. The .Nm file can also be used to designate secure permissions to log files at rotation time. During initialization, .Xr newsyslog 8 reads a configuration file, normally .Pa /etc/newsyslog.conf , to determine which logs may potentially be rotated and archived. Each line has five mandatory fields and four optional fields, separated with whitespace. Blank lines or lines beginning with .Ql # are ignored. If .Ql # is placed in the middle of the line, the .Ql # character and the rest of the line after it is ignored. To prevent special meaning, the .Ql # character may be escaped with .Ql \e ; in this case preceding .Ql \e is removed and .Ql # is treated as an ordinary character. The fields of the configuration file are as follows: .Bl -tag -width indent .It Ar logfile_name Name of the system log file to be archived, or one of the literal strings .Dq Aq Li default , or .Dq Aq Li include . The special default entry will only be used if a log file name is given as a command line argument to .Xr newsyslog 8 , and if that log file name is not matched by any other line in the configuration file. The include entry is used to include other configuration files and supports globbing. .It Ar owner : Ns Ar group This optional field specifies the owner and group for the archive file. The .Ql \&: is essential regardless if the .Ar owner or .Ar group field is left blank or contains a value. The field may be numeric, or a name which is present in .Pa /etc/passwd or .Pa /etc/group . .It Ar mode Specify the file mode of the log file and archives. Valid mode bits are .Dv 0666 . (That is, read and write permissions for the rotated log may be specified for the owner, group, and others.) All other mode bits are ignored. .It Ar count Specify the maximum number of archive files which may exist. This does not consider the current log file. .It Ar size When the size of the log file reaches .Ar size in kilobytes, the log file will be trimmed as described above. If this field contains an asterisk .Pq Ql * , the log file will not be trimmed based on size. .It Ar when The .Ar when field may consist of an interval, a specific time, or both. If the .Ar when field contains an asterisk .Pq Ql * , log rotation will solely depend on the contents of the .Ar size field. Otherwise, the .Ar when field consists of an optional interval in hours, usually followed by an .So Li \&@ Sc Ns No -sign and a time in restricted .Tn ISO 8601 format. Additionally, the format may also be constructed with a .Ql $ sign along with a rotation time specification of once a day, once a week, or once a month. .Pp Time based trimming happens only if .Xr newsyslog 8 is run within one hour of the specified time. If an interval is specified, the log file will be trimmed if that many hours have passed since the last rotation. When both a time and an interval are specified then both conditions must be satisfied for the rotation to take place. .Pp There is no provision for the specification of a timezone. There is little point in specifying an explicit minutes or seconds component in the current implementation, since the only comparison is .Dq within the hour . .Pp .Sy ISO 8601 restricted time format : .Pp The lead-in character for a restricted .Tn ISO 8601 time is an .Ql @ sign. The particular format of the time in restricted .Tn ISO 8601 is: .Sm off .Oo Oo Oo Oo Oo .Va cc Oc .Va yy Oc .Va mm Oc .Va dd Oc .Oo .Li T Oo .Va hh Oo .Va mm Oo .Va ss .Oc Oc Oc Oc Oc . .Sm on Optional date fields default to the appropriate component of the current date; optional time fields default to midnight; hence if today is January 22, 1999, the following date specifications are all equivalent: .Pp .Bl -item -compact -offset indent .It .Sq Li 19990122T000000 .It .Sq Li 990122T000000 .It .Sq Li 0122T000000 .It .Sq Li 22T000000 .It .Sq Li T000000 .It .Sq Li T0000 .It .Sq Li T00 .It .Sq Li 22T .It .Sq Li T .It .Sq Li \& .El .Pp .Sy Day, week, and month time format: .Pp The lead-in character for day, week, and month specification is a .Ql $ sign. The particular format of day, week, and month specification is: .Op Li D Ns Va hh , .Op Li W Ns Va w Ns Op Li D Ns Va hh , and .Op Li M Ns Va dd Ns Op Li D Ns Va hh , respectively. Optional time fields default to midnight. The ranges for day and hour specifications are: .Pp .Bl -tag -width indent -offset indent -compact .It Ar hh hours, range 0..23 .It Ar w day of week, range 0..6, 0 = Sunday .It Ar dd day of month, range 1..31, or one of the letters .Ql L or .Ql l to specify the last day of the month. .El .Pp Some examples: .Pp .Bl -tag -width indent -offset indent -compact .It Li $D0 rotate every night at midnight (same as .Li @T00 ) .It Li $D23 rotate every day at 23:00 (same as .Li @T23 ) .It Li $W0D23 rotate every week on Sunday at 23:00 .It Li $W5D16 rotate every week on Friday at 16:00 .It Li $M1D0 rotate at the first day of every month at midnight (i.e., the start of the day; same as .Li @01T00 ) .It Li $M5D6 rotate on every fifth day of month at 6:00 (same as .Li @05T06 ) .El .It Ar flags This optional field is made up of one or more characters that specify any special processing to be done for the log files matched by this line. The following are valid flags: .Bl -tag -width indent .It Cm B indicates that the log file is a binary file, or has some special format. Usually .Xr newsyslog 8 inserts an .Tn ASCII message into a log file during rotation. This message is used to indicate when, and sometimes why the log file was rotated. If .Cm B is specified, then that informational message will not be inserted into the log file. .It Cm C indicates that the log file should be created if it does not already exist, and if the .Fl C option was also specified on the command line. .It Cm D indicates that .Xr newsyslog 8 should set the .Dv UF_NODUMP flag when creating a new version of this log file. This option would affect how the .Xr dump 8 command treats the log file when making a file system backup. .It Cm E indicates that the log file should not be rotated when its size is zero. The .Cm E flag is mostly useful in conjunction with .Cm B flag to prevent .Xr newsyslog 8 from inserting an informational .Tn ASCII message into the new file. .It Cm G indicates that the specified .Ar logfile_name is a shell pattern, and that .Xr newsyslog 8 should archive all filenames matching that pattern using the other options on this line. See .Xr glob 3 for details on syntax and matching rules. .It Cm J indicates that .Xr newsyslog 8 should attempt to save disk space by compressing the rotated log file using .Xr bzip2 1 . .It Cm N indicates that there is no process which needs to be signaled when this log file is rotated. .It Cm p indicates that the zero-th rotated file should not be compressed. .It Cm R if this flag is set the .Xr newsyslog 8 will run shell command defined in .Ar path_to_pid_cmd_file after rotation instead of trying to send signal to a process id stored in the file. .It Cm T if this flag is set the informational rotation message written to the log file will be in the format specified by RFC5424. Normally, the rotation message is written in the traditional (RFC3164) syslog format. .It Cm U indicates that the file specified by .Ar path_to_pid_cmd_file will contain the ID for a process group instead of a process. This option also requires that the first line in that file be a negative value to distinguish it from a process ID. .It Cm X indicates that .Xr newsyslog 8 should attempt to save disk space by compressing the rotated log file using .Xr xz 1 . .It Cm Y indicates that .Xr newsyslog 8 should attempt to save disk space by compressing the rotated log file using .Xr zstd 1 . .It Cm Z indicates that .Xr newsyslog 8 should attempt to save disk space by compressing the rotated log file using .Xr gzip 1 . .It Fl a minus sign will not cause any special processing, but it can be used as a placeholder to create a .Ar flags field when you need to specify any of the following fields. .El .It Ar path_to_pid_cmd_file This optional field specifies the file name containing a daemon's process ID or to find a group process ID if the .Cm U flag was specified. If this field is present, a .Ar signal is sent to the process ID contained in this file. If this field is not present and the .Cm N flag has not been specified, then a .Dv SIGHUP signal will be sent to .Xr syslogd 8 or to the process id found in the file specified by .Xr newsyslog 8 Ns 's .Fl S switch. This field must start with .Ql / in order to be recognized properly. When used with the .Cm R flag, the file is treated as a path to a binary to be executed by the .Xr newsyslog 8 after rotation instead of sending the signal out. .It Ar signal This optional field specifies the signal that will be sent to the daemon process (or to all processes in a process group, if the .Cm U flag was specified). If this field is not present, then a .Dv SIGHUP signal will be sent. Signal names must start with .Dq SIG and be the signal name, e.g., .Dv SIGUSR1 . Alternatively, .Ar signal can be the signal number, e.g., 30 for .Dv SIGUSR1 . .El .Sh EXAMPLES The following is an example of the .Dq Aq Li include entry: .Dl " /etc/newsyslog-local.conf" .Sh SEE ALSO .Xr bzip2 1 , .Xr gzip 1 , .Xr xz 1 , +.Xr zstd 1 , .Xr syslog 3 , .Xr chown 8 , .Xr newsyslog 8 , .Xr syslogd 8 .Pp .Rs .%A C. Lonvick .%T The BSD syslog Protocol .%O RFC3164 .Re .Rs .%A R. Gerhards .%T The Syslog Protocol .%O RFC5424 .Re .Sh HISTORY This manual page first appeared in .Fx 4.10 . diff --git a/usr.sbin/periodic/etc/daily/460.status-mail-rejects b/usr.sbin/periodic/etc/daily/460.status-mail-rejects index ce633640b6a4..6161a5525cc1 100755 --- a/usr.sbin/periodic/etc/daily/460.status-mail-rejects +++ b/usr.sbin/periodic/etc/daily/460.status-mail-rejects @@ -1,73 +1,79 @@ #!/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 "$daily_status_mail_rejects_shorten" in [Yy][Ee][Ss]) shorten='cut -d" " -f2,3';; *) shorten=cat;; esac case "$daily_status_mail_rejects_enable" in [Yy][Ee][Ss]) if [ ! -d /etc/mail ] then echo '$daily_status_mail_rejects_enable is set but /etc/mail' \ "doesn't exist" rc=2 elif [ ! -f /var/log/maillog ] then echo '$daily_status_mail_rejects_enable is set but ' \ "/var/log/maillog doesn't exist" rc=2 elif [ "$daily_status_mail_rejects_logs" -le 0 ] then echo '$daily_status_mail_rejects_enable is set but ' \ '$daily_status_mail_rejects_logs is not greater than zero' rc=2 else echo echo Checking for rejected mail hosts: yesterday=$(date -v-1d '+%b %e') today=$(date '+%b %e') n=$(($daily_status_mail_rejects_logs - 2)) rc=$({ while [ $n -ge 0 ] do if [ -f /var/log/maillog.$n ] then cat /var/log/maillog.$n elif [ -f /var/log/maillog.$n.gz ] then zcat -fc /var/log/maillog.$n.gz elif [ -f /var/log/maillog.$n.bz2 ] then bzcat -fc /var/log/maillog.$n.bz2 + elif [ -f /var/log/maillog.$n.xz ] + then + xzcat -f /var/log/maillog.$n.xz + elif [ -f /var/log/maillog.$n.zst ] + then + zstdcat -fc /var/log/maillog.$n.zst fi n=$(($n - 1)) done cat /var/log/maillog } | sed -Ene "/^$today/q" -e "/^$yesterday/{"' s/.*ruleset=check_relay,.* relay=([^,]+), reject=([^ ]*).*/\2 check_relay \1/p t end s/.*ruleset=check_rcpt,.* arg1=,]+).* reject=([^ ]+) .* ([^ ]+)/\2 check_rcpt \1 \3/p t end s/.*ruleset=check_([^,]+),.* arg1=,]+).* reject=([^ ]+) .* ([^ ]+)/\4 check_\1 \3 \5/p :end }' | eval $shorten | sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l) [ $rc -gt 0 ] && rc=1 fi;; *) rc=0;; esac exit $rc diff --git a/usr.sbin/periodic/etc/monthly/200.accounting b/usr.sbin/periodic/etc/monthly/200.accounting index 46f153de535a..9d50ba182777 100755 --- a/usr.sbin/periodic/etc/monthly/200.accounting +++ b/usr.sbin/periodic/etc/monthly/200.accounting @@ -1,51 +1,65 @@ #!/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 oldmask=$(umask) umask 066 case "$monthly_accounting_enable" in [Yy][Ee][Ss]) W=/var/log/utx.log rc=0 remove=NO + filetoread=$W.0 if [ ! -f $W.0 ] then - if [ -f $W.0.gz ] + if [ -f $W.0.gz ] || [ -f $W.0.bz2 ] || [ -f $W.0.xz ] || [ -f $W.0.zst ] then + TMP=`mktemp -t accounting` remove=YES - zcat $W.0.gz > $W.0 || rc=1 - elif [ -f $W.0.bz2 ] - then - remove=YES - bzcat $W.0.bz2 > $W.0 || rc=1 + filetoread=$TMP + if [ -f $W.0.gz ] + then + zcat $W.0.gz > $TMP || rc=1 + elif [ -f $W.0.bz2 ] + then + bzcat $W.0.bz2 > $TMP || rc=1 + elif [ -f $W.0.xz ] + then + xzcat $W.0.xz > $TMP || rc=1 + elif [ -f $W.0.zst ] + then + zstdcat $W.0.zst > $TMP || rc=1 + else + # shouldn't get here, unless something disappeared under us. + rc=2 + fi else echo '$monthly_accounting_enable is set but' \ "$W.0 doesn't exist" rc=2 fi fi if [ $rc -eq 0 ] then echo "" echo "Doing login accounting:" - rc=$(ac -p -w $W.0 | sort -nr -k 2 | tee /dev/stderr | wc -l) + rc=$(ac -p -w $filetoread | sort -nr -k 2 | tee /dev/stderr | wc -l) [ $rc -gt 0 ] && rc=1 fi - [ $remove = YES ] && rm -f $W.0;; + [ $remove = YES ] && rm -f $TMP;; *) rc=0;; esac umask $oldmask exit $rc diff --git a/usr.sbin/periodic/etc/security/800.loginfail b/usr.sbin/periodic/etc/security/800.loginfail index 4c78f441639a..ef169482001c 100755 --- a/usr.sbin/periodic/etc/security/800.loginfail +++ b/usr.sbin/periodic/etc/security/800.loginfail @@ -1,72 +1,74 @@ #!/bin/sh - # # Copyright (c) 2001 The FreeBSD Project # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # # Show login failures # # 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 security_daily_compat_var security_status_logdir security_daily_compat_var security_status_loginfail_enable LOG="${security_status_logdir}" yesterday=`date -v-1d "+%b %e "` catmsgs() { find ${LOG} -name 'auth.log.*' -mtime -2 | sort -t. -r -n -k 2,2 | while read f do case $f in *.gz) zcat -f $f;; *.bz2) bzcat -f $f;; + *.xz) xzcat -f $f;; + *.zst) zstdcat -f $f;; esac done [ -f ${LOG}/auth.log ] && cat $LOG/auth.log } rc=0 if check_yesno_period security_status_loginfail_enable then echo "" echo "${host} login failures:" n=$(catmsgs | egrep -ia "^$yesterday.*: .*\b(fail(ures?|ed)?|invalid|bad|illegal|auth.*error)\b" | tee /dev/stderr | wc -l) [ $n -gt 0 ] && rc=1 || rc=0 fi exit $rc diff --git a/usr.sbin/periodic/etc/security/900.tcpwrap b/usr.sbin/periodic/etc/security/900.tcpwrap index 10b02e9e2bb6..b6c44126bc1c 100755 --- a/usr.sbin/periodic/etc/security/900.tcpwrap +++ b/usr.sbin/periodic/etc/security/900.tcpwrap @@ -1,72 +1,74 @@ #!/bin/sh - # # Copyright (c) 2001 The FreeBSD Project # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # # Show tcp_wrapper warning messages # # 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 security_daily_compat_var security_status_logdir security_daily_compat_var security_status_tcpwrap_enable LOG="${security_status_logdir}" yesterday=`date -v-1d "+%b %e "` catmsgs() { find ${LOG} -name 'messages.*' -mtime -2 | sort -t. -r -n -k 2,2 | while read f do case $f in *.gz) zcat -f $f;; *.bz2) bzcat -f $f;; + *.xz) xzcat -f $f;; + *.zst) zstdcat -f $f;; esac done [ -f ${LOG}/messages ] && cat $LOG/messages } rc=0 if check_yesno_period security_status_tcpwrap_enable then echo "" echo "${host} refused connections:" n=$(catmsgs | grep -i "^$yesterday.*refused connect" | tee /dev/stderr | wc -l) [ $n -gt 0 ] && rc=1 || rc=0 fi exit $rc