Bug 197705

Summary: Periodic configuration prints unneeded header when show_sucess="no"
Product: Base System Reporter: frank
Component: confAssignee: Jeremie Le Hen <jlh>
Status: New ---    
Severity: Affects Some People CC: allcoms, jlh
Priority: ---    
Version: 9.3-RELEASE   
Hardware: i386   
OS: Any   

Description frank 2015-02-16 12:41:54 UTC
I have a very small issue in the configuration of the periodic framework.

If I configure the following in periodic.conf




I would expect that I will not get a daily email when there is no warning or error. 

However, I get every day an empty email with the following line:

#### Start of email ####
Return-Path: <root@xxx>
X-Original-To: root@xxx
To: root@xxx
Subject: xxx daily run output
Date: Mon, 16 Feb 2015 03:02:00 +0100 (CET)

Security check:

-- End of daily output --
#### End of email ####

It would be much nicer if the line "Security check:" was not printed (and hence no email was send) when there are no security events to report.

In my opinion the daily_show_success="NO" and security_show_success="NO" options should mean that this empty header is not to be printed.
Comment 1 Jeremie Le Hen freebsd_committer 2015-12-21 20:32:24 UTC
Hi Frank,

This is not straightforward to do so because as you can see on the URL below this message is printed before calling periodic(8) again for security:


So there are two solutions:
1. remove this message altogether; this is problematic if the security output is inlined

2. print only this message if there is any output from periodic security; but this requires to bufferize the whole output and then print the caption only if the output is not empty

I would favor 2 but it's a bit hackish and heavyweight for the purpose.  Let this bug bake a bit to see if others have some input.
Comment 2 Dan MacDonald 2016-10-26 18:26:38 UTC
Whilst I have briefly tried FreeBSD and PCBSD / TrueOS a few times in the past, I am currently setting up my first serious FreeBSD server and this is the first issue I have been unable to resolve with serious searching and experimentation.

Like the OP, I would like to utilise periodic and have it run daily but I don't want daily mails being sent, or more specifically I don't want any mails being sent if there are no errors or warnings from any of periodics checks.

In my case I configured periodic.conf like so:





# Include security jobs with daily email. No need to send second email.

# Don't need to know about denied packets every day


Which, on a 'good' day, will output an email with a body containing:


Security check:

hostname kernel log messages:

-- End of security output --

-- End of daily output --


That is effectively empty and so ideally, I shouldn't receive a mail at all if that's all it contains.

I know I can redirect periodic's output into log files but I'd never read them and because periodic doesn't know when not to send an email (esp. for daily checks) I currently have no other option than to disable it entirely until this gets fixed, do I?

I am running FreeBSD 11.0 amd64