You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by da...@chaosreigns.com on 2011/03/29 02:31:05 UTC
Getting last untrusted relay without scoring
What's the best way, taking advantage of existing SA code, to get the last
untrusted relay from an email (for use with black lists and white lists),
without going through scoring?
This is the one option I've gotten to work:
http://www.chaosreigns.com/iprep/dl/received.pl
It unfolds the Received headers with new code (didn't seem worth
loading another non-base perl module), and then feeds them one at a
time to Mail::SpamAssassin::Message::Metadata::parse_received_line().
And using more new code to check for trusted_relays. I tried to replicate
the trust inferring.
It seems like there should be a way to load an email into a $msg object:
my $msg = Mail::SpamAssassin::Message->new({'message' => $rawmessage, 'parse_now' => 1});
..And then get it to give me $self->{relays_untrusted_str}. But it looks
like that might only be available from a Mail::SpamAssassin::PerMsgStatus
object which is only returned by Mail::SpamAssassin::check()?
Working on a new, hopefully more automated, whitelist / reputation thing.
parse_received_line() is 1008 lines of (thankfully heavily commented)
nuts. It's embarrassing that Received headers are so nonstandard that
it takes that much code to parse them.
--
"It's never too late to panic."
http://www.ChaosReigns.com
Re: Getting last untrusted relay without scoring
Posted by "Kevin A. McGrail" <KM...@PCCC.com>.
On 3/28/2011 8:31 PM, darxus@chaosreigns.com wrote:
> What's the best way, taking advantage of existing SA code, to get the last
> untrusted relay from an email (for use with black lists and white lists),
> without going through scoring?
I'm not sure about the scoring question but have you looked at the code
that generates X-Spam-Relays-Untrusted? I had a similar question back
in 2009 and Justin pointed me towards this.
Regards,
KAM