Sovite.Core.Greylist (sovite v0.6.0)

Copy Markdown View Source

Built-in greylisting ([greylist]), with Sovite.Abuse.Greylist deciding and the greylist_entries table remembering.

A triplet (client network, sender, recipient) seen for the first time is deferred. A retry after greylist.delay, and within greylist.retry_window, passes, and the triplet then passes at once until it has gone unused for greylist.max_age. Real mail servers retry; most spam bots do not.

If the database fails, the recipient passes: greylisting must never lose mail. In a cluster whose nodes have their own SQLite databases, entries go to the other nodes (Sovite.Core.Cluster.Sync).

As a process, it deletes expired entries every hour.

Telemetry

  • [:sovite, :greylist, :deferred] - %{retry_after} (seconds), %{client_network, sender, recipient}

Summary

Functions

Whether mail from ip and sender to recipient may pass now.

Returns a specification to start this module under a supervisor.

Greylisting options from the config, or nil when it is off.

Functions

check(opts, ip, sender, recipient)

@spec check(map() | nil, :inet.ip_address(), String.t(), String.t()) ::
  :pass | {:defer, pos_integer()}

Whether mail from ip and sender to recipient may pass now.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

opts(config, repo)

@spec opts(Sovite.Core.Config.t(), Sovite.Core.Repo.t() | nil) :: map() | nil

Greylisting options from the config, or nil when it is off.