Skip to content

Relay rules for sender are not honored in some cases #7433

@lucagasparini

Description

@lucagasparini

When configuring multiple relay rules for different senders but using the same host and port, only the first configured one in chronological order is always used.

Steps to reproduce

  • creates two relay rules for senders with the same host and port (in chronological order first for user1 and then for user2)
    for example:
runagent -m mail1 podman exec -ti postfix ash -l
rl1:/etc/postfix# sqlite3 /srv/pcdb.sqlite
sqlite> select * from relayrules;

sender|user1@lg.nethserver.net|smtp|rl2.demo.neth.eu|587|encrypt|relay1|******|1
sender|user2@lg.nethserver.net|smtp|rl2.demo.neth.eu|587|encrypt|relay2|******|1
  • send an email with from user2@lg.nethserver.net

Expected behavior

  • the email is sent via Relay Host with sasl_username=user2 authentication

Actual behavior

  • the email is sent via Relay Host with sasl_username=user1 authentication

from the maillog of the mail server that sends:

rl1 postfix/smtpd[1112149]: 51E56C011401: client=cluster-localnode[10.5.4.1], sasl_method=LOGIN, sasl_username=user2
rl1 postfix/cleanup[1112151]: 51E56C011401: message-id=<1592469657.17.1746000737282@webtop>
rl1 postfix/qmgr[1110131]: 51E56C011401: from=<user2@lg.nethserver.net>, size=1397, nrcpt=1 (queue active)
postfix/smtp[1112154]: 51E56C011401: to=<test@test.net>, relay=rl2.demo.neth.eu[147.182.130.69]:587, delay=2.4, delays=0.43/0.03/1.1/0.79, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as EA764F801C40)

from maillog host rl2.demo.neth.eu

rl2 postfix/smtpd[2523490]: EA764F801C40: client=rl1.lg.nethserver.net[128.199.41.194], sasl_method=LOGIN, sasl_username=relay1

I think the problem is in the query used here:
https://github.com/NethServer/ns8-mail/blob/main/postfix/etc/postfix/relaysender_transport.cf

Components

Mail 1.6.2

See also


Many thanks to Emiliano Vavassori (Ref: #189033)

Metadata

Metadata

Assignees

Labels

verifiedAll test cases were verified successfully

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions