Tenants ([[tenant]]), for hosting the mail of several customers on
one server or cluster, each with its own limits, signing keys, and
outbound IP pool.
[[tenant]]
name = "acme"
domains = ["acme.example"]
users = ["relay-user"]
ip_pool = "acme"
messages = "10000/1d"
recipients = "50000/1d"
max_message_size = "10M"
max_recipients = 500Which tenant a message belongs to
Mail a client submits belongs to a tenant when the client logged in
as one of the tenant's users, or with a login in one of its
domains (user@acme.example, or a subdomain), or else, for clients
that logged in or are in smtp.trusted_networks, when the sender's
domain is one of its domains. Mail from anyone else, such as mail
arriving from the internet, belongs to no tenant. The tenant is kept
with the queued message.
What a tenant gets
- Limits, on top of the server's:
messagesandrecipientsper period for the whole tenant (rate limits, shared by the cluster), andmax_message_sizeandmax_recipientsper message. - DKIM keys: the keys of a tenant's domains (
[[dkim.key]]) sign only that tenant's mail, so one customer cannot sign as another. - An IP pool (
ip_pool, seeSovite.Core.IPPools) to send from, instead ofdelivery.ip_pool. An address the sender relays table gives for a sender comes first.
Telemetry
[:sovite, :tenant, :limited]-%{},%{tenant, limit}, when a tenant limit refuses a message or recipient:limitis:messages,:recipients,:max_message_size, or:max_recipients.
Summary
Functions
The tenant of a message from a client logged in as identity (or
nil), from sender, by a client that is trusted or not.
The tenant named name (from a queued message), if it is still configured.
Counts a message of tenant with size bytes (or nil when not
known yet). Returns :ok, or {:limited, limit}.
Tenant options for sessions, or nil without tenants.
The tenant that owns domain or its closest parent domain, if any:
the one whose DKIM keys for the domain may sign.
Counts the countth recipient of a message of tenant. Returns :ok
or {:limited, limit}.
Whether a message of size bytes is too large for tenant.
Functions
The tenant of a message from a client logged in as identity (or
nil), from sender, by a client that is trusted or not.
@spec get([Sovite.Core.Config.tenant()], String.t() | nil) :: map() | nil
The tenant named name (from a queued message), if it is still configured.
@spec message(map() | nil, map() | nil, non_neg_integer() | nil) :: :ok | {:limited, :messages | :max_message_size}
Counts a message of tenant with size bytes (or nil when not
known yet). Returns :ok, or {:limited, limit}.
@spec opts(Sovite.Core.Config.t(), atom() | nil) :: map() | nil
Tenant options for sessions, or nil without tenants.
@spec owner([Sovite.Core.Config.tenant()], String.t()) :: String.t() | nil
The tenant that owns domain or its closest parent domain, if any:
the one whose DKIM keys for the domain may sign.
@spec recipient(map() | nil, map() | nil, pos_integer()) :: :ok | {:limited, :recipients | :max_recipients}
Counts the countth recipient of a message of tenant. Returns :ok
or {:limited, limit}.
@spec too_large?(map() | nil, non_neg_integer()) :: boolean()
Whether a message of size bytes is too large for tenant.