Importers

Move accounts in from cPanel, Plesk, DirectAdmin, Hestia and FastPanel backups. Checked first, staged, then committed or rolled back.

Available importers version 1.0.1 Part of Migrations

Actions

20 actions, callable from the panel, the command palette and the API as POST /api/v1/a/<id>. Internal actions used between modules are not listed.

ActionWhat it doesRiskPreview
importers.analyze Pre-flight an account backup medium No dry run
importers.run Import an analysed backup (dry run or commit) high
importers.upload.chunk Upload a piece of a backup archive low No dry run
importers.upload.finish Finish an archive upload low No dry run
importers.upload.abort Cancel an archive upload low No dry run
importers.rollback Roll an import back critical
importers.cron.enable Turn on the scheduled jobs of an import medium
importers.prerequisites Check what an import needs on its server (read) low No dry run
importers.discard Discard an analysed backup low No dry run
importers.get Get an import job (read) low No dry run
importers.list List import jobs (read) low No dry run
importers.transfer.connect Connect to another server medium No dry run
importers.transfer.trust Trust the old server's host key medium No dry run
importers.transfer.discover List the accounts on the old server (read) low No dry run
importers.transfer.start Copy accounts from the old server medium
importers.transfer.final Final pass before the DNS switch high
importers.transfer.checklist DNS switch checklist (read) low No dry run
importers.transfer.list List old servers and their transfers (read) low No dry run
importers.transfer.forget Forget an old server medium No dry run
importers.mail.fastpanel Bring mail over from a FastPanel server high

Permissions and limits

Permissions

  • importers.manage Analyse, stage, commit and roll back imports
  • importers.view View import jobs and reports

Engineering notes

Generated from modules/importers/docs.md at build 38156245. These are the notes the engineers keep next to the code: precise, technical, and honest about what is not done yet.

Moves accounts in from another panel or another server. Two ways in:

  • Backup file (cPanel cpmove, Plesk, DirectAdmin, Hestia, FastPanel): importers.analyze unpacks it safely into /var/lib/respirecloud/import/<id>/stage, importers.run creates everything through the owning modules.
  • Live transfer ("From another server", w11-28): importers.transfer.*. The node connects OUT over SSH, only reads, and brings an account into the same staging area; the same importers.run then creates it. Flow: connect (key or password into the vault, host key read through the egress guard) -> trust (a person confirms the fingerprint; pinned) -> discover (panel kind, accounts, sizes, what cannot come over) -> start (dry_run = the plan; first copy, one resumable job per account, a failed one does not stop the others) -> importers.run dry_run/commit -> final (rsync incremental, files synced into the account with os.Root, databases reloaded from a fresh dump, new mail, DNS checklist) -> forget (deletes credentials, pinned key and staged copies).

Safety rules

  • Private/loopback sources are refused unless the importers setting transfer_allow lists them (admin, logged at use; the UI warns). Addresses are resolved once through internal/egress and ssh/rsync dial that address.
  • A different host key than the confirmed one stops the transfer before any command runs.
  • Credentials: vault only; passed to the agent per call; rsync gets them through 0600 files in a private directory removed afterwards (key file or SSH_ASKPASS), never on a command line; scrubbed from errors and job logs.
  • Source content is hostile: rsync runs with --safe-links --no-specials --no-devices, no hard links, --chmod=ug-s,-t; staging is re-walked (links leaving the tree, special files removed, set-id cleared, entry/depth/size bounds against the plan's disk quota); the account copy never follows links in the account's home; dumps are loaded only by databases.db.import as the account's database user (finding 004); scheduled tasks are created paused (see below); names are validated as new names; the source account's home comes from the source's own getent.
  • Nothing is installed on or changed on the source. Only read commands run there (listed in internal/agent/transfer.go).

Known limits

Plain Linux is proven end to end. cPanel, Plesk and DirectAdmin are discovered through their documented read-only listings and their accounts' files, databases and DNS zones are pulled directly. From cPanel a live copy also brings the mailboxes: the Maildirs (~/mail/<domain>/<user>) and password hashes (~/etc/<domain>/shadow) arrive with the home copy and the mailboxes are created with their hashes; the final pass copies new mail (a mailbox created on the old server after the first copy is not added; run a new transfer for it). From DirectAdmin the Maildirs (~/imap/<domain>/<user>/Maildir) are copied; passwords carry over only if the login can read /etc/virtual/<domain>/passwd (usually root only), else the mailbox gets a new password. Mailboxes of Plesk, forwarders and certificates of those panels are not brought over by a live copy (use their backup). Sites whose files live outside the account's home are reported, not copied. Database users get new passwords (shown once).

Mail from a FastPanel server (card C, w12)

importers.mail.fastpanel {path, account_id?, node_id?, domains?, skip_maildirs?} reads a folder the owner prepared from the old server (etc/exim4/{passwd,aliases,domains,dkim_selector,dkim/}, etc/dovecot/dovecot.passwd, Maildirs under email/ or maildirs/) and creates, through the domains and mail modules, the domains, mailboxes with their password hashes as they are, aliases, forwards (an alias on a mailbox), the catch-all, quotas, DKIM keys (mail.dkim.import) and mail (mail.maildir.import). Never read: passwd.client, srs, certs_map, domainips. A link in the folder is not followed (os.Root); report lines name lines by number, never by content. dry_run lists every object; what is already here is already_here and untouched, so the whole import can be run again right before the switch (only new mail is copied). One domain failing does not stop the others. The reader is lib/exim.go (lib.ReadEximFolder), run on the node by the agent op importers.exim_scan. Formats FastPanel really writes (seen in a real export, shapes only): dovecot.passwd lines user@domain:{CRAM-MD5}<64 hex>:uid:gid::home::...:userdb_quota_rule=*:..., exim4/passwd with numeric ids only, aliases name@domain:target@domain:word, dkim_selector as domain:selector. {CRAM-MD5} is accepted by mail.mailbox.create for this (Dovecot checks plain logins against it). Test: the hashes of a fixture folder (made by Dovecot for six schemes) log in through a real Dovecot in Docker (lib/exim_dovecot_test.go). CLI: rcctl importers.mail.fastpanel --path /data/mail-migrate --dry-run, then without --dry-run. A second run leaves every forward that already exists exactly as it is (even one changed by hand); if the existing forwards of a domain cannot be read, its forwards are skipped and reported instead of being set again. DNS (batch fix mail-dns-hold): dns is hold by default, so an import changes nothing in the domains' DNS (no MX, SPF, DMARC or DKIM written at the provider before the mail is here). New domains are created with skip_auto: [mail] and added with mail.domain.add {dns, dkim} (dkim import when the folder has the domain's key, so no new selector is made). The preview lists, per new domain, every record and where it would be written (mail.domain.dns.preview). Publish later per domain with mail.domain.dns.fix (its own preview). dns: write publishes at once. Accounts for new domains: account_id, else the only account on the server, else the server owner's account; with several and none named the preview flags it ("choose the account") and a real run stops with the same sentence. The panel tab has an account chooser when there is more than one. This action is long: a direct API caller that does not want to wait passes ?async=1 (or Prefer: respond-async) and gets {job_id} at once, then follows /api/v1/jobs/<id>; rcctl and the MCP tools always do this. The preview counts each Maildir's messages with a dry run of the node's mail.maildir.import (declared in agent_ops).

Scheduled jobs and mailbox passwords from a backup (F3, w16)

Scheduled jobs. importers.run creates every cron line of the backup through accounts.cron.create with enabled: false: a tracked job gets its timer but it is not started; the old home path in the command is rewritten to the new home. They are paused because the old server keeps running the same jobs until the DNS moves, and two copies would send the same mail or charge the same card twice. The report and the transfer checklist (cron_after_switch) list them with "turn on after the DNS switch". importers.cron.enable {job_id} (with dry_run) turns on every paused job of one committed import. A job that cannot be created is reported as skipped. Rolling the import back deletes them.

Mailbox passwords. The crypt hash in the backup is passed to mail.mailbox.create as password_hash, so the person keeps the old password. Coverage:

Source Where the hash is read Kept
cPanel backup homedir/etc/<domain>/shadow $6$ SHA512-CRYPT, $5$ SHA256-CRYPT, $1$ MD5-CRYPT, $2y$ BLF-CRYPT
DirectAdmin <domain>/email/passwd same schemes (DES crypt is not accepted)
Hestia mail/<domain>.conf MD5/PASSWORD field same schemes
Plesk encrypted/crypt password only when it is one of those schemes; Plesk's own $AES-128-CBC$ is not
FastPanel dovecot passwd (importers.mail.fastpanel) as before

A hash the mail module refuses, an unknown scheme or a missing hash falls back to a new password, reported as "password reset required". Live copies from a running cPanel, Plesk or DirectAdmin server still cannot read the hashes (use the backup).