On Mon, 21 Jan 2019 11:08:02 +0100 Gilles Chehade wrote:
> I may sound a bit harsh, but starting a thread with "this is my last try
> or I'll switch" (as if it actually matters) right before telling someone
> who wants to help you that you actually tried _nothing_ then blaming the
> code improvements for a use-case that could have never worked because it
> not only uses the wrong _documented_ mechanism but also because the code
> to make your use-case work has never existed, kinds of irritates me.
> 
> I don't get royalties on smtpd install, please install whatever software
> fits your use case, this is how proper engineering works.

First of all thank you Gilles (and all the others who contributed to
this project) for your amazing work on OpenSMTPD!

That said, there is a kind of sender rewriting mechanism in OpenSMTP.
Well, it works for me (tm) I'm not saying it's perfect, it might be an
overkill but at least it does what I want it to do. The conf is
included below (only the part for rewriting the sender
address):
o /etc/mail/smtpd.conf
listen on all tls pki my.domain auth-optional
listen on lo0 port 10030 smtps pki my.domain tag MASQ auth senders { foo = 
masq@my.domain } masquerade

table masquser          { "toto@my.domain" }
table masq-alias        { "toto@my.domain" = "t...@example.com" }

table secrets           file:/etc/mail/secrets

action masq01 mbox virtual <masq-alias>
action masq02 relay host smtps://masqlabel@127.0.0.1:10030 auth <secrets> 
mail-from "masq@my.domain"

<match ... reject here>

match tag MASQ rcpt-to <masquser> action masq01
match from any rcpt-to <masquser> action masq02

<match ... relay here>

o /etc/mail/secrets
masqlabel foo:asuperpassword

When a mail is received (listen on all):
- check if it is rejected
- if not, if the email if for toto@my.domain, forward it to the very
same OpenSMTP daemon on port 10030 using the authenticated user foo and
using masq@my.domain as the MAIL-FROM in the SMTP session (enveloppe)
- when an email is received on port 10030, tag it with the label MASQ.
The authenticated user is allowed to send an email as the user
masq@my.domain. The keyword masquerade modifies the From header (the
message itself) to match the address given in the SMTP session
- at that point, the sender address is rewritten both in the SMTP
session and the headers
- if the email is for toto@my.domain and is tagged with the label MASQ,
the virtual user address is expanded to the real email address
- continue like a normal message

There is probably room for improvement but I hope this helps.

Reply via email to