Skip to content
VPS, Dedicated Servers and Colocation across ServerBike service locations

WHMCS integration

Local keyring custody and recovery

Command-line keyring setup, rotation and recovery for operators with shell access.

ServerBike Reseller 0.1.8Advanced appendix
Documentation menu
ServerBike Reseller Documentation

Local encryption keyring: advanced appendix

Applies to ServerBike Reseller for WHMCS 0.1.8 and ServerBike Reseller Public API 1.1.1.

The keyring and its coordination lock protect the API credentials stored in your installation. For a first-time setup, the addon's Connection page is the recommended route when it is available. Maintenance and recovery should be carried out by a qualified administrator. Never use these instructions to reset an existing installation.

First-time CLI setup only

As the same non-root OS user used by PHP-FPM and WHMCS cron, create a dedicated new directory outside the document root, mode 0700, owned by that user. Use an exclusive-create operation and cryptographic randomness to create your own keyring; do not overwrite any file. A keyring entry is <local_key_id> <32_random_bytes_as_43_unpadded_base64url_characters> current followed by LF. Exactly one current key is required; retained previous keys can be decrypt. Key file mode 0600 (installed key file may be 0400). No symlinks in the path. Create the coordination lock serverbike-reseller-keyring-coordination.lock in the custody directory, mode 0600, owned by the same user, with exactly serverbike-reseller-keyring-coordination-lock-v1 followed by one LF. The existing helper KeyringCoordinationLock::provisionLockFile() provisions a new lock. Use a local filesystem with suitable locking, atomic rename and fsync semantics. The CLI checks also require PHP subprocess execution and filesystem classification (proc_open, shell_exec, local stat/mount). An explicitly configured R10_CUSTODY_UID must match this user.

From your WHMCS root, after activating the addon, run the documented commands from the package, replacing the placeholders with your own private paths:

Text
php modules/addons/serverbike_reseller/bin/custody_cli.php preflight <custody_dir> [lock_file]
php modules/addons/serverbike_reseller/bin/custody_cli.php init <key_file_path>

Square brackets mark an optional argument; do not type them. These commands set up the local keyring only. Afterwards, add the API credential issued by ServerBike on the Connection page. If the journal is missing or inconsistent, the commands stop safely. If any check fails, stop rather than forcing the setup.

Rotation and recovery

Rotating your API credential is a separate task: save, check and activate the new credential, and confirm that both website and scheduled requests work before you ask ServerBike to revoke the old one. The installed keyring always stays local.

Local keyring rotation uses the documented custody_cli.php rotate <candidate_key_file> <installed_key_file> operation under the coordination lock. It re-encrypts the credential and records the journal transition. Retain decrypt keys until all dependent envelopes are migrated. Consult the installed CLI usage and ServerBike support for reconcile after interruption and repair for explicit stable-digest recovery. Do not guess arguments, edit the journal or rerun init to erase an inconsistency. Backup and restore the matching keyring and module database/journal together, not independently.

Lost keyring: Stop and contact support. Restore a matching secured backup if available. Without it the encrypted API secret cannot be recovered. The module's Remove all module data action is destructive to local module records, not a normal credential reset; it is not part of this procedure. Do not invoke it on a live installation without an approved recovery plan covering service mappings, billing records, existing operations and re-enrollment. Request a new credential through ServerBike if needed. Never copy a lab or another reseller's keyring or database.