check_policy_service ADDRESS in the restriction chains: asks a
Postfix policy server (https://www.postfix.org/SMTPD_POLICY_README.html)
such as postgrey or policyd-spf, with Sovite.Policy.Client.
ADDRESS is inet:host:port, unix:/path, or spawn:/path/to/program args..., for programs that speak the protocol on their standard input
and output, as Postfix's spawn(8) runs policyd-spf. Each request uses
a new connection.
The request has the attributes Postfix sends; protocol_state is the
stage (CONNECT, EHLO, MAIL, RCPT, DATA, END-OF-MESSAGE).
The reply's action counts like an access rule (access(5)):
| Action | Effect |
|---|---|
OK | Accept, ending the list. |
DUNNO, DEFER_IF_REJECT | Go on with the next check. |
REJECT [text], DEFER [text], DEFER_IF_PERMIT [text] | 554 5.7.1, 450 4.7.1, 450 4.7.1. |
4NN/5NN [x.y.z] text | That reply. |
HOLD [text], DISCARD [text] | Hold or drop the message. |
WARN text, INFO text | Log, and go on. |
PREPEND name: value | Add the header field at the top of the message. |
REDIRECT address | Deliver the message to address only. |
BCC address | Also deliver it to address. |
FILTER transport:nexthop | Send it to that content filter (see smtp.content_filter). |
When the server cannot be reached, does not answer within
policy.timeout, or sends something else, policy.default_action
applies (451 4.3.5 Server configuration problem by default), and the
error is reported with [:sovite, :policy, :client, :error].
Summary
Types
A decision, as Sovite.Core.Restrictions checks make them.
What a check adds to the message, besides a decision.
Functions
Asks the server at address about stage. context is the
restriction context: it has :policy (%{timeout, default_action},
the action already parsed) and :policy_request, a function that
returns the attributes of the session.
The session part of a request, from what the SMTP handler knows. Values that are not known are left out.
Whether address is a policy server address.
Types
@type decision() :: :continue | :permit | {:reject, Sovite.SMTP.Reply.t()} | {:hold, String.t()} | {:discard, String.t()} | {:effect, effect()}
A decision, as Sovite.Core.Restrictions checks make them.
@type effect() :: {:prepend, String.t()} | {:redirect, String.t()} | {:bcc, String.t()} | {:filter, String.t()}
What a check adds to the message, besides a decision.
Functions
Asks the server at address about stage. context is the
restriction context: it has :policy (%{timeout, default_action},
the action already parsed) and :policy_request, a function that
returns the attributes of the session.
The session part of a request, from what the SMTP handler knows. Values that are not known are left out.
Whether address is a policy server address.