As it turns out, no, that doesn't work.
Trying to fix up broken sender mail domain-parts only simply gets me a "5.2.4 
Mailing list expansion problem" error, with no debug output to suggest why.

In this test case, my translations map had:

        @bad.athompso.net @good.athompso.net

in it.  Obviously, this is a test setup :).
Smtpd.conf itself consisted of:

        listen on all received-auth
        smtp max-message-size 100M
        table translations file:/etc/mail/translations          # ORIG->NEW 
mappings
        table allowed-hosts file:/etc/mail/allowed-hosts        # Who can 
connect?  (bare IP addresses or CIDR subnets)
        action translate lmtp "/var/run/lmtp.sock" virtual <translations>       
# 1st pass on allowed rewrite mail
        action forward forward-only                                             
# and now it's not our problem anymore
        match for any from local action forward                 # 2nd pass for 
reinjected mail, this time just forward it
        match for any from src <allowed-hosts> action translate # inbound mail 
- hand it to LMTP, translating as we go

A cursory glance at the source code (yikes, it's been a long time since I was a 
programmer) suggests that virtual now only works on recipients, not senders.  
Which is too bad for me, as that means I'll have to switch at least one box to 
use Postfix.

I'm not convinced the new smtpd.conf grammar improves anything at all, but I 
assume it must help someone or it wouldn't have changed... but I believe my use 
case got thrown out with the bathwater, so to speak.  Oh, well.  :-(

(If anyone cares, the bad sender addresses are mostly alerts coming from older 
Sun ALOMs and at least one Lexmark printer that also sends email with broken 
From addresses.)

-Adam

 
-----Original Message-----
From: owner-m...@openbsd.org <owner-m...@openbsd.org> On Behalf Of Adam Thompson
Sent: Wednesday, January 16, 2019 8:26 AM
To: 'Edgar Pettijohn' <ed...@pettijohn-web.com>; misc@openbsd.org
Subject: Re: smtpd - help needed tranlsating to new virtual map syntax

As I said, I haven't tried anything yet as I don't want to break a working 
system, and I don't have a good way to test this in parallel right now. 

The manpage says "The local delivery methods support additional options: [...] 
virtual" without specifying which delivery methods are "local".  My assumption 
was that only "mbox" and "mda" were local, as lmtp can, and often does, point 
to another server.

Some brief experiments with a VM only got me syntax errors, so I didn't pursue 
that very thoroughly before asking for clarification.

-Adam

-----Original Message-----
From: Edgar Pettijohn <ed...@pettijohn-web.com>
Sent: Wednesday, January 16, 2019 8:12 AM
To: Adam Thompson <athom...@athompso.net>; misc@openbsd.org
Subject: Re: smtpd - help needed tranlsating to new virtual map syntax

It would be helpful if you show what you have tried.

Should be as simple as:

action "relay-01" lmtp /var/run/lmtp.sock virtual <vmap>

match from src <localnets> action "relay-01"

Edgar
On Jan 16, 2019 7:37 AM, Adam Thompson <athom...@athompso.net> wrote:
>
> [Cross-posting here before I give up and switch to Postfix  -Adam]
>
>
> I have an old instance that uses smtpd's virtual <vmap> to rewrite *sender* 
> addresses.
> Reading the 6.4-STABLE version of the smtpd.conf(5) manpage, I can't see how 
> to accomplish my goal any more - it looks impossible.
>
> I don't want to upgrade a working mail relay server to something that might 
> be broken, so I'm seeking assistance first.
>
> The purpose of this system is purely to relay mail from internal, 
> semi-broken-ish systems out to our Office365 tenant, but I need to clean up 
> bogus MAIL FROM / "From:" headers first, lest they be flagged as spam.
>
> In general, I think I'm asking how to use virtual <map> with the "relay" 
> action in the new syntax - the manual tells me this is impossible!?
>
> Thanks,
> -Adam
>
>
> Old smtpd.conf:
>
> ===start===
> listen on 0.0.0.0
> listen on ::
> table aliases db:/etc/opensmtpd/aliases.db table vmap 
> db:/etc/opensmtpd/vmap.db table localnets { 192.168.10.0/24, 
> 192.168.100.0/24, 192.168.157.0/24, 192.168.158.0/24,
> 192.168.101.0/24, 10.158.0.0/16 } accept from local                 
> for any                relay via 
> smtp://XXX-ca.mail.protection.outlook.com hostname remote.XXX.ca 
> accept from source 192.168.158.63 for domain 192.168.158.63 virtual 
> <vmap> deliver to lmtp localhost:25 accept from source 192.168.100.63 
> for domain 192.168.100.63 virtual <vmap> deliver to lmtp localhost:25
> accept from source 192.168.158.63 for any                relay via 
> smtp://XXX-ca.mail.protection.outlook.com as sys...@xxx.ca hostname 
> remote.XXX.ca accept from source 192.168.100.63 for any                
> relay via smtp://XXX-ca.mail.protection.outlook.com as sys...@xxx.ca 
> hostname remote.XXX.ca accept from source <localnets>    for any              
>   
> relay via smtp://XXX-ca.mail.protection.outlook.com hostname 
> remote.XXX.ca ===end===
>
> old vmap:
>
> ===start===
> ilom-alert@192.168.100.63:      sys...@xxx.ca
> sys...@xxx.ca:   sys...@xxx.ca
> sys...@ad.xxx.ca: sys...@xxx.ca
> root@XXX.local: sys...@xxx.ca
> ===end===
>
>


Reply via email to