I was curious so I did a quick test :) . As suspected, it does work.

Having a setup like:

smtpd_delay_reject = yes

smtpd_helo_required = yes
smtpd_helo_restrictions =
        ...
check_policy_service { unix:private/policy-service, policy_context=helo_restrictions_value }
        ...

smtpd_relay_restrictions =
        ...
check_policy_service { unix:private/policy-service, policy_context=relay_restrictions_value }
        ...


will allow you to pass the desired value to the policy server.


1st call result, for smtpd_helo_restrictions :

 Read line: "request=smtpd_access_policy"
 Read line: "protocol_state=RCPT"
 ...
 Read line: "policy_context=helo_restrictions_value"
 Read line: ""


2nd call result, for smtpd_relay_restrictions :

 Read line: "request=smtpd_access_policy"
 Read line: "protocol_state=RCPT"
 ...
 Read line: "policy_context=relay_restrictions_value"
 Read line: ""



Cheers,

K.


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 }
              ...

 From the SMTPD_POLICY_README:

The "policy_context" attribute provides a way to pass information that is not available via other attributes (Postfix version 3.1 and later).

I notice when using SMTPD_DELAY_REJECT=yes and calling a CHECK_POLICY_SERVICE inside SMTPD_HELO_RESTRICTIONS it will report "protocol_state = RCPT", same as when you call the policy service from inside SMTPD_RECIPIENT_RESTRICTIONS.

Is there a way to pass a value from the CHECK_POLICY_SERVICE line (or any other method), to know which restriction section the policy service is being ran inside of?

Could you give us a bit more details about what are you trying to do? :)


Cheers,

K.

Reply via email to