Skip to content

centrs inside T3: credentials, config, host router #47

Open

Description

@mobileskyfi

Replaces #19. This began as a placeholder while #19 was hidden (Amm0Bot suspension, 2026-11-08). #19 is visible again and closed in favor of this issue (2026-11-10). Its open questions are under "Carried from #19". These are notes, not a spec.

centrs inside T3: credentials, config seeds and access to the host router. Menu entry: Roadmap #30.

Current plan (2026-11-26)

Research PR #73 merged. Centrs PR #674 closed #666 and #672 and ships in @tikoci/centrs@0.2.0-next.31. Implementation draft #74 uses the existing Dockerfile next argument. The amd64 image smoke ran with Centrs 0.2.0-next.31.

  • CDB unlock. Set CENTRS_CDB_PASSWORD_FILE to the mounted /run/secrets path in the YAML and image defaults. The value stays in the file. A missing file is tolerated when an open CDB needs no key, and an encrypted load fails with cdb/password-unavailable. An operation with no CDB has no warning. RouterOS users who can read the backing app files can still read the mounted secret.
  • Router credentials. CENTRS_PASSWORD_FILE applies to the invocation and outranks records, so leave it unset in the image. Import a T3 secret-card file into a record with devices add|set --password-stdin; the agent or T3 owns cleanup. A bare CENTRS_HOST does not select a target. Agent context: tell agents where they run (environment note, user AGENTS.md, live inventory) #71 should tell agents which positional target to pass once it has been verified.
  • Scope of __default__. A Linux smoke test of the published CLI used an encrypted scratch CDB and a loopback REST fixture with dummy credentials. The real process key-file setting survived a conflicting project .env, a per-call --password-file took precedence, and an unregistered target received the __default__ password. The earlier proposal to seed operator credentials there would make them global. Keep the empty admin seed opt-in for quickchr labs. Draft Seed an encrypted Centrs host address book on RouterOS #74 seeds the host address, then operators import real router passwords into that host record using centrs devices set --password-stdin. RouterOS account permissions define access. Keep the CDB encryption key separate from the account password.

First implementation draft

  • Fresh RouterOS /app: have t3app init create the encrypted CDB and seed the host from [networkRouterIP]. Seed only app-owned state, make startup safe to retry after partial initialization, and preserve pre-existing CDBs. Standalone Docker/Podman should start without a host record when the router and secret are absent.
  • Before marking ready, check a disposable CHR with the built image and a signed-in T3 agent. Read the host from a project directory, verify an unrelated target does not inherit a real host password, then exercise restart, /app/update, and an existing CDB. Check a missing or changed key and document recovery without recreating the CDB. Document how existing installs adopt the new YAML with backups, since applying YAML in place can wipe volumes.
  • Provider env inheritance, T3 secret-card restart behavior and MCP are follow-ups. The draft's bootstrap uses the image's file-path default. The signed-in check validates that the real agent can use it. For Agent context: tell agents where they run (environment note, user AGENTS.md, live inventory) #71, the README records how to name the positional host and switch off the file key for a direct Centrs invocation using an existing value-based key. The broader RouterOS secret-exposure report can proceed independently.

Initial research questions

  • Who owns what: centrs owns target resolution, the CDB and authorization. app-t3code owns the deployment-specific handoff: env vars, /container/shell, T3 secret entry. A T3 secret card is a way to enter a secret; it is not where the secret is stored.

  • Three recipes, each tested on its own: env var input, temporary secret delivery (T3 secret → file), and persistent CDB access. A skill can pick between them only after each one works. A small t3app helper (t3app: app-owned command, settings and source layout #45) may make them reliable, without reimplementing centrs.

  • The project tracks intent, inventory references, observations and evidence, including planned and retired devices. Credentials don't belong in tracked project content.

  • MCP Apps are a possible centrs-owned presentation path (flagged on #29).

  • Feeds the workspace templates item in Roadmap #30 (Later).

  • Carried from centrs inside T3: credentials, config seeds, reaching the host router #19 (open questions):

    • Config seeds: should the /app YAML carry non-secret CENTRS_* defaults, such as a CDB path in /data? Any key added follows the YAML ↔ Dockerfile ENV rule.
    • The host router: is there a zero-config way for centrs to reach the RouterOS it runs on (gateway address, a dedicated API user)? What is the least privilege it needs?
    • Where a delivered secret lands: is /tmp a tmpfs in a RouterOS container? Check before a recipe writes a secret file there.
    • Output: skills that describe the safe credential path (Skills track #46), and centrs issues for anything worked around here.

Evidence

  • Secret research: traces private storage, expiry and CLI delivery. The handoff to centrs is untested.

Activity

  1. added
    research
    upstream
    on Nov 10, 2026
  2. changed the title [-]centrs inside T3: credentials, config, host router — placeholder for #19[/-] [+]centrs inside T3: credentials, config, host router[/+] on Nov 10, 2026
  3. mobileskyfi commented on Nov 25, 2026

    @mobileskyfi
    ContributorAuthor

    Triage 2026-11-25: this moves to Now, paired with #71 (agent context). The two meet at one question: what an agent in the container knows about the router it runs on, and how it reaches it.

    Since this issue was written:

    Suggested order of first probes (each one a recorded result, on a CHR twin, never bigdude without asking):

    1. From inside the container on RouterOS: what are the default gateway and the veth/bridge address, and does the router answer REST/API/SSH there? Which /ip/service address= restrictions apply?
    2. A least-privilege RouterOS user group for an in-container agent (read-only first), and where its credentials land: CDB in /data (an env seed such as CENTRS_CDB_FILE, which follows the YAML ↔ Dockerfile ENV rule) or a T3 secret delivered to a file (is /tmp a tmpfs?).
    3. What Agent context: tell agents where they run (environment note, user AGENTS.md, live inventory) #71's note can then say: a stable handle (e.g. host) the agent can use with centrs retrieve host /system/resource.

    The centrs-side design remains centrs's; anything worked around here goes to #29 first.

  4. mobileskyfi commented on Nov 25, 2026

    @mobileskyfi
    ContributorAuthor

    Framing for the research (owner discussion, 2026-11-25). There are several ways to get settings and credentials to centrs, we don't yet understand each one well, and our T3 research is dated: t3code-integration is grounded on T3 v0.1.6, and t3code-presentation/secrets.md on v0.1.7. The image ships 0.1.11 and 0.1.12 is out. So the first step is to rebuild the base understanding, not to pick a recipe.

    The paths (owner's list):

    1. Container env aligned with centrs's own CENTRS_*. This is the owner's strawman for a starting point. centrs already reads them (precedence centrs.env → CDB comment-kv → CENTRS_* env → flag, reported in meta.settings), so it needs no code here.
    2. A RouterOS-side secret for the container (does /container or /app have one, or only env?), and the Docker/Podman/Proxmox equivalents (Running outside RouterOS: Docker/Podman/Proxmox docs, and a durable LAN test host #72).
    3. T3 UI secret prompts: entered in T3, delivered to a file or command.
    4. .env files in a project. Today this is an accident, not a design: centrs#666.
    5. A user-level CDB in /data (CENTRS_CDB_FILE, optionally CENTRS_CDB_PASSWORD).
    6. "centrs doing more": its MCP server, where the CDB is the authorization boundary (mcp=ro|rw).

    For each path, what to establish:

    • Who can see it: /container print / /app export, /container/log, ps//proc/*/environ for every process including agents, T3's stored state, backups, git.
    • Lifecycle: first init, restart, /app/update, /app/set environment= (replaces the whole list and splits on commas), image replacement, rotation, removal.
    • Second-order effects: a credential in the env is visible to every agent and child process. YAML keys must also be Dockerfile ENV defaults (a test enforces it), which can't hold secrets. The same setting can arrive by several paths, and centrs's precedence decides which wins.
    • Off RouterOS (Running outside RouterOS: Docker/Podman/Proxmox docs, and a durable LAN test host #72): which paths change.

    Proposed shape: a research topic, docs/research/2026-11-centrs-credentials/ (or 2026-12-… if it starts next month). Its first section is a refresh of the T3 side at the current upstream tag (secret prompt, env handling, MCP, preview tunnel), reading v0.1.12 source so the research isn't dated again by the bump in #68. Then one row per path, each grounded by a probe on a twin. Recipes and the #71 note follow from that matrix; they don't come before it. Whatever centrs should do differently gets filed in centrs.

  5. mobileskyfi commented on Nov 25, 2026

    @mobileskyfi
    ContributorAuthor

    First research pass is in draft PR #73 (docs/research/2026-11-centrs-credentials/), from a CHR 7.25.2 lab plus T3 v0.1.12 and centrs source.

    • Host router: [networkRouterIP] is the container's gateway, and the router answers there (REST/API/SSH). On a default quickchr CHR, admin with no password works, so CENTRS_HOST=[networkRouterIP] is the "just works" case. Placeholders also expand in an operator's environment= value.
    • /app secrets are generated, can be set by the operator (/app/set secrets="name:value", volume kept) and are stable across restart, update and reboot. They are not hidden from read users without sensitive: the /container env copy, plain /export and the backing /file all show the value. The sensitive policy holds only for /app's own field.
    • T3 provider env (value, sensitive value or op://) is inherited by the agent's commands per the v0.1.12 source; runtime check pending.
    • The strawman's implications and the open probes are at the end of the README.
  6. mobileskyfi commented on Nov 25, 2026

    @mobileskyfi
    ContributorAuthor

    Second pass (PR #73), with the real image on a CHR, plus the owner's direction recorded in the README.

    One workable scheme using today's centrs, measured end to end:

    1. The YAML declares an app secret as a file only (/run/secrets/<name>, with no [secret:…] in the env, so nothing reaches /container env, /export or the log).
    2. In the container, centrs devices init --encrypt creates /data/.config/tikoci/winbox.cdb (mode 0600, no plaintext), keyed by that file. __default__ is admin with no password, and the host record is the gateway. centrs reads with sources cdb, and without the key it fails closed (cdb/password-required).
    3. On the router, the same generated value becomes a dedicated account: /user/add name=t3code group=<ro group> password=[/file/get …secret-<name> contents]. Through the CDB, reads work, and RouterOS refuses a write (not enough permissions). The policy is the account, as decided.

    The open gap is getting the key to each centrs process: CENTRS_CDB_PASSWORD is env-only by design. Options, in the README's "Direction": t3app exports it into T3's process env (process-only, not RouterOS config); a centrs CENTRS_CDB_PASSWORD_FILE tweak (/run/secrets is neither persisted nor beside the CDB); or agents prefix it themselves.

    Also:

    • CENTRS_HOST doesn't select a target, so the host belongs in the CDB.
    • T3's secret store can't move off /data: it holds T3's own signing keys.
    • An op shim could resolve op:// from our side, but it's noted, not recommended.
    • Whether provider env reaches a provider session needs a signed-in session.
    • Free-license CHR: the image pull is fast (73 s), but downloads inside the container run at about 46 KB/s.
  7. mobileskyfi commented on Nov 25, 2026

    @mobileskyfi
    ContributorAuthor

    Decided (owner, 2026-11-25), recorded in PR #73's README:

    • The CDB key reaches centrs through a file. That is centrs#672: CENTRS_CDB_PASSWORD_FILE / --cdb-password-file, CENTRS_PASSWORD_FILE / --password-file for parity, and devices add|set --password-file with an optional remove-after, for T3 secret-card files. With it, CENTRS_CDB_PASSWORD_FILE=/run/secrets/<name> is a plain setting for the YAML and the image ENV.
    • The host goes in the CDB, seeded at startup from [networkRouterIP] or the gateway.
    • No op shim. T3's secret store stays as T3 made it; router passwords don't go there.
    • The policy is the RouterOS account given to the agent. There is no read-only layer here.

    The app-t3code side, once centrs#672 lands, is a t3app init slice. It initializes the encrypted CDB if none exists, seeds __default__ and the host, records the platform (RouterOS host vs Docker), and adds CENTRS_CDB_PASSWORD_FILE plus the secrets: entry to the YAML. Still to grow out of the research: how to seed once vs reconcile, and what happens when the operator changes the secret later.

  8. mobileskyfi commented on Nov 25, 2026

    @mobileskyfi
    ContributorAuthor

    PR #73 review rounds closed (Codex 6, CodeRabbit 6; all fixed and resolved). Two things the future t3app init slice should keep:

    • Decided (owner): a T3 secret card's typed value sits in plain text under /data/.t3/userdata/secrets until it's imported into the CDB and removed. That's accepted as how T3 works, and the same holds for anything else T3 and an agent do with a secret. On RouterOS, an admin who can read /file can read the volume's files anyway, so RouterOS admin access is the boundary that matters.
    • Target selection: a CDB record doesn't select itself. Agents pass the host as a positional <target> (the address, or an identity once the record carries one), and the record supplies the credentials. --host alone skips the CDB, and --group host fans out. The environment note (Agent context: tell agents where they run (environment note, user AGENTS.md, live inventory) #71) should say how to name the host, not only that a record exists.
  9. mobileskyfi commented on Nov 26, 2026

    @mobileskyfi
    ContributorAuthor

    centrs#672 is settled and aligned with PR #73 (ce8bbec). Inputs for the t3app init slice:

    • CENTRS_CDB_PASSWORD_FILE=/run/secrets/<name> can be an image-wide ENV default. A missing file when no key is needed (an open CDB, no CDB yet, plain Docker) is a warning, not an error.
    • Router credentials come in through app-t3code's own env names (not CENTRS_*), and t3app init writes them into the CDB's __default__ record. Never set CENTRS_PASSWORD_FILE container-wide: it outranks every record.
    • centrs#666 (Bun's .env auto-load) lands before centrs#672 or together with it. The centrs matrix records this (centrs PR #673, merged).
    • An idea, not filed: centrs devices init could take the __default__ credentials, so creating and seeding the CDB is one write.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    researchupstream

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions