Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 150391

Summary: app-forensics/rkhunter: cronjob sends email even if empty
Product: Gentoo Linux Reporter: Zak Kipling <zak.kipling>
Component: Current packagesAssignee: Forensics Herd [disbanded] <forensics+obsolete>
Status: RESOLVED TEST-REQUEST    
Severity: trivial CC: ka0ttic, radek
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch: don't mail output if empty

Description Zak Kipling 2006-10-07 09:05:37 UTC
Even if you're using --quiet and there is no output from rkhunter, the cronjob will send a blank email if SEND_EMAIL is on.

Patch to follow
Comment 1 Zak Kipling 2006-10-07 09:09:49 UTC
Created attachment 99053 [details, diff]
Patch: don't mail output if empty
Comment 2 Radek Podgorny 2006-10-07 14:26:39 UTC
Well, shouldn't cron filter out empty mail by default by itself? As I remember, last time I tried rkhunter, it was returning 1 (insted of 0) which force cron to send a mail (error happened, user should be notified) but with programs returning null output and return value of 0, it didn't send anything...
Comment 3 Zak Kipling 2006-10-07 15:33:44 UTC
That's correct -- cron itself won't send any mail for a job that produces no output.

However, the /etc/cron.daily/rkhunter script doesn't write to stdout/stderr and let cron send the email but rather captures the output from rkhunter and mails it explicitly by invoking the "mail" command -- hence it (rather than cron) has the responsibility for deciding whether or not the mail should be sent.
Comment 4 Radek Podgorny 2006-10-08 05:15:27 UTC
Ah, that makes sense. But isn't a a bad solution to depend on "mail" utility to send mails from a cronjob? IMHO this should be handled by cron so if you want to supress email sending, just run rkhunter with ">/dev/null". Wouldn't that be much cleaner?
Comment 5 Patrick Lauer gentoo-dev 2009-01-17 20:58:03 UTC
rkhunter-1.3.4-r1 should have a patch that fixes this issue. Please test and reopen if it doesn't :)