On 07-08-2021 5:27 pm, Kevin N. wrote: Haven't tried it, but this might be what you are looking for. http://www.postfix.org/SMTPD_POLICY_README.html#advanced check_policy_service { inet:host:port, timeout=10s, default_action=DUNNO policy_context=submission } ...
I saw that but didn't understand what policy context did. I missed the sentence up at the top of the page. Thanks for pointing it out to me. I tested it using the policy_context like:
check_policy_service {unix:private/custompolicy policy_context=testvalue}
This did pass policy_context=testvalue into the script, however it ended up spawning two copies of the script instead of reusing the same one for both restriction checks as it does without passing a policy_context. I was hoping to avoid the expense of spawning two copies of the script, otherwise i might as well just write two separate scripts tailored to each restriction.
Is there a way to reuse the same instance of the script, not spawn two instances, and some how have the script know which restriction it was called from?
Could you give us a bit more details about what are you trying to do? :)
Just writing my own policy that can be called from helo_restrictions to whitelist hostnames per user, then called again from recipient_restrictions to reject addresses per user.