11

FreeBSD & MacOSX ship with the the periodic(8) utility, which is a neatly organized set of utilities to periodically run system functions like ZFS filesystem checks, security checks, checking for out of date ports, etc.

The problem is that periodic sends too many emails which contain too much superfluous information. This causes people to ignore the emails, and we miss many problems picked up by periodic(8). The Daily emails are sent once per day, the security emails are sent once per day, and the weekly & monthly emails are also sent periodically. These emails have a subject line like one of these:

Subject: $HOSTNAME daily run output
Subject: $HOSTNAME security run output
Subject: $HOSTNAME weekly run output
Subject: $HOSTNAME monthly run output

How can I reduce the amount of email sent from periodic(8)?

I'll post my own answer below, but I would like to see what others have done.

Note: I have a similar question regarding Linux, at Linux: logwatch(8) & cron.daily is too noisy. How can I control the noise level?

Stefan Lasiewski
  • 22,949
  • 38
  • 129
  • 184

1 Answers1

13

Place something like the following in /etc/periodic.conf .

The following configuration will reduce the noise in the emails. If these messages are blank, then periodic(8) will not send an email. In addition, the security emails will be included with the daily emails, which also reduces noise.

# /etc/periodic.conf overrides the defaults in /etc/defaults/periodic.conf
# This file can be overriden by /etc/periodic.conf.local

# *_show_success, *_show_info & *_show_badconfig are disabled
# per recomendation of periodic(8) and "Absolute FreeBSD" p. 310-311
# and "Essential system administration, 3rd Ed." p. 98

# *_show_badconfig="NO" will suppress messages for tools which are not installed on this system (e.g. ZFS on a system without ZFS). 

daily_show_success="NO"
daily_show_info="NO"
daily_show_badconfig="NO"

weekly_show_success="NO"
weekly_show_info="NO"
weekly_show_badconfig="NO"

monthly_show_success="NO"
monthly_show_info="NO"
monthly_show_badconfig="NO"

# Include security jobs with daily email. No need to send second email.
daily_status_security_inline="YES"
security_show_success="NO"

# Don't need to know about denied packets every day
daily_status_security_ipfdenied_enable="NO"

### Now, enable services which you DO want to be aware of    
# Check host for old ports
daily_status_security_portaudit_enable="YES"

# Perform ZFS filesystem checks
daily_status_zfs_enable="YES"

The above example will get you 90% there. However, there is one additional problem which cannot be resolved using the standard FreeBSD config (as of 20110601). The script at /etc/periodic/daily/450.status-security will still print the following pointless message:

Security check:

-- End of daily output -- 

The fix is to apply the patch found in http://www.freebsd.org/cgi/query-pr.cgi?pr=138692 . This patch will modify the return codes for 450.status-security, so that extra messages won't be printed.

Stefan Lasiewski
  • 22,949
  • 38
  • 129
  • 184