Karta.Reports.Sending (Karta v1.0.0)

Karta's own reports about other people's mail: the DMARC aggregate report (RFC 7489 §7.2) for the mail it received, and the TLS-RPT report (RFC 8460) for the TLS sessions of the mail it sent. This module holds the settings and the identity they are sent under; the work is done by Karta.Reports.Sending.Planner, .Dispatcher and .Runner, and what a kind knows is in its module (Karta.Reports.Sending.Kind).

Settings (environment, see the configuration reference):

  • KARTA_REPORTS_FROM - the address reports are sent from, and KARTA_REPORTS_SERVER - the id of the mail server that sends them. The address must be at a verified domain of that server's organisation, and the message is signed with that domain's keys. Without both, nothing is sent; identity/0 says why.
  • KARTA_REPORTS_DMARC and KARTA_REPORTS_TLS_RPT - false turns a kind off (both are on by default once an identity is set).
  • KARTA_REPORTS_DMARC_EXCLUDE - domains (and their subdomains) no DMARC report is sent about.
  • KARTA_REPORTS_MAX_PER_DESTINATION - reports one address receives in 24 hours (default 100).

Kinds. The kinds sent are :dmarc_aggregate and :tls_rpt (kinds/0). DMARC failure reports (ruf) are not sent: they carry message data. A further kind is a module implementing Karta.Reports.Sending.Kind and a line in kinds/0.

Summary

Functions

Whether the kind is switched on (not whether an identity is set).

Whether reports about domain are excluded (it, or a parent, is listed).

A sentence for an operator about a problem of identity/0.

The identity reports are sent under: {:ok, %{from: address, server: server}}, or {:error, problem}: :not_set (no address or no server), :invalid_from, :server_not_found or :from_domain_not_verified (the address is not at a verified domain of the server's organisation).

The kinds sent, as {kind, module}.

The settings, with their defaults.

What Karta sent in the last 30 days (the runs of those days, UTC): runs ([%{kind:, status:, count:}]), sends (the reports sent, limited and failed, with their bytes: %{sent:, limited:, failed:, bytes:}) and reasons, why runs were skipped or failed ([%{reason:, count:}], the most frequent ten).

Types

identity()

@type identity() :: %{from: Karta.Mail.Address.t(), server: Karta.Servers.Server.t()}

problem()

@type problem() ::
  :not_set | :invalid_from | :server_not_found | :from_domain_not_verified

Functions

enabled?(arg1)

@spec enabled?(atom()) :: boolean()

Whether the kind is switched on (not whether an identity is set).

excluded?(domain)

@spec excluded?(String.t()) :: boolean()

Whether reports about domain are excluded (it, or a parent, is listed).

explain(atom)

@spec explain(problem()) :: String.t()

A sentence for an operator about a problem of identity/0.

identity()

@spec identity() :: {:ok, identity()} | {:error, problem()}

The identity reports are sent under: {:ok, %{from: address, server: server}}, or {:error, problem}: :not_set (no address or no server), :invalid_from, :server_not_found or :from_domain_not_verified (the address is not at a verified domain of the server's organisation).

kinds()

@spec kinds() :: [{atom(), module()}]

The kinds sent, as {kind, module}.

settings()

@spec settings() :: keyword()

The settings, with their defaults.

summary(now \\ DateTime.utc_now())

@spec summary(DateTime.t()) :: map()

What Karta sent in the last 30 days (the runs of those days, UTC): runs ([%{kind:, status:, count:}]), sends (the reports sent, limited and failed, with their bytes: %{sent:, limited:, failed:, bytes:}) and reasons, why runs were skipped or failed ([%{reason:, count:}], the most frequent ten).