Bug 197705 - Periodic configuration prints unneeded header when show_sucess="no"
Summary: Periodic configuration prints unneeded header when show_sucess="no"
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 9.3-RELEASE
Hardware: i386 Any
: --- Affects Some People
Assignee: Jeremie Le Hen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-16 12:41 UTC by frank
Modified: 2016-10-26 18:26 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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

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

security_show_success="NO"
security_show_info="YES"
security_show_badconfig="YES"

daily_status_security_enable="YES"
daily_status_security_inline="YES"

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:

https://svnweb.freebsd.org/base/head/etc/periodic/daily/450.status-security?view=markup

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:

--------------------------

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"

--------------------------

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