Domain moves by account holders
An account holder can move a domain, with its mailboxes, mail, websites,
records, certificates, folders and databases, to another account: on this
server, to or from another Elpan server, or through a file. They run a
tool, elpan-migrate, on a machine of their own, and approve it in each
account. You aren't asked; you decide whether moves are allowed, and you
can see each one.
What the holder does is in the account docs:
Moving domains.
The server API and elpanctl have no move of their own. A holder can also
move a whole account, holding it still for the last copy:
Account moves and holds.
How a move works
A domain name can now exist in several accounts of one server; one copy holds the name, and only that one can be active. A move gives the receiving account an inactive copy, which renders nothing: no vhost, no mail routing, no mailbox login, no certificate order, nothing written to its DNS backend. The tool fills it while the domain keeps working. In its last step it makes the holder's copy unavailable for a final copy, and the receiving copy takes the name.
| State | Websites and webmail | Mail logins | DNS | |
|---|---|---|---|---|
| Active | as always | as always | as always | published |
| Temporarily unavailable | 450 4.3.2 Mailbox temporarily unavailable, retry later | 503, the maintenance page, Retry-After: 300; /.well-known/ served | a temporary failure; the sign-in at accounts.<domain> too (below) | published as it was |
| Inactive copy | nothing | nothing | nothing | nothing written |
The sign-in at the domain's identity service, accounts.<domain>, is
refused the same way while the domain is unavailable: its pages answer
503 with "Temporarily unavailable" and Retry-After: 300, its token,
userinfo and other protocol endpoints 503 {"error": "temporarily_unavailable"}, and an application that asks it to sign
someone in gets error=temporarily_unavailable back. A mailbox of the
domain that signs in at another domain's identity service gets "The domain
of this account is temporarily unavailable" once its password is checked
(a wrong one is still wrong), and the Auth Log row says so. Sessions,
remembered sign-ins and refresh tokens are not ended: they work again once
the domain is active.
Nothing is deleted on the giving side: the old copy, its folders and its databases stay until the holder removes them.
Between two servers the name can't change hands in one step. The giving copy is handed over, unavailable for good, and then the receiving server's copy is activated. Where the giving server hosts the zone (built-in DNS), its name servers answer with a stand-in, a copy of the receiving server's records, until the holder changes the delegation at the registrar.
The switch
Four things must allow a move, in both accounts:
| Setting | Default | Off, or 0 |
|---|---|---|
| Account owners can move domains between accounts, for the server | on | No holder moves a domain. |
| Account owners can add and remove their own domains, for the server | on | No holder moves a domain either: giving one is removing it, receiving one is adding one. |
| Domains, the domain limit of the account | 0 | The account neither gives nor receives. |
| The account's state | active | A suspended account, or one being deleted, neither gives nor receives. |
The receiving account also needs room under its domain limit, and its storage limit, for what comes.
The move switch is on by default, so the moment a server has the release that brings moves, every holder whose account has a domain limit other than 0 can move domains, also off the server. Turn it off first if you don't want that.
Accounts › Domain Claims has the switch, below the one for adding
and removing domains. On the command line, server edit sets it and prints
it with no option:
elpanctl server edit --owner-transfers off
elpanctl server edit --owner-transfers on
In the server API it's
ownerTransfersEnabled on /api/v1/server.
Off, the approval page tells the holder that moving domains is turned off and to ask you. Under approvals given before, the panel refuses offering a domain, making a copy, opening an SSH access and Activate. A domain a move made unavailable still becomes available again when its lease ends.
What a move changes on the server
- The approval is an OAuth grant with the scope
transfer:giveortransfer:receive, given on the account panel's device page after the holder confirms their identity. It lasts seven days. API keys can't hold these scopes. - SSH access. To copy mail and files, the tool asks the panel for a
temporary key, as the account's main user (rsync within the chosen
folders) or its mail user (Dovecot's sync of the chosen mailboxes). The
key line is in
/var/lib/elpan/ssh/session-keys/<user>, which sshd reads beside~/.ssh/authorized_keys, with anexpiry-timeand a forced command,/usr/libexec/elpan/transfer-shell, that admits only what the approval covers. Neither key gets a shell. - The mail user's login shell is
/usr/libexec/elpan/transfer-only-shell, which runs nothing buttransfer-shell. The account's main user keeps its shell. - Databases are dumped and restored by the panel, through the account API, and made read-only during the switch under a lease of their own.
What you see
The Auth Log has a row for each step, in the account the move is in:
| Event | Recorded when |
|---|---|
| Domain transfer authorized | The holder approves the tool. Giving: the domains, and any given "for the stand-in only". Receiving: the folders and databases ticked to be replaced. |
| Transfer access opened | An SSH key: the user, until when, and the key's fingerprint. |
| Transfer credentials | A read (giving) or write (receiving) of the credentials of a mailbox, identity application, zone, mail service, relay credential, list or database, with the fields. |
An approval in a session you opened in the account is flagged Impersonated, as everything such a session does.
Domain Claims lists the claims a move from another server opens in the
receiving account, by transfer:<approval id>; they follow the rules and
rate limits of any claim, and last seven days or until the approval ends.
The panel's log has a line for each change of hands, e.g. example.com offered by acme to newacme, Inactive copy of example.com made in newacme, example.com moved from acme to newacme, example.com handed over to control.example.net, The lease of example.com ran out: active again:
journalctl -u 'elpan-panel*' -g 'example.com'
The holders get notices in their system mailbox: the giver when a domain is handed over to another server, the receiver when a copy for a move from another server is made.
Each copy's state
Domains, an account's Domains tab and the Accounts list show each copy's state: Active, Temporarily unavailable (with the end of its lease), Handed over to the other server, Standing in for it, Inactive copy, Claimed by a move (a copy a move from another server made, waiting to be activated), and Awaiting the registrar for a domain moved here whose delegation hasn't changed yet. A domain's page says what its state means and lists the Other copies of this domain on the server, in other accounts.
The state is read-only there: the holder makes a copy available again, activates or removes it, or the tool does. To do it for them, act in the account.
Moving a domain for a holder
There's no move of your own yet. Act in each account and approve the tool there, with your own machine running it: an impersonated session approves without the identity confirmation, and the row says it was impersonated. The same switches and limits apply as for the holder, the domain limit included.
Limits
| What | Limit |
|---|---|
| A code on the device page | 10 minutes. |
| An approval | 7 days; not renewed. Disconnected under Connected apps, its tokens stop at once and its SSH access within a minute. |
| An unavailable domain's lease | At most 6 hours, renewed by the tool (it asks for 30 minutes at a time). Checked every minute: at its end the domain is active again. |
| A read-only database's lease | The same. |
| An SSH access | At most 24 hours, and never past its approval; renewed by the tool. Expired accesses are removed every minute, and sshd refuses an expired key by itself. |
The proof record _elpan-verify.<domain> | A day, TTL 300. |
| The delegation watch of a moved domain | The parent asked every 5 minutes, for up to 30 days. |
| The domain limit | Every copy counts, inactive ones included, until the holder removes it. |
Packages
The release of elpan-panel that brings moves requires the others at these versions, so an update installs them together:
| Package | Version | For moves |
|---|---|---|
| elpan-ssh | 1.1.2 | sshd reads the session keys (/etc/ssh/sshd_config.d/08-elpan-session-keys.conf); a mail user (*-mail) signs in with them only. |
| elpan-cli | 1.1.2 | transfer-shell, transfer-only-shell, the ownership tools that carry who owns what in a folder (wpermfile), and rsync with rrsync. |
| elpan-mail-local | 1.2.18 | Dovecot leaves inactive copies out and fails an unavailable domain's correct-password login as temporary: IMAP NO [UNAVAILABLE], POP3 -ERR [SYS/TEMP], submission 454 4.7.0, ManageSieve NO (TRYLATER). A wrong password is still a failure. The configuration Dovecot's sync runs with. |
| elpan-mail-in | 1.1.24 | 450 4.3.2 for an unavailable domain (a suspended one gets 450 4.2.1). |
| elpan-httpd | 1.1.28 | The maintenance page with Retry-After. |
| elpan-mail-out 1.1.23, elpan-rspamd 1.1.21, elpan-nginx 1.1.38 | Read the unavailable state. | |
| elpan-ftp 1.1.15, elpan-httpd-authd 1.1.1 | Leave inactive copies out; refuse an unavailable domain's logins as a wrong password. |
Troubleshooting, the SSH port and firewalls: Troubleshoot domain moves.