Skip to main content

Account moves and holds

An account holder can move everything in their account, every domain, the whole home, every database, app servers, containers, Allow/Deny List entries, webhooks and the crontab, into an account on another Elpan server or on this one. They run elpan-migrate account … on a machine of their own and approve it in each account, as for a domain move; every domain moves as it does there. For the last copy, the tool holds the giving account still.

What the holder does and sees is in the account docs: Move your account to another server and When your account is held.

What you provide​

The switches and limits of a domain move apply to both accounts; nothing else turns account moves on or off. Beyond them:

  • The receiving account. A holder can't create an account, so you create it, usually under another name: the tool renames the databases and rewrites the home path in the settings files it knows. It may already have content of its own: the move writes nothing over it.
  • Its limits: room under the domain limit for every domain, the storage for the home, the mail and the databases, the mailing list and webhook limits, and persistent services if the account has app servers or containers. The holder's plan names the one that is short, and they ask you.
  • The old account afterwards. The tool deletes nothing. After the switch the giving account stays held, its domains as inactive copies, until its holder releases it or asks you to close it: terminate or delete it then. A held account can be suspended, terminated and deleted as any other; deleting it removes what the hold left on the server.

The approval shows two more choices: Give everything in this account and Receive a whole account. The Auth Log's Domain transfer authorized row says which, e.g. "elpan-migrate may give everything in this account to another account".

What a hold does​

A hold is a state of its own, not a suspension: the account's status doesn't change, and suspending or unsuspending it leaves the hold as it is. The tool sets it under the holder's giving approval for everything, and nothing else can:

  • during the switch, under a lease: the tool takes 30 minutes and renews it every ten (the panel allows at most six hours ahead). A sweep every minute releases a hold whose lease ran out, so an account comes back by itself within half an hour of the tool stopping;
  • during an export --still, under a lease, released at the end;
  • after the switch, with no lease, until released.

An account pending deletion or being deleted can't be held.

On the server, the panel's AccountHold.sh privhelper:

  1. writes a root-owned empty marker /var/lib/elpan/ssh/held/<user> for each of the account's three users, <u>, <u>-www and <u>-mail, which elpan-ssh reads (below): sshd then admits only a transfer access's session key, and refuses the users' own keys and passwords;
  2. records the user units that are active, in /var/lib/elpan/hold/<user>.units;
  3. moves the crontab aside to /var/lib/elpan/hold/<user>.crontab;
  4. masks the user manager, user@<uid>.service, so that no login and no linger starts it, nor the account's services, containers and app servers;
  5. turns linger off, stops the user manager, and ends every process of the main and web users except those of an SSH session running transfer-shell.

The account's mail user is left: its processes are Dovecot's, and they follow the domains' availability, which the switch sets as on a domain move. The panel also drops the account's shares from ProFTPD's lookup, so FTP and SFTP logins with a share's address fail as unknown users, and refuses every change by the holder in the panel and the API (403, account-held), the file API and the terminal. The holder's panel shows a notice with Release the hold, and their system mailbox gets a message when the hold begins and ends.

A release reverses each step: the markers removed, the mask lifted, the crontab put back (unless one was installed meanwhile: that one is kept, and the old one stays in /var/lib/elpan/hold/), linger on again for an active account with persistent services, and the recorded units started.

See and clear holds​

Accounts › Held lists every held account: since when, until when (or Until released), by which application, and whether it is In effect, with the processes left and the transfer sessions, and Release. Each held account's pages show a banner with Release too.

elpanctl hold list # Account, Status, Since, Until, By, Applied
elpanctl hold list --report # and Settled: whether the host agrees
elpanctl hold clear acme # release the hold

Applied is when the host steps last finished; pending means they haven't yet. Settled asks the host now: the three markers, the user manager masked and stopped, no process of the main and web users outside a transfer session, the crontab put aside, no share in the FTP lookup. A catatonit -P process the account's container copy left (podman unshare's pause process) runs nothing of the account's and isn't counted.

The panel logs Account held and Account hold released with the account and who released it (transfer, owner, operator, lease):

journalctl -u 'elpan-panel*' -g 'Account hold'
journalctl -t elpan-ssh-held # SSH logins refused for a held user

A stuck hold​

A hold under a lease ends by itself; one left after a move ends when somebody releases it. Clear a hold when its holder asks and can't do it themselves, or when it doesn't settle:

  • Not settled after a few minutes: run elpanctl hold clear, then let the tool hold the account again, or ask the holder to run the switch again. Every step is idempotent.
  • The tool is still running: it renews the hold, which sets it again. To stop a move, disconnect its approval in the account (Integrations › OAuth › Connected apps, by acting in the account): the tool's tokens stop at once and its lease runs out.
Releasing after a move

A hold left after a move keeps the old account from running beside the new one. Released, its cron jobs, containers and app servers start again on this server while the same ones run on the receiving server. To retire the account, terminate or delete it instead.

Packages​

elpan-panel 1.1.129, which brings account moves and holds, requires these, so an update installs them together:

PackageVersionFor account moves
elpan-ssh1.1.3The held check: /usr/lib/elpan/ssh/held-check by pam_exec, in two marked blocks first in the auth and session stacks of /etc/pam.d/sshd.
elpan-cli1.1.6transfer-shell copies a whole home, the container volumes and the system mailbox, keeping what the receiving account has.

elpan-ssh and /etc/pam.d/sshd​

sshd can't test a file in a Match block, so elpan-ssh adds the check to openssh-server's PAM file, between # BEGIN elpan-ssh: held accounts and # END elpan-ssh: held accounts: once in the auth stack, which refuses a held user's password and keyboard-interactive sign-in, and once in the session stack, which admits only a key listed in /var/lib/elpan/ssh/session-keys/<user>. For a user without a marker it costs one file check. elpan-ssh adds the blocks when installed, removes them when erased, and puts them back after an update of openssh-server.

Because the file is openssh-server's, rpm -V openssh-server reports it changed; that's expected:

S.5....T. c /etc/pam.d/sshd

Keep the blocks if you edit the file. Without them the markers are still written, but a held account's users sign in with their own keys and passwords. /usr/lib/elpan/ssh/pam-sshd-held status exits 0 when they're there, and pam-sshd-held add puts them back.

elpan-cli and the copy's state​

A copy into a home keeps its state in the receiving account's ~/.local/state/elpan-transfer/: the paths the home had before the copy began (pre-existing, never written, removed or re-owned), what the copy wrote (written) and its owners, and the giving account. An import from a file also keeps a staging copy of the home there, and one of the system mailbox in the mail user's ~/.local/state/elpan-transfer/staging/system, each marked with a CACHEDIR.TAG. The staging counts against the account's storage until the import is activated. Every copy of a home, and the holder's own export, leaves the directory out.

The tool removes it at the end, after the switch or at activate. A move abandoned before that leaves it, and the home then refuses a copy from another giving account. Removing the directory ends the copy, as the tool would: what it wrote stays, as the account's own files.