Manage shared ARNavi VPS contours and application keys from infrastructure

This commit is contained in:
DCCONSTRUCTIONS
2026-09-30 15:34:39 +03:00
parent 6ca6738bab
commit 1828a05332
22 changed files with 1099 additions and 2 deletions
+103
View File
@@ -0,0 +1,103 @@
# Shared ARNavi VPS and Device Core infrastructure
Status: implementation in progress, 2026-09-30. No production activation yet.
Device Core now has two distinct transport integrations. ADR 0001 still governs
the original Core-initiated mTLS Edge channel. The independent ARNavi VPS service
is a durable, multi-application receiver owned by
`NODEDC_MISSION_CORE_ARNAVI-VPS`. It is not an instance of that old Edge protocol.
Its TCP acknowledgement follows its own durable journal commit. Device Core
initiates all HTTPS requests; this integration adds no inbound Synology port.
## Operator workflow
1. Create a project host in Infrastructure / VPS and hosts, or use its existing
entry. Open the settings gear.
2. Import the connection package generated on the VPS. The package binds the
host identity, endpoint, exact TLS certificate fingerprint, OAuth application
identity and replaceable client credential.
3. The server validates that credential against the pinned host before saving
it in a separate private persistent filesystem mount. No secret goes into
project tables, audit payloads, browser storage, Git or deployment artifacts.
4. In Contours and projects, create a contour on the VPS and explicitly link it
to an accessible project of the same company. Linking another project adds
a view of the same host there. It does not duplicate the remote VPS or key.
5. In Applications and keys, create an application for a selected contour.
Issue its key and transfer it to that application's backend. Each application
has its own identity even when several consume the same contour.
6. Reissue replaces the credentials of that application. Contour/device IDs,
history and subscriptions remain. Revoke immediately stops that credential.
A key shown by issuance is not retrievable later; losing it requires reissue.
Console and interface call the same VPS domain and provider routines. Only root
on the VPS can create the initial host administrator. Remote management cannot
promote a fleet application into a host administrator or revoke the current
host administrator. Host-key recovery uses the root console and package import.
## Local authority and ownership
A company has one `device_b2_hosts` connection per remote host identity.
`device_b2_host_views` exposes it through project infrastructure records.
`device_b2_contour_links` maps each remote contour to exactly one project in
that company. Access to a project never implies access to other project fleets.
The ordinary device read path filters links by authorized project before
requesting snapshots, including when its backend credential can administer the
whole remote host.
Global VPS management additionally requires company ownership authority from
Hub and the current project's infrastructure capability. Secret import,
issuance and revocation also require `credential.manage`. Browser visibility
is convenience only; all authority is checked by Core and then the VPS.
The connection secret lives behind an opaque reference in a dedicated directory
owned by the Core container UID, mode 0700; files are exclusive-created 0600,
fsynced and protected against symlinks. Back up that directory privately along
with Postgres. A failed DB transaction can leave an unreferenced secret file;
it is not automatically bound and must not be imported by scanning the folder.
## Protocol and credentials
Hydra owns OAuth issuance and validation. Device Core uses the pinned
`oauth4webapi` 3.8.8 implementation of client_credentials. A transport adapter
completes TLS and verifies the imported SHA-256 fingerprint before writing any
HTTP credential. It permits only public IPv4 endpoints, the imported origin,
`/oauth2/token` and `/v2/` routes, and never follows redirects or uses ambient
proxies. Raw Hydra administration remains loopback-only on the VPS.
A credential-issue request is reserved durably at the VPS before generation.
Replaying its ID does not mint a second credential or replay a saved secret.
If the response is lost, inspect current credentials, revoke the orphan if
necessary, and deliberately issue another key. Ordinary contour/application
creation is idempotent by its immutable human-readable key.
## Deployment boundary
The separate canonical `device-b2-foundation-v1.sql` migration only adds metadata
tables and constraints. It is applied by the registered foundation transition;
the ordinary application startup migration list remains unchanged. Activation also needs
one private Core mount and one environment path. This changes the current
release foundation and therefore requires a separate canonical deployment
transition before the normal commit-to-main release pipeline can accept it.
Do not weaken the existing release migration/topology guards to publish this
feature. Postgres/container volumes, existing Edge topology, identities and
secrets remain prerequisites, not selected services.
The public UI and running VPS remain on their accepted previous releases until
that exact transition and VPS authority installation pass acceptance. The old
unidentified Robot2B pilot must not be treated as the physical rover tracker.
## Validation bounds
Current local checks cover company/project authorization, independent VPS
subscriptions, key replacement, private-file permissions and TLS pin-before-send.
These are bounded tests, not fleet simulation. The owner deferred Worker006,
load and simulation. Production acceptance still needs the real VPS, both
DCTOUCH projects, real key import, cross-project denial and independent app
registration. No claim about 50/100-device load is made here.
2026-09-30 source qualification: all 275 repository Node tests, TypeScript and UI
production build pass. The standalone `scripts/qualify-b2-foundation.mjs` runs all
17 existing migrations, the new SQL, and the actual connection/link repository
against temporary PostgreSQL WASM. It proves the automatic second-project host
view, secret-reference storage, audit redaction and cross-company/duplicate-link
rejection. This does not substitute for the NAS PostgreSQL16 acceptance.