Hi there,

I don’t know if you’ve got an answer off-list or fixed your issue, but here is my quick analysis.

Le 09/07/2023 à 03:10, Andrea D'Amore a écrit :
Hello,
I am using a opensmtpd 7.3.0 instance to collect and forward email from my
domains toward a gmail account.

My stripped down config is:


     table aliases { [email protected] }
     table addresses { "test[-+]?[0-9]*@mydomain\.net" }
     table forwardedrecipients { [email protected] }

     pki "mydomain.net" cert "/etc/letsencrypt/live/mydomain.net/fullchain.pem"
     pki "mydomain.net" key "/etc/letsencrypt/live/mydomain.net/privkey.pem"

     srs key "Ku2PP9TZm3DtWS+fak7wQNu6mPiLpV6aRyuUF7uq"

     filter   "rdns" phase connect match   !rdns disconnect "550 DNS error"
     filter "fcrdns" phase connect match !fcrdns disconnect "550 DNS error"
     filter "rspamd" proc-exec "/usr/libexec/opensmtpd/filter-rspamd"

     listen on eth0 port 25 tls pki "mydomain.net" filter { "rdns",
"fcrdns", "rspamd" }

     action "relay" relay srs
     action "aliasedrelay" forward-only virtual <aliases>

     match from any for rcpt-to regex <addresses> action "aliasedrelay"
     match from local for any action "relay"

in this example I am catching (rather trying to catch) everything
toward test*@mydomain.net and forward that to mynicefake gmail
mailbox.

My previous regex was "test(\+[a-zA-Z0-9_.-]*)?@mydomain\.net",
mimicking Gmail's `user+tag@` feature.
Now I am trying to expand that to allow dash and to use arbitrary
characters after, I am using 0-9 for the tests, once it work I'll add
the alphas.

The config I pasted works fine for messages addressed to   test+123
@mydomain.net or  test @mydomain.net  but fails if I use a dash in
place of plus sign, or remove the sign at all, in that case I get

     result="524 5.2.4 Mailing list expansion problem: <[email protected]>"

whereas using the plus sign I get a nice SRS forwarding.

I am attaching config and logs since Gmail's web is breaking line length.


What is wrong in my config?

What's so special about the plus sign?

The problem is in your aliases table. As per https://man.openbsd.org/aliases.5, the + part is removed by smtpd for matching user-part in the table, but other symbols are not. I think you need virtual table instead (https://man.openbsd.org/smtpd.conf#virtual) and catch-all (see https://man.openbsd.org/table.5#Aliasing_tables) if that’s suitable for you (as you will already have filtered before).

Regards.


Reply via email to