Mail relay: launch and a domain move need no click; a non-public copy neither enrols nor sends by itself
The copy rule now goes by direction. A public site that finds another host's connection in its database (its development address after launch, its old domain after a move) enrols by itself. A site that says it is not public - IAPL_NOINDEX=1, or a host in the new mail.relay.developmentHosts - and holds another host's connection is a copy of that site's data: it neither enrols nor sends until "Connect again", also when it has a token of its own (production's database copied back onto the development address). The consent is stored with the copy (acceptedHosts), so the next fresh copy waits again. - mail.relay.otherHosts: 'auto' (default) | 'wait' | 'enrol' | list of the site's own hosts - mail.relay.developmentHosts, siteIsNonPublic() exported - the copy refusal ends when its reason does (no cool-down; the panel recomputes it on every read) - doctor: info for a public site whose database knows another host (the launched site, or a copy that forgot IAPL_NOINDEX) - contract copy 1.7.1 (wording only) - docs, AGENT.md, skills, changelog draft Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
acfcf72c03
commit
49927205bb
+4
-3
@@ -41,7 +41,8 @@ once there are more than 20.
|
||||
| `GRAPH_*` set, "Sending method" on SMTP, no SMTP server (mail failed until now) | Mail goes through Graph | fill in SMTP, or remove the variables |
|
||||
| Neither (mail failed until now with "not configured") | **An outbound call:** on the next e-mail the site enrols with the service — `POST https://webservices.intecion.net/mail/v1/enrol` with its host and the plugin version — and then sends through it, from `[email protected]`. The site is active as soon as it enrols (the service holds a site for approval only as an exception) | `iapl({ mail: { relay: false } })` |
|
||||
| Any site with the mail service enabled (the default) | **A new public route:** `POST /api/iapl/mail-relay/confirm` — answers `404` and changes nothing unless the site itself started an enrolment in the last 5 minutes; rate-limited. Three admin-only routes beside it (`…/status`, `…/connect`, `…/disconnect`) | `mail: { relay: false }` removes all four |
|
||||
| **A copy** of a site's database on another host (staging made from production), with no SMTP there | It does **not** connect by itself — its data is production's, and it would mail real people: sends report `relay-refused`, the panel and the doctor say why. "Connect again" lets it send; `mail: { relay: false }` or SMTP to a catcher keeps it silent for good | `mail: { relay: { otherHosts: 'enrol' } }` |
|
||||
| **A copy** of a site's database on a site that says it is not public — `IAPL_NOINDEX=1`, or a host in `mail.relay.developmentHosts` (staging made from production; production's data copied back onto the development address), with no SMTP there | It does **not** enrol or send by itself — its data is production's, and it would mail real people: sends report `relay-refused`, the panel and the doctor say why. "Connect again" lets it send; `mail: { relay: false }` or SMTP to a catcher keeps it silent for good. **A copy without either mark sends** (it looks like launch day); a production site that kept `IAPL_NOINDEX=1` sends nothing | `mail: { relay: { otherHosts: 'enrol' } }` |
|
||||
| A site launched on its real domain after it was built on a development address; a moved domain | Nothing to do: it enrols by itself on its first e-mail | `mail: { relay: { otherHosts: 'wait' } }` makes it wait for "Connect again" |
|
||||
| SMTP **half** filled in — a server or a user name, but not server, user name and password (until now: refused, "Fill in the server, user name and password") | Sent through the mail service; one line in the server log and a hint in the state block say that the SMTP settings are incomplete | complete or empty the SMTP fields; `mail: { relay: false }` |
|
||||
| "Microsoft Graph" chosen in the panel but `GRAPH_*` missing (until now: SMTP with a warning) | SMTP if filled in, otherwise the mail service | as above |
|
||||
| A site on `localhost` or without `serverURL` | Refused by the plugin itself; nothing leaves the machine. Development: SMTP (a local catcher) as before | — |
|
||||
@@ -102,7 +103,7 @@ once there are more than 20.
|
||||
one visitor; `mail.relay.accountMail`). Limits and the file size come from the service (30 an hour, 200 a day, 10 MB
|
||||
unless Intecion set others); `mailAttachmentLimit` reports the latter.
|
||||
- **Plugin option `mail`**: `mail: { relay: false | { url, host, enrol, token, senderName, kind, accountMail,
|
||||
confirmRateLimit, accessKeyField, otherHosts, totalTimeoutMs, timeoutMs, retryBackoffMs, fetchImpl }, graphDeprecationWarning }`; `mailAdapter({ relay })`.
|
||||
confirmRateLimit, accessKeyField, otherHosts, developmentHosts, totalTimeoutMs, timeoutMs, retryBackoffMs, fetchImpl }, graphDeprecationWarning }`; `mailAdapter({ relay })`.
|
||||
- **Panel:** the state block on the e-mail tab (transport in effect, the site's state with the service, sender and
|
||||
reply address, what is left of the limits, a replaced sender name; "Check now", "Connect again", "Disconnect";
|
||||
"Enter an access key" for a token issued by hand only with `mail.relay.accessKeyField: true`); "Sending method" reads "Automatic" / "Microsoft Graph (deprecated)"; the server field reads
|
||||
@@ -117,7 +118,7 @@ once there are more than 20.
|
||||
`withMailKind`, `runWithMailKind`, `mailKindOf`, `expectMailTo`, `buildFormMailKindHook`, `createFakeRelay` (the
|
||||
service in memory, for tests), the constants `RELAY_*`, `MAIL_KINDS`, `MAIL_KIND`, `GRAPH_DEPRECATION_NOTICE`, and
|
||||
their types; `MailRelayStatus` from `/admin`.
|
||||
- The wire contract of the service (version 1.7.0) is copied in the repository (`contracts/mail-relay/`) with a
|
||||
- The wire contract of the service (version 1.7.1) is copied in the repository (`contracts/mail-relay/`) with a
|
||||
checksum test; every example of it runs against the plugin's fake service and against the plugin's client.
|
||||
- **`iapl-doctor` rule `legacy-names`** (info): lists the old names a project still uses, each with the new one.
|
||||
Information, not a defect. A warning only for `iapl-doctor.json` and `ipal-doctor.json` side by side, or one variable
|
||||
|
||||
+13
-5
@@ -1284,10 +1284,17 @@ the mail service → nothing (`mail: { relay: false }` and no SMTP). A site with
|
||||
the mail service that is where replies go; the service's own address has no mailbox.
|
||||
5. Nothing to arrange with Intecion: a site that passes the call-back is active at once (`relay-pending`, held for
|
||||
approval, is the exception — the panel says so).
|
||||
6. **Staging made from a copy of production's database** does not connect by itself (it would mail production's
|
||||
real addresses): it stays "not connected" until an admin presses "Connect again". For a copy that must never
|
||||
send: `mail: { relay: false }` or SMTP to a catcher. After a **domain move** press "Connect again" once, or set
|
||||
`mail: { relay: { otherHosts: ['old-domain.example'] } }`. A site before launch (empty store) enrols by itself.
|
||||
6. **Launch needs nobody:** a site enrolled on its development address and then served on the real domain (or moved
|
||||
to another domain) enrols by itself on its first e-mail. **A non-public copy does not send by itself:** a site
|
||||
with `IAPL_NOINDEX=1` — set it on every staging, preview and test copy — or on a host matched by
|
||||
`mail: { relay: { developmentHosts: ['*.dev.agency.example'] } }`, whose database holds another host's
|
||||
connection (staging made from production; production's data copied back onto the development address), neither
|
||||
enrols nor sends until an admin presses "Connect again". **A copy with neither mark sends to the real addresses
|
||||
in its data** — the plugin cannot tell it from launch day; the doctor's deep run notes it (`mail-relay-state`,
|
||||
info). A production site that kept `IAPL_NOINDEX=1` sends nothing until the variable is removed. For a copy that
|
||||
must never send: `mail: { relay: false }` or SMTP to a catcher. If the project's development addresses share a
|
||||
pattern, set `developmentHosts` in its config. Verify: on the copy, Site integrations → E-mail sending says "The
|
||||
data comes from another site (…)" and a test e-mail is refused; on the launched site it says "Connected to IWSN".
|
||||
|
||||
**Verify:** Site integrations → E-mail sending → the block "How e-mails are sent" says "Connected to IWSN"; **Send test e-mail** answers "through IWSN, as <name>"; the mail arrives from
|
||||
`[email protected]` with the client's name and `Reply-To` the client's address; `iapl-doctor
|
||||
@@ -1320,7 +1327,8 @@ overrides per adapter; `resolveRelayOptions` reads what is in effect):
|
||||
| `relay: false` | on | no mail service: no outbound call, no routes, no state block |
|
||||
| `url` | `RELAY_BASE_URL` | a relay of your own (same contract) |
|
||||
| `host` | host of `serverURL` (`relayHost`, `isPublicHost`) | the public host the service calls back |
|
||||
| `otherHosts` | `'wait'` | a database holding another host's connection and none of this site's (a copy, a moved domain): wait for "Connect again"; a list of the site's own other hosts; or `'enrol'` |
|
||||
| `otherHosts` | `'auto'` | a database holding another host's connection: a public site enrols by itself (launch, a move), a non-public one (`IAPL_NOINDEX=1` / `developmentHosts`) neither enrols nor sends until "Connect again"; a list of the site's own other hosts; `'wait'` (a public site without a connection waits too); `'enrol'` (no rule) |
|
||||
| `developmentHosts` | `[]` | host patterns (`*`) of development and staging addresses: a site there is non-public for `otherHosts` (`siteIsNonPublic`) |
|
||||
| `enrol` | `'auto'` | `'manual'` (only "Connect again" / `enrolRelay`), `false` (token from `token` / `setRelayToken`) |
|
||||
| `accessKeyField` | `false` | `true`: admins get "Enter an access key" in the state block (a hand-issued token) |
|
||||
| `token` | — | a token from elsewhere; nothing is stored, the site does not enrol |
|
||||
|
||||
@@ -102,7 +102,8 @@ through this procedure. Ask only when you are missing something you cannot get y
|
||||
| `relay-refused` / "The mail service could not reach this site at …" (cause `callback-failed`) | `unreachable` / `timeout`: firewall, private network, wrong public host in `serverURL`; `redirect`: `trailingSlash: true`, apex → `www`, a language redirect; `status`: route blocked, missing (`mail: { relay: false }`?) or another `routes.api`; `confirmation`: a proxy rewrites the answer | `curl -i -X POST https://<host>/api/iapl/mail-relay/confirm -d '{}' -H 'content-type: application/json'` must answer **404 with an empty body, no redirect**; fix `serverURL` / `mail.relay.host`, or ask Intecion to set the site's confirm address (path ending in `/confirm/` with trailing slashes); then "Connect again" (the site does not retry by itself for 15 min). email.md "When the site cannot be confirmed" |
|
||||
| `relay-refused`, cause `host-not-allowed` / "This site has no public address yet" | the site runs on `localhost`, a private name, or `serverURL` is empty | expected in development (use SMTP / Mailpit there); in production set `serverURL` |
|
||||
| `relay-refused` on a site whose token was entered by hand ("does not know the server this site now runs on" / "access key … no longer valid") | the site moved or got a second server, or its token expired; a site with a hand-issued token cannot enrol by itself | Intecion adds the server's address, or issues a new token — set it with `setRelayToken(payload, token)` from a script (`pnpm payload run`), or in the panel when the project has `mail.relay.accessKeyField: true` (email.md "The token") |
|
||||
| a site sends nothing: "The data comes from another site (…), so this site did not connect by itself" / `relay-refused`, cause `client-other-host` | the database holds another host's connection and none of this site's: a staging copy of production, a moved domain, a second domain. Expected — a copy with production's data must not mail real people by itself | should it send: "Connect again" in the state block, once. A moved or second domain: `mail: { relay: { otherHosts: ['old-domain.example'] } }`. A copy that must never send: `mail: { relay: false }` or SMTP to a catcher |
|
||||
| a site sends nothing: "The data comes from another site (…), so this copy does not send e-mails by itself" / `relay-refused`, cause `client-other-host` | the site says it is not public (`IAPL_NOINDEX=1`, or a host in `mail.relay.developmentHosts`) and its database holds another host's connection: a staging copy of production, or production's data copied back onto the development address. Expected — a copy with production's data must not mail real people by itself | should it send: "Connect again" in the state block, once (until the data is replaced). A copy that must never send: `mail: { relay: false }` or SMTP to a catcher. **The production site itself says this:** `IAPL_NOINDEX` was left set after launch — remove it |
|
||||
| a staging or test copy **does** send, to real addresses | it does not say it is not public, so it looks like a launch (a public site enrols by itself); the doctor's deep run notes "the database also holds the mail-service connection of another host" | `IAPL_NOINDEX=1` on the copy, or `mail: { relay: { developmentHosts: ['*.dev.agency.example'] } }`; to be sure: `mail: { relay: false }` or SMTP to a catcher |
|
||||
| `relay-pending` / "waiting for approval" | the exception: the service holds new sites for approval when many appear at once, or Intecion approves by hand (a site is normally active as soon as it enrols) | Intecion approves it on the service; nothing to change on the site; the same token then works |
|
||||
| `relay-suspended` | Intecion stopped the site (abuse, a flood from a form) | contact Intecion; fill in SMTP meanwhile |
|
||||
| `relay-disconnected` | an admin pressed "Disconnect" | "Connect again", or SMTP |
|
||||
|
||||
@@ -646,7 +646,7 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
|
||||
6. **Notifications**: form messages in every language.
|
||||
7. **Site integrations → E-mail sending**: "Sender name" (the client's name; empty = the site name) and **"Sender
|
||||
address"** (the client's address: with the mail service replies go there). SMTP fields **only** when the client asked
|
||||
for its own server. On the production domain: the block "How e-mails are sent" must say "Connected to IWSN" (a site is active as soon as it enrols; "waiting for approval" is the exception — ask Intecion; "The data comes from another site" = this database is a copy: press "Connect again" only if the copy should send), then **Send test e-mail** → "through IWSN". Turnstile (for testing site
|
||||
for its own server. On the production domain: the block "How e-mails are sent" must say "Connected to IWSN" (a site is active as soon as it enrols; "waiting for approval" is the exception — ask Intecion; the real domain enrols by itself at launch although the site was connected on its development address — nothing to press; "The data comes from another site" = the site says it is not public (`IAPL_NOINDEX=1` or a development host) and holds a copy of another site's data: press "Connect again" only if the copy should send — on the production domain it means `IAPL_NOINDEX` was left set. A staging or test copy must have `IAPL_NOINDEX=1` (or its host in `mail: { relay: { developmentHosts: […] } }`), or it mails the real addresses in its data), then **Send test e-mail** → "through IWSN". Turnstile (for testing site
|
||||
`1x00000000000000000000AA`, secret `1x0000000000000000000000000000000AA`; production keys from the client), analytics/pixel
|
||||
IDs, IndexNow → generate key. Mail/Turnstile errors show up as a dashboard alert.
|
||||
8. **Forms**: check the addresses in the Emails tab of the seeded forms.
|
||||
|
||||
@@ -573,9 +573,13 @@ PROGRAMISTA §6, item 73; email.md; AGENT.md §7.2) — nothing to run; read whi
|
||||
redirect; no proxy or WAF rule blocks `/api/iapl/mail-relay/confirm`; `trailingSlash: true` or another `routes.api` →
|
||||
Intecion sets the site's confirm address first; "Sender address" is filled in (replies go there); the client's
|
||||
processing agreement names the service. Nothing to arrange with Intecion: the site is active as soon as it enrols.
|
||||
**A staging copy of the database** does not connect by itself (it would mail production's real addresses): it
|
||||
says so in the panel until an admin presses "Connect again"; keep it silent with `mail: { relay: false }` or SMTP
|
||||
to a catcher. After a domain move: "Connect again" once, or `mail: { relay: { otherHosts: ['old-domain.example'] } }`.
|
||||
**Launch and a domain move need nothing:** the real domain enrols by itself although the database holds the
|
||||
development address's connection. **A staging or test copy of the database** neither enrols nor sends by itself
|
||||
**if it says it is not public** — `IAPL_NOINDEX=1` (check that every copy has it) or its host in
|
||||
`mail: { relay: { developmentHosts: ['*.dev.agency.example'] } }`: the panel says so until an admin presses
|
||||
"Connect again". A copy with neither mark sends to the real addresses in its data; keep a copy silent for good
|
||||
with `mail: { relay: false }` or SMTP to a catcher. Production must not have `IAPL_NOINDEX` set (it would send
|
||||
nothing).
|
||||
4. Code that compared the result of `payload.sendEmail` needs no change for SMTP and Graph. A send through the mail
|
||||
service returns `{ sent, transport: 'relay', … }`; `sent: false` with `confirmed: false` means "may have been sent".
|
||||
5. Your own account mail (invitations): mark it — `withMailKind(message, 'account')`. Form mail and Payload's
|
||||
|
||||
+12
-7
@@ -54,13 +54,18 @@ Mail needs **no variable**. A site with no SMTP server in the panel sends throug
|
||||
- **That route reachable from the internet** — no basic auth on the Coolify app, no firewall or WAF rule in front of
|
||||
`/api/iapl/`; behind Cloudflare leave it uncached and unchallenged.
|
||||
- **Outbound HTTPS** to `webservices.intecion.net`.
|
||||
- **Staging.** A site is active as soon as it enrols, so a staging site sends real mail. A staging site made from a
|
||||
**copy of production's database** does not connect by itself (its data is production's; it stays "not connected"
|
||||
until an admin presses "Connect again") and never uses or touches production's connection. The safe set-up for a
|
||||
copy that must not send: `iapl({ mail: { relay: false } })` or SMTP to a catcher ([email.md](./email.md)
|
||||
"Staging, copies and several hosts").
|
||||
- **A domain move** (the same database under a new host): press "Connect again" once after the move, or set
|
||||
`mail: { relay: { otherHosts: ['old-domain.example'] } }` before it.
|
||||
- **Launch and a domain move need nobody.** A site built on a development address and then served on its real
|
||||
domain (or moved to another one) enrols by itself on its first e-mail; the old address's connection in the
|
||||
database is its own past. Remove `IAPL_NOINDEX` at launch as always — a site that still has it counts as a
|
||||
non-public copy and sends nothing.
|
||||
- **Staging and copies.** A site is active as soon as it enrols, so a staging site sends real mail. A **copy of
|
||||
production's database** on a site that says it is not public — `IAPL_NOINDEX=1` (set on every staging, preview and
|
||||
test copy) or a host in `mail: { relay: { developmentHosts: ['*.dev.agency.example'] } }` — neither enrols nor
|
||||
sends by itself (its data is production's) until an admin presses "Connect again", and never uses or touches
|
||||
production's connection. **A copy without either mark sends**, to the real addresses in its data: the plugin
|
||||
cannot tell it from launch day (the doctor's deep run notes it). The safe set-up for a copy that must not send:
|
||||
`iapl({ mail: { relay: false } })` or SMTP to a catcher ([email.md](./email.md) "Staging, copies and several
|
||||
hosts").
|
||||
- Several containers of one site share the database, so they share the token; a restore of an old database dump
|
||||
brings back an old token — the site then enrols again by itself on its next e-mail.
|
||||
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE
|
||||
| | `storage-names` | warning | the visitor cookie the layout sets (`<PageStats visitorCookie>`, default `ipal_vid`) is the one the config makes the cookie scanner declare (`storageNames`, stats.md) |
|
||||
| | `cookie-scanner` | error / warning / info | `cookieScanner` on (with `crawl`, else info); deep: nothing waits for approval (warning) |
|
||||
| mail | `mail-transport` | error / warning | (deep) an e-mail transport is in effect (not: the mail service switched off and no SMTP server); the last sends worked — failing: warning, error once it has lasted 24 hours |
|
||||
| | `mail-relay-state` | error / warning / info | (deep) on the Intecion mail service: not disconnected and not stopped (error), not waiting for approval, not refused at enrolment, not a copied database that waits for "Connect again" (`client-other-host`), the sender name not replaced (warning); not enrolled yet (info) |
|
||||
| | `mail-relay-state` | error / warning / info | (deep) on the Intecion mail service: not disconnected and not stopped (error), not waiting for approval, not refused at enrolment, not a non-public copy of another site's database that waits for "Connect again" (`client-other-host`), the sender name not replaced (warning); not enrolled yet, and a public site whose database also holds another host's connection — its own past after a launch or a move, or a copy that forgot `IAPL_NOINDEX=1` (info) |
|
||||
| | `mail-reply-address` | warning | (deep) on the mail service, "Sender address" is filled in: replies go there |
|
||||
| | `mail-graph-deprecated` | warning | Microsoft Graph is not in use: no `GRAPH_*` variables on the site (deep), no `graphAdapter` / `emailGraph: true` in the config — deprecated, removed in 2.0 |
|
||||
| | `mail-relay-route` | warning | nothing keeps the mail service from confirming the site: no `trailingSlash: true`, `routes.api` is `/api` (else Intecion sets the site's confirm address); live, on the mail service: `/api/iapl/mail-relay/confirm` answers without a redirect, a block or a server error. Skipped with `relay: false` |
|
||||
|
||||
+50
-18
@@ -256,25 +256,56 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
|
||||
|
||||
- **A site that passes the call-back is active at once** and can send. A staging site on its own domain is its own
|
||||
site to the service: its own enrolment, token and limits.
|
||||
- **A copy of production's database does not connect by itself.** Its data is production's — real customers'
|
||||
addresses in form submissions and accounts — and a copy that enrolled by itself would mail real people as soon
|
||||
as a form or a password reset ran. So a site whose database already holds the connection of **another host** and
|
||||
none of its own stays "not connected": sends report `relay-refused` (cause `client-other-host`), the state block
|
||||
says "The data comes from another site (…), so this site did not connect by itself", the doctor reports it
|
||||
(`mail-relay-state`), and no call leaves the server. An admin who wants the copy to send presses **Connect
|
||||
again**, once; from then on it is a site of its own and heals by itself.
|
||||
- **A site before launch is not affected:** with an empty store it enrols by itself on its first e-mail.
|
||||
- **A copy that must never send:** `iapl({ mail: { relay: false } })` there, or SMTP to a catcher. That is the
|
||||
safe set-up for staging; "not connected" only protects until somebody presses the button.
|
||||
- **`www.` and the bare domain** are one site: either enrols by itself beside the other (each keeps its own entry).
|
||||
- **A moved domain** (the same data under a new host) looks like a copy: after the move press **Connect again**
|
||||
once, or name the old host as the site's own — `mail: { relay: { otherHosts: ['old-domain.example'] } }` — and
|
||||
the site enrols by itself. The same list is for a second domain of one site.
|
||||
- **`otherHosts: 'enrol'`** switches the rule off: a site enrols by itself whatever else the database holds.
|
||||
- **Launch and a domain move need nobody.** A site is usually built and enrolled on a development address
|
||||
(`client.dev.agency.example`) and then served on its real domain, with the same data. The real domain finds the
|
||||
development address's connection in its database, treats it as its own past, enrols by itself on its first
|
||||
e-mail and sends. The same after a move to another domain. No button, no option.
|
||||
- **A non-public copy does not send by itself.** A copy of production's data holds real customers' addresses —
|
||||
form submissions, accounts — and would mail real people as soon as a form or a password reset ran. The plugin
|
||||
tells the two apart by **direction**: a site that says it is not public — **`IAPL_NOINDEX=1`** (every staging,
|
||||
preview and test copy sets it anyway) or a host matched by **`mail: { relay: { developmentHosts: ['*.dev.agency.example'] } }`**
|
||||
— and whose database holds the connection of **another host** neither enrols nor sends: sends report
|
||||
`relay-refused` (cause `client-other-host`), the state block says "The data comes from another site (…), so this
|
||||
copy does not send e-mails by itself", the doctor reports it (`mail-relay-state`), and no call leaves the server.
|
||||
This also holds when the copy has a token of its own: production's database copied **back** onto the development
|
||||
address brings that address's old connection with it, and still mails nobody.
|
||||
- **An admin who wants the copy to send** presses **Connect again**, once. That is stored in the copy's database;
|
||||
the next fresh copy of production replaces it and waits again.
|
||||
- **A site before launch is not affected:** with no other host in its database it enrols by itself on its first
|
||||
e-mail, noindex or not.
|
||||
|
||||
| The site | Public? | Its database holds | By itself |
|
||||
|---|---|---|---|
|
||||
| on its development address, before launch | no | nothing, or only its own connection | enrols and sends |
|
||||
| on the real domain, launch day (the development site may still run on its own database) | yes | the development address's connection | **enrols and sends — no click** |
|
||||
| after a domain move; a second domain | yes | the old domain's connection | enrols and sends |
|
||||
| `www.` and the bare domain | either | each other's | one site: both send, each with its own entry |
|
||||
| staging / test copy of production (`IAPL_NOINDEX=1` or a development host) | no | production's connection | **sends nothing** until "Connect again" |
|
||||
| production's database copied back onto the development address | no | production's and its own old one | **sends nothing** until "Connect again" |
|
||||
| a developer's `localhost` on the production database | — | production's | refused before any call (not a public host); reads and writes nothing of production's |
|
||||
| a copy that **forgot** `IAPL_NOINDEX` and is on no development host | yes | production's | **enrols and sends, to the real addresses in its data** — see below |
|
||||
|
||||
- **What remains possible — say it to whoever sets up a copy:**
|
||||
- A copy that does not say it is not public (no `IAPL_NOINDEX=1`, host not in `developmentHosts`) looks exactly
|
||||
like launch day and **sends**. The doctor's deep run reports the only sign there is, as information: "the
|
||||
database also holds the mail-service connection of another host, and this site is public" (`mail-relay-state`).
|
||||
Projects that put every copy under one pattern should set `developmentHosts` once, in the shared config.
|
||||
- A production site that still has `IAPL_NOINDEX=1` after launch counts as non-public: it finds the development
|
||||
address's connection and **sends nothing** (and is not indexed either). The state block and the doctor say why;
|
||||
removing the variable is the fix ([deployment.md](./deployment.md): "`IAPL_NOINDEX` NOT set in production").
|
||||
- A copy that keeps production's `serverURL` is the same site to the plugin (and to the service, if it can be
|
||||
called back at that host).
|
||||
- After "Connect again" a copy sends until its data is replaced.
|
||||
- A development site that keeps running **on the launched database** (not a copy of it) stops sending by itself
|
||||
once the real domain has enrolled; other processes notice within 30 seconds.
|
||||
- **A copy that must never send:** `iapl({ mail: { relay: false } })` there, or SMTP to a catcher. That is the safe
|
||||
set-up for staging; the rule above only protects until somebody presses the button.
|
||||
- **`otherHosts`** changes the rule: a list (`['client.dev.agency.example']`) names hosts as this site's own — a
|
||||
non-public site is not held by them, and the doctor's note about a launched site goes away; `'wait'` is the
|
||||
stricter rule — also a public site without a connection of its own waits for "Connect again"; `'enrol'` switches
|
||||
the rule off.
|
||||
- Production's connection is never used, changed or revoked by a copy — "Disconnect" on a copy included, and on the
|
||||
same server too. A developer's process on `localhost` reading the live database changes nothing either.
|
||||
- Not covered: a copy that keeps production's `serverURL` is the same site to the plugin (and to the service, if it
|
||||
can be called back at that host).
|
||||
|
||||
### The state block in the panel
|
||||
|
||||
@@ -349,7 +380,8 @@ message); "Connect again" asks at once. Other causes: `host-not-allowed` (not a
|
||||
| `relay: false` | — | switches the mail service off: no enrolment, no outbound call, no confirm route, no state block, the panel wording of 1.16 |
|
||||
| `url` | `RELAY_BASE_URL` (`https://webservices.intecion.net/mail`) | another base address — a relay of your own that speaks the same contract |
|
||||
| `host` | host of `serverURL` (`relayHost(payload, options)`) | the public host the service calls back |
|
||||
| `otherHosts` | `'wait'` | a database that holds another host's connection and none of this site's (a copy, a moved domain): `'wait'` = no enrolment until "Connect again"; a list = those hosts are this site's own; `'enrol'` = enrol by itself anyway |
|
||||
| `otherHosts` | `'auto'` | a database that holds another host's connection. `'auto'`: a public site enrols by itself (launch, a domain move); a non-public one (`IAPL_NOINDEX=1` or `developmentHosts`) neither enrols nor sends until "Connect again". A list = those hosts are this site's own. `'wait'` = a public site without a connection of its own waits too. `'enrol'` = no rule |
|
||||
| `developmentHosts` | `[]` | host patterns (`*` = any characters) of development, staging and preview addresses, for example `['*.dev.agency.example']`: a site on such a host is non-public for `otherHosts`, like one with `IAPL_NOINDEX=1` (`siteIsNonPublic(payload, options)`) |
|
||||
| `enrol` | `'auto'` | `'manual'`: only "Connect again" or `enrolRelay()` enrols. `false`: never (the token comes from `token` or `setRelayToken`) |
|
||||
| `accessKeyField` | `false` | `true` shows "Enter an access key" in the state block and lets its route store a hand-issued token an admin pastes |
|
||||
| `token` | — | a token from elsewhere (`string` or a function): the stored token is not used and the site does not enrol |
|
||||
|
||||
+1
-1
@@ -1005,7 +1005,7 @@ token. What protects it, and what the new public route can and cannot do:
|
||||
|---|---|
|
||||
| **No key in the package** | The plugin carries the service's address and nothing else. A site gets its token by proving it is served at its host: it makes a nonce, the service calls `POST https://<host>/api/iapl/mail-relay/confirm` with the nonce and a token, and only an answer that hashes both makes the token valid |
|
||||
| **Where the token is** | `payload-kv`, one entry per host (`iapl:mail-relay:site:<host>`). The collection refuses every operation through access control (`read`, `create`, `update`, `delete` are `false`) and is hidden: REST, GraphQL and the panel cannot reach it — an admin included (test: `test/mailRelayHttp.test.ts`). Server code with the Local API can, like `smtpPassword`. It is stored as it is (no encryption at rest), never logged, never sent to a browser, never part of a route's answer |
|
||||
| **A database copied to another host** | both sides hold a token to its host: every request names the site (`X-Intecion-Site`) and the service refuses another host's token (`host-mismatch`); and on the site the token is stored under the host it was issued for: a copy on a staging domain neither uses nor touches production's entry (a read never deletes), and **does not enrol by itself** — with production's data it would mail real people — until an admin presses "Connect again" (`mail.relay.otherHosts`) |
|
||||
| **A database copied to another host** | both sides hold a token to its host: every request names the site (`X-Intecion-Site`) and the service refuses another host's token (`host-mismatch`); and on the site the token is stored under the host it was issued for: a copy on a staging domain neither uses nor touches production's entry (a read never deletes), and a copy that says it is not public (`IAPL_NOINDEX=1`, or a host in `mail.relay.developmentHosts`) **neither enrols nor sends by itself** — with production's data it would mail real people — until an admin presses "Connect again", also when it has a token of its own (production's data copied back onto a development address). A public site is never held (launch and a domain move must work unattended), so **a copy that does not say it is not public sends**; the doctor notes a public site whose database knows another host (`mail.relay.otherHosts`) |
|
||||
| **A token of another site** (stored by a script, set as `relay.token`, or pasted into the access-key field — which is off unless the project sets `mail.relay.accessKeyField`) | refused: the service is asked which host the token is for before it is stored or used; a foreign one is not saved, not used, not revoked |
|
||||
| **A token read from a database dump** | **works from the same server** (a staging site on the machine production runs on shares its outgoing address) — which is why the store is tied to its host, above. From another server it does not work: the service accepts a token only from the addresses the site enrolled from (IPv6: the same `/64`) and answers anything else "enrol again" — which needs the call-back to the real site. It cannot send as another site, and the limits below apply |
|
||||
| **What a token can do at most** | send within the site's limits (30 an hour, 200 a day, 10 recipients, 10 MB by default) from the service's fixed address, under a sender name the service checks, with `X-Intecion-Site: <host>` on every mail. It cannot set `From`, `Return-Path` or any header, and cannot address a security alert |
|
||||
|
||||
Reference in New Issue
Block a user