I'm trying to reconfigure my Postfix mail server to stop it from improperly relaying mail to addresses that are listed as recipients but don't have my server's domain.
Say my mail server's domain is abc.campus.edu
. It's currently set up to forward mail received at user@abc.campus.edu
to the address defined in /home/user/.forward
that is usually some campus.edu
address, translating aliases as needed. I also use GNU Mailman, though I'm not sure if that's relevant.
Recently, campus staff informed me that my server sends spam/improperly forwards mail by the following mechanism:
- Mail is sent To:
user1@abc.campus.edu
, Cc:user2@campus.edu
- My server receives the mail and relays it to both recipients
campus.edu
server also delivers mail to user2 via google mail, so user2 gets duplicate mail
I've tried to set the transport method to discard
for all recipients except those with the abc.campus.edu
domain, and I've also messed around with check_recipient_access
, but I suspect these aren't working because I still need to forward mail to addresses in ~/.forward
which have other domains. I've also made sure relay_domains = mail.abc.campus.edu, abc.campus.edu
only. One last lead I have is to set up multiple Postfix instances, but I have little idea how to do so.
I'm very new to mail systems, so please correct any wrong terminology or concepts I may have. I can also try to provide more details of my config if needed.
Edit: mail logs showing an instance of this issue, where z***@gmail.com sends mail to k***@abc.campus.edu and d***@campus.edu. Here, d***@campus.edu would receive duplicate mail.
Jun 22 15:50:54 tap postfix/pickup[29985]: F26A71403CC: uid=500 from=<z***@gmail.com>
Jun 22 15:50:54 tap postfix/cleanup[30500]: F26A71403CC: message-id=<C***@mail.gmail.com>
Jun 22 15:50:54 tap postfix/pipe[30501]: 8B6BA1401B9: to=<k***@abc.campus.edu>, relay=spamchk, delay=1.5, delays=0.4/0.01/0/1.1, dsn=2.0.0, status=sent (delivered via spamchk service)
Jun 22 15:50:54 tap postfix/qmgr[28204]: 8B6BA1401B9: removed
Jun 22 15:50:55 tap postfix/qmgr[28204]: F26A71403CC: from=<z***@gmail.com>, size=3039, nrcpt=2 (queue active)
Jun 22 15:50:55 tap postfix/cleanup[30500]: 102281401B9: message-id=<C***@mail.gmail.com>
Jun 22 15:50:55 tap postfix/local[30510]: F26A71403CC: to=<k***@abc.campus.edu>, relay=local, delay=0.17, delays=0.1/0.02/0/0.06, dsn=2.0.0, status=sent (forwarded as 102281401B9)
Jun 22 15:50:55 tap postfix/qmgr[28204]: 102281401B9: from=<z***@gmail.com>, size=3186, nrcpt=1 (queue active)
Jun 22 15:50:55 tap postfix/smtp[30511]: F26A71403CC: to=<d***@campus.edu>, relay=aspmx.l.google.com[142.250.101.27]:25, delay=0.56, delays=0.1/0.01/0.18/0.27, dsn=2.0.0, status=sent (250 2.0.0 OK 162440225\
5 d19si19674059oic.53 - gsmtp)
Jun 22 15:50:55 tap postfix/qmgr[28204]: F26A71403CC: removed
Jun 22 15:50:55 tap postfix/smtp[30512]: 102281401B9: to=<k***@campus.edu>, orig_to=<k***@abc.campus.edu>, relay=aspmx.l.google.com[142.250.101.27]:25, delay=0.71, delays=0.03/0.01/0.13/0.55, d\
sn=2.0.0, status=sent (250 2.0.0 OK 1624402255 a205si20989161oib.12 - gsmtp)
Jun 22 15:50:55 tap postfix/qmgr[28204]: 102281401B9: removed