You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Logan Shaw <ls...@emitinc.com> on 2006/08/11 01:02:25 UTC

SPF and envelope senders

Hey everyone,

Our company happens to have a major customer who publishes an
SPF record for their domain, so I decided to whitelist them
with an entry like

 	spf_whitelist_from *@majorcustomer.com

However, in my tests (and in the logs), they are not hitting
that rule.  Grabbing one of the messages and piping it to
"spamassassin -D" on the command line, I see messages like this:

 	[12332] dbg: spf: cannot get Envelope-From, cannot use SPF
 	[12332] dbg: spf: def_spf_whitelist_from: could not find useable envelope sender

However, if I hand-edit the message file and add

 	Return-Path: <us...@majorcustomer.com>

as the first line of the file, then it works, and I get output
like this:

 	[12364] dbg: spf: query for username@majorcustomer.com/10.20.30.40/foo.bar.majorcustomer.com: result: pass
 	[12364] dbg: spf: whitelist_from_spf: username@majorcustomer.com is in user's WHITELIST_FROM_SPF and passed SPF check

and the score summary shows SPF_PASS and USER_IN_SPF_WHITELIST too.

So I looked in my own personal mailbox to see which messages
have Return-Path headers, and out of the hundreds of messages
in there, basically all messages do have a Return-Path header,
except that not a single one from from majorcustomer.com does.

So...  is it safe to assume their servers are configured
incorrectly?  Or should our MTA be somehow adding that
header if it's missing?  Or is there some other way that our
MailScanner+SpamAssassin combo should be getting the envelope
sender information?

   - Logan

Re: SPF and envelope senders

Posted by Logan Shaw <ls...@emitinc.com>.
On Thu, 10 Aug 2006, Daryl C. W. O'Shea wrote:
> Logan Shaw wrote:

>> So I looked in my own personal mailbox to see which messages
>> have Return-Path headers, and out of the hundreds of messages
>> in there, basically all messages do have a Return-Path header,
>> except that not a single one from from majorcustomer.com does.
>> 
>> So...  is it safe to assume their servers are configured
>> incorrectly?  Or should our MTA be somehow adding that
>> header if it's missing?  Or is there some other way that our
>> MailScanner+SpamAssassin combo should be getting the envelope
>> sender information?

> Your MDA should be adding it, and whatever is calling SpamAssassin 
> (MailScanner) should be at least faking it in the message it hands SA.

Well, MTA since MailScanner is scanning while the message is
still in the MTA phase of things.

But, here's the funny thing.  If I connect to our mail server
on port 25 and submit a message manually to the SMTP server
(sendmail 8.13.7) by hand, it does get added.  That is, if I
do this (edited for brevity):

 	$ telnet localhost smtp
 	helo blah.blah.emitinc.com
 	mail from: lshaw@emitinc.com
 	rcpt to: lshaw@emitinc.com
 	data
 	From: lshaw@emitinc.com
 	To: lshaw@emitinc.com
 	Subject: testing

 	body body body
 	.

then the message I receive in my mailbox will have Return-Path
added.  So apparently if it's missing, it adds it, and
if it's there, it preserves it, except if it comes from
majorcustomer.com, in which case it doesn't exist.

   - Logan

Re: SPF and envelope senders

Posted by Logan Shaw <ls...@emitinc.com>.
On Thu, 10 Aug 2006, Craig Morrison wrote:
> Daryl C. W. O'Shea wrote:
>> Logan Shaw wrote:

>>> So...  is it safe to assume their servers are configured
>>> incorrectly?  Or should our MTA be somehow adding that
>>> header if it's missing?  Or is there some other way that our
>>> MailScanner+SpamAssassin combo should be getting the envelope
>>> sender information?

>> Your MDA should be adding it, and whatever is calling SpamAssassin 
>> (MailScanner) should be at least faking it in the message it hands SA.

> http://wiki.apache.org/spamassassin/EnvelopeSenderInReceived
>
> Is also useful for the bag of tricks too..

Ah, so since I'm using sendmail, I should define
"confRECEIVED_HEADER" in my sendmail.mc as in the example at
that wiki page?  Is there any negative side to doing that?

   - Logan

Re: SPF and envelope senders

Posted by Craig Morrison <cr...@2cah.com>.
Daryl C. W. O'Shea wrote:
> Logan Shaw wrote:
> 
>> So I looked in my own personal mailbox to see which messages
>> have Return-Path headers, and out of the hundreds of messages
>> in there, basically all messages do have a Return-Path header,
>> except that not a single one from from majorcustomer.com does.
>>
>> So...  is it safe to assume their servers are configured
>> incorrectly?  Or should our MTA be somehow adding that
>> header if it's missing?  Or is there some other way that our
>> MailScanner+SpamAssassin combo should be getting the envelope
>> sender information?
> 
> Your MDA should be adding it, and whatever is calling SpamAssassin 
> (MailScanner) should be at least faking it in the message it hands SA.
> 
> Daryl
> 

http://wiki.apache.org/spamassassin/EnvelopeSenderInReceived

Is also useful for the bag of tricks too..

-- 
Craig

Re: SPF and envelope senders

Posted by "Daryl C. W. O'Shea" <sp...@dostech.ca>.
Logan Shaw wrote:

> So I looked in my own personal mailbox to see which messages
> have Return-Path headers, and out of the hundreds of messages
> in there, basically all messages do have a Return-Path header,
> except that not a single one from from majorcustomer.com does.
> 
> So...  is it safe to assume their servers are configured
> incorrectly?  Or should our MTA be somehow adding that
> header if it's missing?  Or is there some other way that our
> MailScanner+SpamAssassin combo should be getting the envelope
> sender information?

Your MDA should be adding it, and whatever is calling SpamAssassin 
(MailScanner) should be at least faking it in the message it hands SA.

Daryl

Re: SPF and envelope senders

Posted by Matt Kettler <mk...@comcast.net>.
Logan Shaw wrote:
>  
>
> So...  is it safe to assume their servers are configured
> incorrectly?  Or should our MTA be somehow adding that
> header if it's missing?  Or is there some other way that our
> MailScanner+SpamAssassin combo should be getting the envelope
> sender information? 

MailScanner versions of any reasonably recent vintage add a
X-MailScanner-From: header to each message before passing it to SA.

 Edit your SA local.cf file and add:

envelope_sender_header X-MailScanner-From


Re: SPF and envelope senders

Posted by Benny Pedersen <me...@junc.org>.
On Fri, August 11, 2006 01:02, Logan Shaw wrote:

> So...  is it safe to assume their servers are configured
> incorrectly?

no thay just use another header

fix with my config

change this config to what your mta adds as header

-- 
Benny