Page 1 of 1

csf autoupdate and From/To fields in email

Posted: 09 Nov 2015, 08:15
by ktp
Hello,

I discover the csf autoupdate function (AUTO_UPDATES = "1" in csf.conf). But I have few questions :

1) The update is triggered daily with /etc/cron.d/csf_update.
I only receive update report mail when there is an update, this is good. But how does this works?
The cron daemon only sends update mail when there is a real update? It could not know this, so
what is the trick?

2) Is there a way to set both From: and To: fields of the csf update mail ?
Currently it uses From: "(Cron Daemon) <root@hostname>" and To: <root@hostname>
where hostname is the server hostname.
I am thinking about changing csf_update file as following:

Code: Select all

MAILTO=""
SHELL=/bin/sh
HOSTNAME="server_hostname"
11 5 * * * root /usr/sbin/csf -u 2>&1 | mail -r from_email@example.com -s "csf update for $HOSTNAME" to_email@example.com
Would it work?

Thank you.

Re: csf autoupdate and From/To fields in email

Posted: 11 Nov 2015, 10:36
by ktp
Hello,

Update news: Answer to my own question 2): I tried with the mail command as above, it works, but since there is no csf update available, I got the message (from mail) "Null message body; hope that's ok". This is fine, but the problem is that I receive each day the email, and not only when there is a real update.

So I still need knowledgeable person to explain to me why the original csf_update, with only "csf -u" entry will not trigger any email if there is no csf update available? This question bugs a lot, so please append if you have any idea or answer to my question 1). Thank you in advance.