Hi
Thanks for the answers (patpro also). Yes I looked at
check_policy_service and no problem hacking some script+db together
myself. Just wanted to make sure I didn't re-invent the wheel.
I'll start doing it tomorrow just in case so no one emails and says
"just use this" :D Postfix is so full of options,addons etc so you never
know.
Thanks
// Sebastian H
On 2021-08-30 15:39, post...@ptld.com wrote:
I would like to whitelist any sender that a user on my mail server has
sent an email to. Overriding some spamchecks,greylisting etc,
depending on where it is in the smtpd_recipient_restrictions order.
I do not believe there is a solution out of the box. But postfix gives
you the tools to custom build this behavior. You would need to setup
your own database to track the relationships between user and foreign
address. Then you can write two scripts to use with
check_policy_service. One script on the submission side for when mail
is sent to grab the rcpt address and store it in the database. The
second script on the smtp side for "incoming" mail, if the script
finds the mail-from address associated with the rcpt address then
return OK to accept the mail.
There is an example grey-list script doing similar to this at the
bottom of http://www.postfix.org/SMTPD_POLICY_README.html
You can see the values your script can return on
http://www.postfix.org/access.5.html
If someone else can chime in if I'm wrong on this part, but I'm 99%
sure a result of OK (vs dunno) accepts the mail and stops further
checks for the smtpd_*_restrictions section the check_policy_service
is used in.
PS. Another more complex option would be using your own built milter
to do the same behavior as a policy script would.