Admin interface
The structure of Karta's admin interface: every area it has and will have, what each page shows and does and who may do it, and how to add a page so that it fits. How pages look is in the Admin design system; pages that update by themselves follow Live updates. For operators, Managing organisations, servers and keys describes the pages that exist today.
Levels and navigation
Everything in Karta belongs to one of four levels, and the sidebar
(KartaWeb.Navigation) shows a section for each level the current page is
in:
Instance every organisation; instance-wide resources
└─ Organisation a customer: members, domains, reports
├─ Domain a sending domain: verification, DNS, keys, policies
└─ Mail server one application's mail: credentials, messages, routes, webhooks
└─ Message one accepted message and its recipients- The instance section is always there: the organisations, and for instance administrators the instance's own areas (IP pools, operations) once they exist.
- The organisation section appears on every page inside an organisation; the mail server section on every page inside a server. A domain's and a message's pages sit under the area that lists them (Domains, Messages) and add their record as the last breadcrumb.
- An item is shown only to those who may open its page, and only pages that exist are listed: an area is added to the navigation in the same change that adds its page. There are no links to pages that are not built, and no greyed-out items.
- Paths name records by id and follow the levels:
/organisations/:organisation_id/servers/:server_id/messages/:message_id. The instance's own areas will live under/instance/….
Roles
| Role | In an organisation they may |
|---|---|
| Owner | everything, including renaming the organisation and managing owners |
| Admin | everything else: servers, webhooks, domains, members below owner, credentials, messages |
| Member | send: credentials and messages; see everything else |
| Read-only | see everything (messages and their bodies included), change nothing |
| Instance administrator | everything in every organisation, and the instance's own areas: creating organisations, suspending servers, verifying domains without their ownership record, IP pools, operations |
Karta.Accounts.Scope holds the actions per role; a page asks
can?/3 before it shows a form or a button, and KartaWeb.Authorize
checks every event again on the server. Someone who may not see a page
gets a 404, the same as for a page that does not exist.
Every page
"Built" pages exist today; "planned" pages are the ones the roadmap adds (Status and roadmap), described here so that they are built in the same shape. "Live" marks pages that update by themselves (Live updates).
Instance
| Page | Path | Shows | Changes, and who | |
|---|---|---|---|---|
| Organisations | / | The organisations you belong to with your role (all of them for instance administrators), in pages of 50. | Instance administrators create organisations. | built |
| Your account | /account | Your sessions, this one marked. | Sign out everywhere else; for a local account a new password and a new authenticator app. | built |
| IP pools | /instance/ip-pools | The pools, each with its addresses (address, HELO name, IP family, whether the node serving the page holds it now, warm-up progress), its settings and the servers using it. | Instance administrators add a pool, add and remove addresses (with or without the DNS check), change a pool's settings, assign a server to it and back, start and end a warm-up, and remove a pool. | built, live (holder, warm-up) |
| Warm-up plans | /instance/warm-up-plans | The warm-up plans and their daily limits, and how many addresses warm up under each. | Instance administrators add a plan, change its limits and remove it (a plan in use cannot be removed). | built, live |
| Operations | /instance/operations | The nodes of the cluster and their roles, queue depth and oldest job per queue, SMTP sessions, webhook backlog, certificate expiry. | Nothing; links to the metrics. Instance administrators only. | planned, live |
Organisation
| Page | Path | Shows | Changes, and who | |
|---|---|---|---|---|
| Overview | /organisations/:id | Its mail servers with their state, its domains with their state, its slug. | Owners and admins add servers; owners rename it (moves to Settings when that page exists). | built, live |
| Domains | …/domains | Its domains and whether each is verified (later: DNS health at a glance). | Owners and admins add domains. | built, live |
| Domain | …/domains/:domain_id | Verification with the ownership record to publish (<.dns_record>) and its last check, or when verification ends if the record is gone; DKIM keys with the records to publish, the tracking host with its CNAME record and last check. | Owners and admins check the ownership record, generate, activate (once the key's record is in DNS) and retire keys, add, check and remove the tracking host, and remove the domain; instance administrators verify it without the record, and withdraw verification. | built, live (verification, keys, tracking host) |
| Domain: DNS | …/domains/:domain_id (the DNS health panel, a row per check) | The DNS health checks: SPF (lookups, qualifier, IPv6), DKIM, DMARC policy and alignment readiness, MX, reverse DNS and HELO, the return path, MTA-STS, TLS-RPT, BIMI; each a <.state> with its findings (each a <.state>, what to do, the record to publish as <.dns_record>) and the records found. | Owners and admins run the checks again. | built, live (check results) |
| Domain: keys | as above (the DKIM keys panel) | DKIM rotation: the pending key that replaces an active one and since when its record is in DNS, the key being replaced, when a retiring key is retired. | Owners and admins rotate an active key. | built, live |
| Domain: publishing | as above (the Publishing DNS records panel, only for domains in the zones the instance publishes) | When Karta's records were last published and what went wrong; on request the changes publishing would make (added, replaced, taken over, removed, left alone, each with its values and why). | Owners and admins look at the changes and publish them. | built, live (last publication) |
| Domain: MTA-STS | as above (the MTA-STS policy panel) | The policy Karta serves (mode, MX names, how long senders keep it, its text), its two records to publish, the last check of its CNAME record; why enforce was refused (MX hosts not in the policy or without valid TLS). | Owners and admins set the policy (filled from the domain's MX hosts on request), check its CNAME record, and remove it once withdrawn. | built, live |
| Domain: TLS reports | as above (the TLS reports panel) | The address senders send TLS reports to, and its record to publish. | Owners and admins set the address. | built, live |
| Domain: BIMI | as above (the BIMI logo panel) | The logo (shown as an image), its title, its record to publish, its mark certificate's URL; why an upload was refused. | Owners and admins of a verified domain upload a logo (checked against SVG Tiny PS), set the certificate's URL, and remove the logo. | built, live |
| Members | …/members | Its members and their roles. | Owners and admins add members (who have signed in once), change roles and remove them; only owners make or unmake owners. Read-only when the identity provider manages the members. | built |
| Reports | …/reports | The reports received (DMARC aggregate and failure reports, and TLS reports), newest first, in pages of 50: the report and its kind, the domain it is attributed to (or that it is about no domain of the organisation), the reporter, the period, its records and whether it was read. A report's page shows, by kind, the policy an aggregate report says the domain published and its records, largest count first, in pages of 50; the fields of a failure report; or the policies of a TLS report with their session counts and failure details. | Summaries are on their own page. | built, live (new reports) |
| Report summaries | …/reports/summary?days=7|30|90 | What the reports add up to: for DMARC the messages, how many passed SPF and DKIM, what receivers did, by domain and by reporter and the days with failures; for TLS the sessions that succeeded and failed, by domain and reporter, and the failure reasons. Read when opened (not live); at most the latest 20,000 reports of a kind. | Nothing. | built |
| Usage | …/usage | Messages per server per day, against quotas. | Instance administrators set quotas. | planned |
| Settings | …/settings | Name, slug, identity provider mapping. | Owners rename (and later delete) it. | planned |
The domain's page is composed of cards, each a function component in
lib/karta_web/live/domain_live/components/ (verification, DNS health,
keys, tracking host, MTA-STS, TLS reports, BIMI and publishing) with the
events it declares; the page loads the domain, declares their permissions
and dispatches their events.
Mail server
| Page | Path | Shows | Changes, and who | |
|---|---|---|---|---|
| Overview | …/servers/:server_id | Its state and token; the last 24 hours: messages accepted and their recipients by state, messages per hour; the messages it sent and received each day and the deliveries of the last minute against its sending limit; retention, sending limit, tracking, active credentials. | Nothing (actions are on the other pages). | built, live |
| Messages | …/messages | Accepted messages, newest first, 50 a page, with search (text, recipient state, tag, dates in the query string) and each message's recipients by state. | Nothing yet. | built, live |
| Received | …/received | The messages the server received, newest first, 50 a page, with search (text, delivery state, dates in the query string) and each message's deliveries by state. | Nothing yet. | built, live |
| Received message | …/received/:message_id | Envelope, each recipient's delivery (state, attempts, last answer, next attempt), the content. | Members and above send a waiting or failed delivery again. | built, live |
| Message | …/messages/:message_id | Envelope, recipients with their states, every delivery attempt (reply, server, TLS), opens and clicks, the plain text, attachments, header fields, the HTML part in a sandboxed frame; download. | Try again now, hold, release and cancel (while scheduled), for what the recipients' states allow; for members and above (not the read-only role). Every action is in the message's history. | built, live |
| Credentials | …/credentials | API keys and SMTP logins, never their secrets: identifier, scopes, last use, state. | Members and above create (the secret shown once) and revoke. | built |
| Routes | …/routes | Inbound routes by domain: address, catch-all or plus-addressing; what happens (endpoint, accept, report, hold, reject); whether forged mail is refused; the spam settings (the score, and marking, holding or refusing). | Owners and admins; a route only for a domain the organisation owns. | built, live |
| Endpoints | …/endpoints | Where inbound mail goes: an address, an SMTP relay or an HTTP endpoint with its format (Karta, raw, Postal's two, Mailgun, SendGrid, Postmark) and signing. | Owners and admins add one (its secret shown once) and set its header authentication. | built, live |
| Webhooks | …/webhooks | The server's webhooks: name, the URL's host, format, events, state (on, failing since, off, stopped by Karta). | Owners and admins add webhooks, in a format chosen once (the secret shown once). | built, live |
| Webhook | …/webhooks/:webhook_id | The URL (with the user name of its Basic authentication, never the password), format, events, state; signing by format (SendGrid's public key, where Postal's instance key is published, Postmark's lack of a signature, the webhooks that share a Mailgun key); the deliveries, newest first, 50 a page, by state (in the query string). | Owners and admins change the name, URL and events, switch it off and on, send a test event, rotate the secret (shown once; a shared Mailgun key for all that share it), remove it, and send a delivery or the failed deliveries of a period again. | built, live |
| Webhook delivery | …/webhooks/:webhook_id/deliveries/:delivery_id | The event, the state, the body every request carries, every request (address, answer, time taken, the start of the response). | Owners and admins send it again. | built, live |
| Suppressions | …/suppressions | Suppressed addresses with reason (bounce, complaint, unsubscribe, manual), source and expiry; search. | Members and above add and remove addresses. | built, live |
| Usage | …/usage | Messages per day, quota, sending limit use. | Nothing. | planned |
| Settings | …/settings | Name, retention, sending limit, tracking and List-Unsubscribe, the tracking host for mail from domains without their own; later the IP pool, holding mail. | Owners and admins change the settings; instance administrators suspend and resume the server, with a reason the organisation sees on every page of the server. | built |
Adding a page
A page is a LiveView, a route, a navigation item, tests and a line in the operators' guide. Follow the pages that exist; these are the rules they follow.
Module and route
KartaWeb.<Thing>Liveinlib/karta_web/live/<thing>_live.ex; a list and a record page areKartaWeb.<Thing>Live.Indexand.Showinlib/karta_web/live/<thing>_live/.- The route goes into the
:authenticatedlive session inKartaWeb.Router, under the record it belongs to, with ids (/organisations/:organisation_id/servers/:server_id/webhooks).
Access
on_mount {KartaWeb.Authorize, :organisation | :server | :domain | :message}loads what the path names for the user, or answers 404. A new kind of record gets a loader there (load within its parent, never by id alone).use KartaWeb, :live_viewmakes the page aKartaWeb.Authorizebehaviour: implementpermission/1for every event, with a finaldef permission(_event), do: nil. Events not listed are refused.- Records an event names are looked up within the page's record
(
Credentials.get_credential(server, id)), never by id alone. - Show forms and buttons only when
can?(@current_scope, @organisation, action). - A page that shows what changes while it is open adds
on_mount {KartaWeb.LiveUpdates, {:server, kinds: [...]}}after Authorize (:organisation,:domainor:messagefor those records;kinds, the kinds of change it shows), implements the callbackKartaWeb.LiveUpdates.refresh/2and puts<.live_badge>in its panel's header (Live updates). Forms are not live: what someone is typing is never replaced.
Template
<Layouts.app
flash={@flash}
current_scope={@current_scope}
organisation={@organisation}
server={@server}
active={:webhooks}
>
<.header>
Webhooks
<:subtitle>Where Shop mail reports what happens to its mail.</:subtitle>
<:actions><.button variant="primary" ...>Add a webhook</.button></:actions>
</.header>
<.panel flush>
<.empty_state :if={...} id="no-webhooks" icon="hero-bolt" title="No webhooks yet">
...
</.empty_state>
<.table :if={...} id="webhooks" rows={@streams.webhooks}>...</.table>
</.panel>
</Layouts.app>activeis the navigation item's id;crumbnames the record a record page shows (crumb={@domain.name}).- Build from the components only (see the design system); give every form, table, button and notice an id that the tests use.
- Collections of records are streams (
stream/3), with an empty state. - Times with
<.timestamp>, states with<.state>, values to copy with<.copyable>or<.dns_record>, secrets with<.secret>.
Navigation
- Add the item to the right section of
KartaWeb.Navigationwith its label, a Heroicon, its path and the permission its page needs (:viewfor a page everyone may open, a stronger one only for a page that does nothing but change things), in the order of this page's tables. test/karta_web/navigation_test.exslists every section's items: update the list.
Tests (test/karta_web/live/<thing>_live_test.exs)
- The role matrix: open the page as owner, admin, member, read-only and
instance administrator (
role_users/1), check which forms and buttons each sees, and send every event directly to the view as each, checking the outcome in the database; a non-member and another organisation's record get a 404. - An event the page does not declare is refused.
- The navigation item leads to the page.
- Add the page's path to
test/karta_web/security_headers_test.exs(the headers, no inline script or style, before and after connecting). - Live pages: the tests in Live updates.
Words and documentation
- Sentence case; buttons name the action, flashes confirm it ("Webhook added."); errors say what to do.
- Add the page to the table in Managing organisations, servers and keys, and its states to the design system's states table.