Repository navigation
Description
Scope update — maintainer, 2026-11-30
Expand this issue to cover both MikroTik.com license credentials and the custom RouterOS login supplied by --add-user on add / first start. This covers file-based credential input and moving pending custom-user passwords out of machine.json into the existing instance credential store (maintainer approved, 2026-11-30). It does not add password rotation or change the instance store's location/plaintext-at-rest policy.
Why
tikoci/app-t3code runs T3 Code as a RouterOS /app container with quickchr in the image, so agents there can boot CHRs. Nested CHRs on a free license are slow, so the container should be able to license them. Today the MikroTik.com account reaches quickchr only from flags, the MIKROTIK_WEB_ACCOUNT + MIKROTIK_WEB_PASSWORD env pair, or the secret store (Bun.secrets, else the config file).
In a container, each of those is a poor home for the license password:
- Env: RouterOS copies an
/appenv value, including an expanded[secret:…], into the derived/containerentry. Aread,!sensitiveuser can read it there, and a plain/exportprints it. Measured on CHR 7.25.2 for centrs inside T3: credentials, config, host router app-t3code#47 (research, PR tikoci/app-t3code#73). - Keychain: there is none. That is credentials: decide how (or whether) MikroTik.com license credentials use the OS keychain (Bun.secrets) — hang risk for agents #283's hang question in another form.
- The config-file fallback would put the license password in plain text on the persistent volume.
RouterOS /app (7.23+) delivers secrets as files at /run/secrets/<name>, as Docker and Podman do. Those files stay out of RouterOS config and export; this does not hide them from administrators who can read the backing files.
The custom RouterOS account has the same input gap: --add-user <name:password> accepts a chosen password at first boot, but there is no native file input. Callers should be able to pass a mounted secret path without expanding the password into command-line arguments.
Centrs' corresponding file-input work, tikoci/centrs#672, is completed via tikoci/centrs#674. Reuse its input conventions where appropriate.
Included: MikroTik.com licensing
MIKROTIK_WEB_PASSWORD_FILE: read the password from a path, stripping one trailing newline. It counts as the password half of the env pair, soMIKROTIK_WEB_ACCOUNT+MIKROTIK_WEB_PASSWORD_FILEis a complete credential and is resolved before the secret store. A complete file/env credential must not reach the keychain read (credentials: decide how (or whether) MikroTik.com license credentials use the OS keychain (Bun.secrets) — hang risk for agents #283).MIKROTIK_WEB_ACCOUNT_FILEfor parity. The account isn't secret, but one file per value keeps/appYAML simple.- Flag forms:
start --license-password-file <path>,set --license --password-file <path>, and the standalonelicensecommand's equivalent. Account-file flag parity may be settled in the implementation PR. - Preserve
licenseFromStartFlags's rule: a half-given credential is completed only from its own env/file source, never from a different stored account/password pair. - Preserve
add's existing license-level-only behavior: licensing credentials are resolved at the firststart, not stored byadd. - File-sourced license credentials are read for use, not implicitly saved to the credential store.
Included: custom RouterOS user provisioning
Support a username plus a password-file path on both add and first start. Proposed spelling: --add-user <name> --add-user-password-file <path>; the final flag spelling is reviewed in the implementation PR.
- Preserve existing
--add-user <name:password>behavior. An inline password and a file source for the same password are a usage error. - The file supplies the password only; do not parse its contents as
name:password. Passwords containing colons or spaces must survive unchanged, apart from the documented trailing-newline removal. - A file-based custom user follows the same provisioning-window, rollback and authentication verification rules as an inline custom user. It does not change the existing admin password or rotate an already-provisioned account.
- Explicit custom users keep their existing precedence over
--secure-login; adding file input does not add managed SSH-key provisioning to custom users (provisioning: add a managed, batch-verified SSH key to an already-booted machine (set --ssh-key) #280 remains separate). - Cover both
addthen a laterstart, andstartthat creates a machine. Document when the file is read and what must remain available between those commands. - Pending storage (maintainer approved): both inline and file-sourced custom-user passwords move into the existing instance credential store at
add, before first boot.machine.jsoncontains only a placeholder; a later plainstartdoes not need the source file. Preserve rollback/retry, including restoration of the original pending credential after a failed override, and refuse missing pending credentials before launch. Keep the password out of settings. This does not promise the password exists only in the source file or change the instance store's plaintext-at-rest policy; license files remain read-for-use without implicit storage.
Shared input rules
- Setting both
XandX_FILE, or both inline and file flag forms for the same credential, is a usage error. - Remove one trailing line ending; do not broadly trim password whitespace.
- An explicitly selected unreadable/invalid credential file fails clearly, without silently falling back to another credential. Resolve and validate inputs before avoidable state-changing work.
- Errors may name the path, never its contents. Do not introduce password contents into dry-run options or new diagnostics.
- Source files are read only: never rewrite, copy or delete the mounted secret as a side effect.
- Keep the implementation shared across the relevant CLI entry points rather than adding divergent credential resolvers.
Other inputs reviewed — outside this issue
exec --user / --passwordoverride: another inline password surface. Recommendation: defer a native file override here; ordinary exec already resolves the stored instance login, and richer device-access/auth flows belong in centrs. This remains a candidate only if a concrete override workflow needs it.- Automatically generated
--secure-loginpassword and SSH key: no caller-supplied secret to read from a file; preserve generation. - Existing admin password changes, post-boot rotation, and SSH-key import: separate capabilities, not implied by file input.
- Instance-store location and plaintext-at-rest / keychain policy: unchanged. Moving pending passwords out of machine.json is included above; credentials: decide how (or whether) MikroTik.com license credentials use the OS keychain (Bun.secrets) — hang risk for agents #283 remains the license/keychain question.
- Arbitrary RouterOS script secrets, raw QEMU arguments and sudo authentication: do not add a generic secret-file framework for them in this issue.
Done when
- Both included credential scopes work through file inputs, with documented precedence, conflict and newline rules.
- Unit coverage exercises file read failures, conflicting sources, password whitespace/colons, and license resolver consistency.
- Passing live CHR integration coverage proves file-sourced custom-user provisioning and authenticated access for both creation paths, with normal cleanup and rollback behavior.
- The licensing path is verified through the narrow relevant checks; do not consume trial activations for every test.
- MANUAL, CLI help and CHANGELOG describe the new forms, first-boot limits, and the distinction between file input and instance-password storage.
Trial activations are limited, so CI cannot license every CHR. This issue concerns how credentials reach quickchr when licensing or custom-user provisioning is wanted.
Originally filed from tikoci/app-t3code#47 at the owner's request; expanded to include --add-user at the owner's request on 2026-11-30.
Activity
[-]Read MikroTik.com license credentials from files: MIKROTIK_WEB_PASSWORD_FILE (+ _ACCOUNT_FILE, --license-password-file)[/-][+]credentials: file inputs for MikroTik licensing and --add-user provisioning[/+]mobileskyfi commentedon Dec 1, 2026
Maintainer decision (2026-11-30): include the pending-storage fix for both inline and file-based --add-user inputs. Pending custom-user passwords move out of machine.json into the existing instance credential store at add; a later plain start does not require the source file. Preserve rollback/retry behavior and test that no password contents reach machine.json, including before first boot. This expands the earlier input-only boundary; the existing credential-store location and plaintext-at-rest policy remain unchanged.
fix(credentials): keep the commit error when restoring credentials al…
fix(credentials): try factory admin first for pending users in boot f…
test(credentials): skip the serial socket file on Windows named pipes (…
fix(credentials): keep the store's owner and the pending login on fai…
fix(credentials): restore the login on a failed reset; hand root's lo…
fix(credentials): no root chown of lock entries; readable lock records (
fix(credentials): set root-written modes through the descriptor (#323)
fix(credentials): write lock records and the store in full or fail (#323
chore(cspell): add xfsz (#323)