1 |
On 2008-09-05, Grant Edwards <grante@××××.com> wrote: |
2 |
> On 2008-09-05, Grant Edwards <grante@××××.com> wrote: |
3 |
>> I've set the MAILTO env variable in my crontab, but vixie-cron |
4 |
>> still isn't sending e-mails. I've verfied that I'm able to |
5 |
>> send email with /usr/sbin/sendmail (both with and without -t). |
6 |
>> |
7 |
>> I re-emerged vixie-cron with the debug USE flag, but it didn't |
8 |
>> seem to produce any debug info that I can find anywhere. |
9 |
>> |
10 |
>> How do I convince vixie-cron to produce some debug output |
11 |
>> so that I can figure out why it's not sending e-mails? |
12 |
> |
13 |
> I've narrowed it down a little. I'm using msmtp as an MTA. I |
14 |
> normally don't have a global /etc/msmtprc configuration file |
15 |
> -- I have per-user ~/.msmtprc files. I first assumed that |
16 |
> cron was sending mail as the owner of the cron file (that |
17 |
> owner has a working msmtp config file). That appears not to |
18 |
> be true. |
19 |
> |
20 |
> Next, I tried setting up msmtp config files for users root and |
21 |
> cron. Both those configurations work fine. But, cron still |
22 |
> can't send mail. |
23 |
|
24 |
It turns out that cron is attempting to send e-mail with |
25 |
uid/gid of crontab file owner, but it has USER=root and |
26 |
HOME=/root. That breaks /usr/sbin/sendmail (msmtp) since it |
27 |
can't read /root/.msmtprc when it's run as the crontab file |
28 |
owner. |
29 |
|
30 |
I tried setting HOME appropriately in the crontab file, but |
31 |
that didn't do anything -- HOME as seen by /usr/sbin/sendmail |
32 |
is still always /root. [IMO, this is a bug in vixie-cron.] |
33 |
|
34 |
A paritial work-around is to create a new user and group (I |
35 |
called it "msmtp". The msmtp binary is set to run suid as the |
36 |
msmtp user, and the global config file /etc/msmtprc is readable |
37 |
only by user msmtp. /usr/bin/msmtp is then set to be |
38 |
executable only by users in the msmtp group, and users who are |
39 |
allowed to send mail are added to the msmtp group. |
40 |
|
41 |
This isn't really a general solution since when user FOO runs |
42 |
msmtp, it won't be able to read ~FOO/.msmtprc as it should |
43 |
unless ~FOO/.msmtprc is made readible to the msmtp user or |
44 |
group. |
45 |
|
46 |
-- |
47 |
Grant Edwards grante Yow! Somewhere in Tenafly, |
48 |
at New Jersey, a chiropractor |
49 |
visi.com is viewing "Leave it to |
50 |
Beaver"! |