Re: Relay "as" domain rewrite

2019-08-19 Thread Darren S.
On Mon, Aug 19, 2019 at 10:38 AM  wrote:
>
> 19 août 2019 19:34 "Darren S."  a écrit:
>
> > Greetings,
> >
>
> hello,
>
>
> > I've been working through configuration changes from OpenBSD 6.5
> > upgrade. Have most things worked out, but hitting a situation where my
> > ISP (my smarthost for relayed mail) is rejecting due to reverse DNS
> > issues.
> >
> > e91c8dbd411c473d mta delivery evpid=66bc2327443bcac7
> > from=
> > to= rcpt=<-> source="10.0.1.2" relay="68.1.17.4
> > (smtp.east.cox.net)" delay=2s result="PermFail" stat="550
> >  sender rejected. Refer to
> > Error Codes section at
> > https://www.cox.com/residential/support/email-error-codes.html for
> > more information. AUP#CXDNS"
> >
> > I see in my old config I had the following for the matching rule:
> >
> > accept from source  for any relay via $dkim_relay as
> > "@sancho2k.net"
> >
> > I think the "as" option was the key at that time. The intent is that
> > mail normally routed internally with a sender address of
> > "u...@workstation.lan.example.net" would be rewritten when related
> > through ISP as "u...@example.net." Is this still a supported
> > configuration?
> >
>
> The "as" keyword was simply replaced with "mail-from" in relay actions.
>
> Your problem is unrelated:
>
> Your MX doesn't seem to have a valid rDNS and the remote host won't let
> you contact it without a valid rDNS.
>
> You can't fix this with smtpd config, it is a DNS issue to solve with your 
> ISP / server provider.

This may have worked actually - I don't think the ISP cares what the
reverse DNS is, I think it's more a check that the sender domain is
valid or can be resolved or something. This configuration got me
through that check:

action "relay_dkim" relay host $dkim_relay mail-from "@sancho2k.net"

Now failing at another check but this seems to be what I was after, at
least I think.

Thanks!

-- 
Darren Spruell
phatbuck...@gmail.com



filter assistance requested

2019-08-19 Thread Edgar Pettijohn
Nothing urgent here. Probably can wait for filter documentation. However, I've 
been
playing with filters off and on with limited success. It seems like data-line 
will 
be the most useful to filter on so thats been my focus lately. I have the 
following
script:

#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;

open(my $fh, '>', '/tmp/log.txt') or die $!;

# remove line buffering
select(STDOUT);
$|++;
select($fh);
$|++;

print STDOUT "register|filter|smtp-in|data-line\n";
print STDOUT "register|ready\n";

while ( <> ) {
chomp; # get rid of newline

my @report = split /\|/;

next if $report[0] eq 'config';

foreach (@report) {
print $fh "$_\|"; # just to see whats there
}
print $fh "\n";

my $inbody = 0;
my ($sid, $token, $line);
$sid = $report[5];
$token = $report[6];
$line = $report[$#report];
if ($report[0] eq 'filter' and $report[3] eq 'smtp-in' and $report[4] 
eq 'data-line') {
die "invalid filter command" if (scalar @report < 7);
if ($line eq '') { print $fh "end of headers\n"; $inbody++; }
if ($line eq '.') { print $fh "end of message\n"; $inbody--; }
print $fh "filter-dataline|$token|$sid|$line\n";
print STDOUT "filter-dataline|$token|$sid|$line\n";
}
}

close $fh;

0;

It prints the following in /tmp/log.txt after a 
$ echo "HI" | mail edgar

filter|0|1566239933.835511|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a|Received:
 from localhost (deathstar.my.domain [local])|
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|Received: from localhost 
(deathstar.my.domain [local])
filter|0|1566239933.835523|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a| 
by deathstar.my.domain (OpenSMTPD) with ESMTPA id 7052ea5a|
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|  by deathstar.my.domain 
(OpenSMTPD) with ESMTPA id 7052ea5a
filter|0|1566239933.835529|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a| 
for ;|
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|  for 
;
filter|0|1566239933.835533|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a| 
Mon, 19 Aug 2019 13:38:53 -0500 (CDT)|
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|  Mon, 19 Aug 2019 
13:38:53 -0500 (CDT)
filter|0|1566239933.836673|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a|From:
 Edgar Pettijohn |
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|From: Edgar Pettijohn 

filter|0|1566239933.836681|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a|Date:
 Mon, 19 Aug 2019 13:38:53 -0500 (CDT)|
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|Date: Mon, 19 Aug 2019 
13:38:53 -0500 (CDT)
filter|0|1566239933.836685|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a|To:
 edgar|
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|To: edgar
filter|0|1566239933.836688|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a|
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|ef8747a12860387a
filter|0|1566239933.836692|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a|HI|
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|HI
filter|0|1566239933.836695|smtp-in|data-line|c0002b41f6bd164d|ef8747a12860387a|.|
end of message
filter-dataline|ef8747a12860387a|c0002b41f6bd164d|.

I get the following response:
deathstar$ sendmail: command failed: 550 5.7.1 Delivery not authorized, message 
refused: Message is not RFC 2822 compliant

I see the same from a telnet session as well.

So there are 2 problems. First my script doesn't appear to acurately determine 
that the headers are finished. Second mail
doesn't go through. Any suggestions are appreciated.

Thanks,

Edgar



Re: Relay "as" domain rewrite

2019-08-19 Thread gilles
19 août 2019 19:34 "Darren S."  a écrit:

> Greetings,
> 

hello,


> I've been working through configuration changes from OpenBSD 6.5
> upgrade. Have most things worked out, but hitting a situation where my
> ISP (my smarthost for relayed mail) is rejecting due to reverse DNS
> issues.
> 
> e91c8dbd411c473d mta delivery evpid=66bc2327443bcac7
> from=
> to= rcpt=<-> source="10.0.1.2" relay="68.1.17.4
> (smtp.east.cox.net)" delay=2s result="PermFail" stat="550
>  sender rejected. Refer to
> Error Codes section at
> https://www.cox.com/residential/support/email-error-codes.html for
> more information. AUP#CXDNS"
> 
> I see in my old config I had the following for the matching rule:
> 
> accept from source  for any relay via $dkim_relay as
> "@sancho2k.net"
> 
> I think the "as" option was the key at that time. The intent is that
> mail normally routed internally with a sender address of
> "u...@workstation.lan.example.net" would be rewritten when related
> through ISP as "u...@example.net." Is this still a supported
> configuration?
> 

The "as" keyword was simply replaced with "mail-from" in relay actions.

Your problem is unrelated:

Your MX doesn't seem to have a valid rDNS and the remote host won't let
you contact it without a valid rDNS.

You can't fix this with smtpd config, it is a DNS issue to solve with your ISP 
/ server provider.



Relay "as" domain rewrite

2019-08-19 Thread Darren S.
Greetings,

I've been working through configuration changes from OpenBSD 6.5
upgrade. Have most things worked out, but hitting a situation where my
ISP (my smarthost for relayed mail) is rejecting due to reverse DNS
issues.

e91c8dbd411c473d mta delivery evpid=66bc2327443bcac7
from=
to= rcpt=<-> source="10.0.1.2" relay="68.1.17.4
(smtp.east.cox.net)" delay=2s result="PermFail" stat="550
 sender rejected. Refer to
Error Codes section at
https://www.cox.com/residential/support/email-error-codes.html for
more information. AUP#CXDNS"

I see in my old config I had the following for the matching rule:

accept from source  for any relay via $dkim_relay as
"@sancho2k.net"

I think the "as" option was the key at that time. The intent is that
mail normally routed internally with a sender address of
"u...@workstation.lan.example.net" would be rewritten when related
through ISP as "u...@example.net." Is this still a supported
configuration?

-- 
Darren Spruell
phatbuck...@gmail.com