[Mimedefang] md_check_against_smtp_server and md_graphdefang_log
James Curtis
jameswcurtis at hotmail.com
Fri Mar 22 20:43:33 EDT 2013
I'm trying to piece together a filter that logs and blocks traffic that is unnecessary. I can't get md_graphdefang_log to put in an entry for items that are refused because of 'User unknown' responses. As you can tell from my code snip below, I am not a programmer. I am adding a few lines above, and a few lines below where I put my code for reference.
Blocking and logging is working for the DNSBL.
Blocking and logging are not working for the check against smtp server, but it is sending a bounce back and not trying to deliver to internal server.
Mimedefang version is 2.70.1
Any help would be greatly appreciated.
-Bill Curtis
# 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!!!
my($result);
# yea, I know that the DNSBL is more effecient in sendmail, but I want to know how many blocked for what user by blacklist.
if ($result = (relay_is_blacklisted($RelayAddr, "zen.spamhaus.org"))) {
md_graphdefang_log('spamhaus', $hits, $RelayAddr);
return action_bounce("reject: mail from ($RelayHostname || $RelayAddr) rejected due to http://www.spamhaus.org/zen");
# the reject works, but graphdefang log shows the Subject instead of Relay address
action_discard();
}
elsif ($result = (relay_is_blacklisted($RelayAddr, "bl.spamcop.net"))) {
md_graphdefang_log('spamcop', $hits, $RelayAddr);
return action_bounce("reject: mail from ($RelayHostname || $RelayAddr) rejected due to http://bl.spamcop.net/");
# the reject works, but graphdefang log shows the Subject instead of Relay address
action_discard();
}
sub filter_recipient
{
my($recip, $sender, $ip, $host, $first, $helo, $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
md_check_against_smtp_server($sender, $recip, "<filter serverexternal DNS name>", "<internal private address>");
md_graphdefang_log('notuser', $recip, $sender);
# graphdefang log doesn't log entry as 'notuser', eventually logs it as spam, or mail_in depending on score because of code that follows.
return action_discard();
}
# Drop anything with a score over 6 (*works)
if ($hits > 6) {
md_graphdefang_log('spamdrop', $hits, $RelayAddr);
action_discard();
}
# No sense doing any extra work
return if message_rejected();
# Spam checks if SpamAssassin is installed
if ($Features{"SpamAssassin"}) {
if (-s "./INPUTMSG" < 100*1024) {
More information about the MIMEDefang
mailing list