A policy server: a Sovite.Listener whose connections speak the policy
delegation protocol, with the decisions made by a
Sovite.Policy.Handler.
children = [
{Sovite.Policy.Server, port: 10023, ip: {127, 0, 0, 1}, handler: {Greylist, []}}
]Postfix can then ask it with check_policy_service inet:127.0.0.1:10023.
The server is also a Sovite.Listener.Handler, so it can be given to
a listener directly, with the server options as :handler_opts:
{Sovite.Listener, port: 10023, handler: Sovite.Policy.Server, handler_opts: [handler: {Greylist, []}]}Each connection serves requests one after the other until the client
closes it. A request that is malformed (a line that is not
name=value, or an empty one), has a line over :max_line bytes or
more than :max_attributes attributes, or is not complete within
:idle_timeout of the previous reply (or of the connection), closes
the connection without a reply. When a name comes more than once in a
request, the last value wins.
Options
Listener options (see Sovite.Listener): :port, :ip, :id,
:name, :acceptors, :max_connections, :max_connections_per_ip.
:handler-{module, opts}ormodule, aSovite.Policy.Handler. Required.:max_line- bytes of a request line. Defaults to 8192.:max_attributes- attributes of a request. Defaults to 100.:idle_timeout- milliseconds. Defaults to 300 seconds, like Postfix'smax_idle.
Telemetry
[:sovite, :policy, :server, :request, :stop]-%{duration},%{listener, remote_ip, attributes, action}, for each request.durationis the time spent in the handler,attributesthe request, andactionthe text sent, ornilwhen the handler closed the connection.[:sovite, :policy, :server, :error]-%{},%{listener, remote_ip, reason}, when a request closes the connection.reasonis:malformed,:line_too_long,:too_many_attributes, or:timeout.
Summary
Functions
Starts the server. See the module docs for options.
Functions
@spec start_link(keyword()) :: Supervisor.on_start()
Starts the server. See the module docs for options.