[Mimedefang] Monitoring Selected User Emails
Ted Beaton
tbeaton at plansysit.com
Wed Sep 8 14:32:43 EDT 2004
Hi, I am running Fedora Core 2 w/ dovecot imap, spamassassin and mimedefang
2.44. This is not our active mail server yet, it is still in test mode. I
have been tasked with monitoring all incoming and outgoing mail for a couple
targeted users. Is mimedefang the best way to attack this or is there a
simpler solution? Thinking that mimedefang was the way to go I have
experimented with the mimedefang-filter file and added the following code in
the filter_end:
sub filter_end ($) {
my($entity) = @_;
# If you want quarantine reports, uncomment next line
# send_quarantine_notifications();
# IMPORTANT NOTE: YOU MUST CALL send_quarantine_notifications() AFTER
# ANY PARTS HAVE BEEN QUARANTINED. SO IF YOU MODIFY THIS FILTER TO
# QUARANTINE SPAM, REWORK THE LOGIC TO CALL
send_quarantine_notifications()
# AT THE END!!!
# No sense doing any extra work
return if message_rejected();
# Spam checks if SpamAssassin is installed
if ($Features{"SpamAssassin"}) {
if (-s "./INPUTMSG" < 100*1024) {
# Only scan messages smaller than 100kB. Larger messages
# are extremely unlikely to be spam, and SpamAssassin is
# dreadfully slow on very large messages.
my($hits, $req, $names, $report) = spam_assassin_check();
# Added by tbeaton
foreach $recip (@Recipients) {
if ($recip = user at somewhere.com) {
add_recipient('tbeaton at somewhere.com');
}
}
# End added portion
Not fully understanding the complete workings I made a couple assumptions
and tested. The first assumption is that it runs the spam_assassin_check()
function all the time so my snippet of code will get run. Second it looks
like the spam_assassin_check() creates the @Recipients. When I find the
email address I want out of @Recipients I run add_recipient and add myself
as a recipient and then the email should get sent on its way. When I tested
the maillog says it was sent and says that I was added as a recipient but it
never shows up in either mailbox. If I comment out my code the email is
sent to the original intended recipient. I thought this would work so what
I was actually testing to see was if my email address showed up on the
original email as a recipient. That obviously would not be good. I don't
know if that would happen or not since it doesn't work at all.
Regards,
Ted Beaton
More information about the MIMEDefang
mailing list