Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Setting different MAILFROM for different cron jobs
Date: Mon, 20 Jan 2014 12:20:01
Message-Id: 20140120121947.79426a7d@digimed.co.uk
In Reply to: Re: [gentoo-user] Setting different MAILFROM for different cron jobs by Tanstaafl
1 On Sun, 19 Jan 2014 08:25:16 -0500, Tanstaafl wrote:
2
3 > > cron mails are sent from the user running the cron job, but some
4 > > programs have an option to set the address for any mails they send
5 > > (not their stdout that goes through cron). rkhunter is one of these.
6 >
7 > Yes, and I have set it, but it doesn't change the MAILFROM.
8 >
9 > Here is what I have in /etc/cron.daily/rkhunter:
10 >
11 > > # Set this to 'yes' if you wish the output to be mailed to you
12 > > SEND_EMAIL=yes
13 > >
14 > > # NOTE: the following EMAIL_* variables are only relevant if you set
15 > > the # SEND_EMAIL variable to 'yes'
16 > > EMAIL_SUBJECT="${HOSTNAME}: rkhunter output"
17 > > EMAIL_SENDER="myhost+rkhunter@×××××××.com"
18 > > EMAIL_RECIPIENT="myuser+rkhunter-report@×××××××.com"
19 > > EMAIL_CMD="|mail -s \"${EMAIL_SUBJECT}\" ${EMAIL_RECIPIENT}"
20 >
21 > I get the email, but it says it is from 'root'.
22
23 I was wrong about rkhunter, it does not support changing the From:
24 header, EMAIL_SENDER is ignored. I worked round this by adding a custom
25 header ot the mails and filtering on that.
26
27 EMAIL_CMD="|Mail -s \"${EMAIL_SUBJECT}\" -a \"X-Rootkit-Hunter: cron
28 report\" ${EMAIL_RECIPIENT}"
29
30
31 --
32 Neil Bothwick
33
34 Drive not ready: (R)etry (G)o to Impulse (C)all Engineering

Attachments

File name MIME type
signature.asc application/pgp-signature