You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by Henry Miller <he...@gmx.com> on 2019/01/11 03:30:12 UTC
[Patch] detect Received header produced by amavisd-milter
Index: lib/Mail/SpamAssassin/Message/Metadata/Received.pm
===================================================================
--- lib/Mail/SpamAssassin/Message/Metadata/Received.pm (revision 1850997)
+++ lib/Mail/SpamAssassin/Message/Metadata/Received.pm (working copy)
@@ -619,6 +619,18 @@
}
}
+ elsif (/ \(amavisd-milter\)\;/) {
+ # Received: from localhost ([127.0.0.1] [127.0.0.1])
+ # by mail.local (amavisd-milter);
+ # # Thu, 10 Jan 2019 17:15:10 -0500 (EST)
+ if ( /^(\S+) \((\S+) \[(${IP_ADDRESS})\]\) by (\S+) / ) {
+ $mta_looked_up_dns = 1;
+ $helo = $1; $rdns = $2; $ip = $3; $by = $4;
+ if ($rdns =~ /^\[/) { $rdns = ''; }
+ goto enough;
+ }
+ }
+
elsif (/\(Scalix SMTP Relay/) {
# from DPLAPTOP ( 72.242.176.162) by mail.puryear-it.com (Scalix SMTP Relay 10.0.1.3) via ESMTP; Fri, 23 Jun 2006 16:39:47 -0500 (CDT)
if (/^(\S+) \( ?(${IP_ADDRESS})\) by (\S+)/) {
Re: [Patch] detect Received header produced by amavisd-milter
Posted by Henrik K <he...@hege.li>.
On Fri, Jan 11, 2019 at 04:19:26PM +0200, Henrik K wrote:
>
> On Fri, Jan 11, 2019 at 08:53:43AM -0500, Bill Cole wrote:
> > On 11 Jan 2019, at 3:53, Henrik K wrote:
> >
> > >Thanks, explaining things directly will help.
> > >
> > >I committed a simpler fix:
> > >http://svn.apache.org/viewvc?view=revision&sortby=date&revision=1851021
> >
> > Are you sure that it is doing the same thing?
> >
> > With a *cursory* look I think your fix is harmless, as it catches a style of
> > expressing a failure to find a valid PTR. However, I am somewhat familiar
> > with the inelegant complexity of the thousand-line parse_received_line() and
> > why it has so many baroque special cases, and I'm concerned that you may be
> > doing the exact opposite of Henry's patch. If amavisd-milter can't get a
> > name for its client (always localhost, yes?) that's not the same as any
> > actual MTA not getting a name, is it?
>
> Amavisd-milter gets what MTA provides as milter attributes, it makes no
> resolving itself. It's localhost only if the client connection originates
> from localhost.
And Postfix/Sendmail milter specification provides unknown as [1.2.3.4]
/* Transform unknown hostname from Postfix to Sendmail form. */
.... (ptr = concatenate("[", client_addr, "]", (char *) 0)));
There is absolutely no reason to pass rdns=!1.2.3.4! string to X-Relays-*
rules. It seems to just confuse the existing rules.
Re: [Patch] detect Received header produced by amavisd-milter
Posted by Henrik K <he...@hege.li>.
On Fri, Jan 11, 2019 at 08:53:43AM -0500, Bill Cole wrote:
> On 11 Jan 2019, at 3:53, Henrik K wrote:
>
> >Thanks, explaining things directly will help.
> >
> >I committed a simpler fix:
> >http://svn.apache.org/viewvc?view=revision&sortby=date&revision=1851021
>
> Are you sure that it is doing the same thing?
>
> With a *cursory* look I think your fix is harmless, as it catches a style of
> expressing a failure to find a valid PTR. However, I am somewhat familiar
> with the inelegant complexity of the thousand-line parse_received_line() and
> why it has so many baroque special cases, and I'm concerned that you may be
> doing the exact opposite of Henry's patch. If amavisd-milter can't get a
> name for its client (always localhost, yes?) that's not the same as any
> actual MTA not getting a name, is it?
Amavisd-milter gets what MTA provides as milter attributes, it makes no
resolving itself. It's localhost only if the client connection originates
from localhost.
Re: [Patch] detect Received header produced by amavisd-milter
Posted by Bill Cole <sa...@billmail.scconsult.com>.
On 11 Jan 2019, at 3:53, Henrik K wrote:
> Thanks, explaining things directly will help.
>
> I committed a simpler fix:
> http://svn.apache.org/viewvc?view=revision&sortby=date&revision=1851021
Are you sure that it is doing the same thing?
With a *cursory* look I think your fix is harmless, as it catches a
style of expressing a failure to find a valid PTR. However, I am
somewhat familiar with the inelegant complexity of the thousand-line
parse_received_line() and why it has so many baroque special cases, and
I'm concerned that you may be doing the exact opposite of Henry's patch.
If amavisd-milter can't get a name for its client (always localhost,
yes?) that's not the same as any actual MTA not getting a name, is it?
>
> On Fri, Jan 11, 2019 at 12:19:37AM -0700, hmiller wrote:
>> This patch fixes RDNS_NONE test. If the sender's reverse lookup
>> fails,
>> Received header line will contain the sender's IP address enclosed in
>> square
>> brackets (e.g. `[a.b.c.d]').
>>
>>
>> Henrik K wrote
>>> Can you describe what this patch achieves? I've been using
>>> amavisd-milter
>>> for years, I thought it works well already..
>>>
>>>
>>> On Fri, Jan 11, 2019 at 04:30:12AM +0100, Henry Miller wrote:
>>>> Index: lib/Mail/SpamAssassin/Message/Metadata/Received.pm
>>>> ===================================================================
>>>> --- lib/Mail/SpamAssassin/Message/Metadata/Received.pm (revision
>>>> 1850997)
>>>> +++ lib/Mail/SpamAssassin/Message/Metadata/Received.pm (working
>>>> copy)
>>>> @@ -619,6 +619,18 @@
>>>> }
>>>> }
>>>>
>>>> + elsif (/ \(amavisd-milter\)\;/) {
>>>> + # Received: from localhost ([127.0.0.1] [127.0.0.1])
>>>> + # by mail.local (amavisd-milter);
>>>> + # # Thu, 10 Jan 2019 17:15:10 -0500 (EST)
>>>> + if ( /^(\S+) \((\S+) \[(${IP_ADDRESS})\]\) by (\S+) / ) {
>>>> + $mta_looked_up_dns = 1;
>>>> + $helo = $1; $rdns = $2; $ip = $3; $by = $4;
>>>> + if ($rdns =~ /^\[/) { $rdns = ''; }
>>>> + goto enough;
>>>> + }
>>>> + }
>>>> +
>>>> elsif (/\(Scalix SMTP Relay/) {
>>>> # from DPLAPTOP ( 72.242.176.162) by mail.puryear-it.com
>>>> (Scalix
>>>> SMTP Relay 10.0.1.3) via ESMTP; Fri, 23 Jun 2006 16:39:47 -0500
>>>> (CDT)
>>>> if (/^(\S+) \( ?(${IP_ADDRESS})\) by (\S+)/) {
>>
>>
>>
>>
>>
>> --
>> Sent from:
>> http://spamassassin.1065346.n5.nabble.com/SpamAssassin-Dev-f69836.html
Re: [Patch] detect Received header produced by amavisd-milter
Posted by hmiller <he...@gmx.com>.
Thanks, your patch is better; implicitly fixing all libmilters.
Henrik K wrote
> Thanks, explaining things directly will help.
>
> I committed a simpler fix:
> http://svn.apache.org/viewvc?view=revision&sortby=date&revision=1851021
>
> On Fri, Jan 11, 2019 at 12:19:37AM -0700, hmiller wrote:
>> This patch fixes RDNS_NONE test. If the sender's reverse lookup fails,
>> Received header line will contain the sender's IP address enclosed in
>> square
>> brackets (e.g. `[a.b.c.d]').
>>
>>
>> Henrik K wrote
>> > Can you describe what this patch achieves? I've been using
>> amavisd-milter
>> > for years, I thought it works well already..
>> >
>> >
>> > On Fri, Jan 11, 2019 at 04:30:12AM +0100, Henry Miller wrote:
>> >> Index: lib/Mail/SpamAssassin/Message/Metadata/Received.pm
>> >> ===================================================================
>> >> --- lib/Mail/SpamAssassin/Message/Metadata/Received.pm (revision
>> 1850997)
>> >> +++ lib/Mail/SpamAssassin/Message/Metadata/Received.pm (working copy)
>> >> @@ -619,6 +619,18 @@
>> >> }
>> >> }
>> >>
>> >> + elsif (/ \(amavisd-milter\)\;/) {
>> >> + # Received: from localhost ([127.0.0.1] [127.0.0.1])
>> >> + # by mail.local (amavisd-milter);
>> >> + # # Thu, 10 Jan 2019 17:15:10 -0500 (EST)
>> >> + if ( /^(\S+) \((\S+) \[(${IP_ADDRESS})\]\) by (\S+) / ) {
>> >> + $mta_looked_up_dns = 1;
>> >> + $helo = $1; $rdns = $2; $ip = $3; $by = $4;
>> >> + if ($rdns =~ /^\[/) { $rdns = ''; }
>> >> + goto enough;
>> >> + }
>> >> + }
>> >> +
>> >> elsif (/\(Scalix SMTP Relay/) {
>> >> # from DPLAPTOP ( 72.242.176.162) by mail.puryear-it.com
>> (Scalix
>> >> SMTP Relay 10.0.1.3) via ESMTP; Fri, 23 Jun 2006 16:39:47 -0500 (CDT)
>> >> if (/^(\S+) \( ?(${IP_ADDRESS})\) by (\S+)/) {
>>
>>
>>
>>
>>
>> --
>> Sent from:
>> http://spamassassin.1065346.n5.nabble.com/SpamAssassin-Dev-f69836.html
--
Sent from: http://spamassassin.1065346.n5.nabble.com/SpamAssassin-Dev-f69836.html
Re: [Patch] detect Received header produced by amavisd-milter
Posted by Henrik K <he...@hege.li>.
Thanks, explaining things directly will help.
I committed a simpler fix:
http://svn.apache.org/viewvc?view=revision&sortby=date&revision=1851021
On Fri, Jan 11, 2019 at 12:19:37AM -0700, hmiller wrote:
> This patch fixes RDNS_NONE test. If the sender's reverse lookup fails,
> Received header line will contain the sender's IP address enclosed in square
> brackets (e.g. `[a.b.c.d]').
>
>
> Henrik K wrote
> > Can you describe what this patch achieves? I've been using amavisd-milter
> > for years, I thought it works well already..
> >
> >
> > On Fri, Jan 11, 2019 at 04:30:12AM +0100, Henry Miller wrote:
> >> Index: lib/Mail/SpamAssassin/Message/Metadata/Received.pm
> >> ===================================================================
> >> --- lib/Mail/SpamAssassin/Message/Metadata/Received.pm (revision 1850997)
> >> +++ lib/Mail/SpamAssassin/Message/Metadata/Received.pm (working copy)
> >> @@ -619,6 +619,18 @@
> >> }
> >> }
> >>
> >> + elsif (/ \(amavisd-milter\)\;/) {
> >> + # Received: from localhost ([127.0.0.1] [127.0.0.1])
> >> + # by mail.local (amavisd-milter);
> >> + # # Thu, 10 Jan 2019 17:15:10 -0500 (EST)
> >> + if ( /^(\S+) \((\S+) \[(${IP_ADDRESS})\]\) by (\S+) / ) {
> >> + $mta_looked_up_dns = 1;
> >> + $helo = $1; $rdns = $2; $ip = $3; $by = $4;
> >> + if ($rdns =~ /^\[/) { $rdns = ''; }
> >> + goto enough;
> >> + }
> >> + }
> >> +
> >> elsif (/\(Scalix SMTP Relay/) {
> >> # from DPLAPTOP ( 72.242.176.162) by mail.puryear-it.com (Scalix
> >> SMTP Relay 10.0.1.3) via ESMTP; Fri, 23 Jun 2006 16:39:47 -0500 (CDT)
> >> if (/^(\S+) \( ?(${IP_ADDRESS})\) by (\S+)/) {
>
>
>
>
>
> --
> Sent from: http://spamassassin.1065346.n5.nabble.com/SpamAssassin-Dev-f69836.html
Re: [Patch] detect Received header produced by amavisd-milter
Posted by hmiller <he...@gmx.com>.
This patch fixes RDNS_NONE test. If the sender's reverse lookup fails,
Received header line will contain the sender's IP address enclosed in square
brackets (e.g. `[a.b.c.d]').
Henrik K wrote
> Can you describe what this patch achieves? I've been using amavisd-milter
> for years, I thought it works well already..
>
>
> On Fri, Jan 11, 2019 at 04:30:12AM +0100, Henry Miller wrote:
>> Index: lib/Mail/SpamAssassin/Message/Metadata/Received.pm
>> ===================================================================
>> --- lib/Mail/SpamAssassin/Message/Metadata/Received.pm (revision 1850997)
>> +++ lib/Mail/SpamAssassin/Message/Metadata/Received.pm (working copy)
>> @@ -619,6 +619,18 @@
>> }
>> }
>>
>> + elsif (/ \(amavisd-milter\)\;/) {
>> + # Received: from localhost ([127.0.0.1] [127.0.0.1])
>> + # by mail.local (amavisd-milter);
>> + # # Thu, 10 Jan 2019 17:15:10 -0500 (EST)
>> + if ( /^(\S+) \((\S+) \[(${IP_ADDRESS})\]\) by (\S+) / ) {
>> + $mta_looked_up_dns = 1;
>> + $helo = $1; $rdns = $2; $ip = $3; $by = $4;
>> + if ($rdns =~ /^\[/) { $rdns = ''; }
>> + goto enough;
>> + }
>> + }
>> +
>> elsif (/\(Scalix SMTP Relay/) {
>> # from DPLAPTOP ( 72.242.176.162) by mail.puryear-it.com (Scalix
>> SMTP Relay 10.0.1.3) via ESMTP; Fri, 23 Jun 2006 16:39:47 -0500 (CDT)
>> if (/^(\S+) \( ?(${IP_ADDRESS})\) by (\S+)/) {
--
Sent from: http://spamassassin.1065346.n5.nabble.com/SpamAssassin-Dev-f69836.html
Re: [Patch] detect Received header produced by amavisd-milter
Posted by Henrik K <he...@hege.li>.
Can you describe what this patch achieves? I've been using amavisd-milter
for years, I thought it works well already..
On Fri, Jan 11, 2019 at 04:30:12AM +0100, Henry Miller wrote:
> Index: lib/Mail/SpamAssassin/Message/Metadata/Received.pm
> ===================================================================
> --- lib/Mail/SpamAssassin/Message/Metadata/Received.pm (revision 1850997)
> +++ lib/Mail/SpamAssassin/Message/Metadata/Received.pm (working copy)
> @@ -619,6 +619,18 @@
> }
> }
>
> + elsif (/ \(amavisd-milter\)\;/) {
> + # Received: from localhost ([127.0.0.1] [127.0.0.1])
> + # by mail.local (amavisd-milter);
> + # # Thu, 10 Jan 2019 17:15:10 -0500 (EST)
> + if ( /^(\S+) \((\S+) \[(${IP_ADDRESS})\]\) by (\S+) / ) {
> + $mta_looked_up_dns = 1;
> + $helo = $1; $rdns = $2; $ip = $3; $by = $4;
> + if ($rdns =~ /^\[/) { $rdns = ''; }
> + goto enough;
> + }
> + }
> +
> elsif (/\(Scalix SMTP Relay/) {
> # from DPLAPTOP ( 72.242.176.162) by mail.puryear-it.com (Scalix SMTP Relay 10.0.1.3) via ESMTP; Fri, 23 Jun 2006 16:39:47 -0500 (CDT)
> if (/^(\S+) \( ?(${IP_ADDRESS})\) by (\S+)/) {