Skip to content

feat: per-tenant admin flag + doctor key-placement invariants#5

Merged
AlenHay merged 1 commit into
mainfrom
feat/tenant-admin-flag
Jul 10, 2026
Merged

feat: per-tenant admin flag + doctor key-placement invariants#5
AlenHay merged 1 commit into
mainfrom
feat/tenant-admin-flag

Conversation

@AlenHay

@AlenHay AlenHay commented Jul 10, 2026

Copy link
Copy Markdown
Member

What

Adds a per-tenant admin: true flag to tenants.yaml (default false) for the "admin workspace host access via SSH" feature (DX-WORKSPACE-SHIPPING § 4). vswarm carries the flag and enforces invariants; it never touches host ssh config or authorized_keys — key minting/delivery is the deployment layer's job (companion Ansible PR).

Changes

  • internal/config: Tenant.Admin field, parser case in applyTenant (parseBool, mirrors manage_tunnel), Save() round-trip (admin: true emitted only when set). Rejects-unknown-key parser unchanged.
  • cmd/vswarm/doctor.go: two real invariants over the well-known path config/<name>/home/.ssh/vswarm-admin (doctor runs as root on the host):
    • (a) no NON-admin tenant home holds a vswarm-admin key file (a stranded key after a flag downgrade FAILs the gate);
    • (b) every admin tenant's key file exists with mode 0600.
  • Docs: DEPLOYMENT.md admin-SSH section (split-ownership contract, ssh -i ~/.ssh/vswarm-admin ubuntu@<gateway> usage, gateway = 172.31.<10+index>.1); tenants.example.yaml documents the key.
  • Test: config round-trip extended to cover the admin key.

Verification

gofmt -l . clean, go build ./..., go vet ./..., go test ./... all pass (golang:1.22-bookworm).

Add an `admin: true` per-tenant flag to tenants.yaml (default false),
parsed and round-tripped by the config package alongside `services:`.

vswarm never touches host ssh config or authorized_keys; it only carries
the flag and gains two doctor invariants over the well-known admin key
path config/<name>/home/.ssh/vswarm-admin:
  (a) no non-admin tenant home holds a vswarm-admin key file;
  (b) every admin tenant's key file exists with mode 0600.

Document the split-ownership contract and `ssh -i ~/.ssh/vswarm-admin
ubuntu@<gateway>` usage in DEPLOYMENT.md; extend the config round-trip
test to cover the new key.
@AlenHay
AlenHay merged commit 7abab39 into main Jul 10, 2026
4 checks passed
@AlenHay
AlenHay deleted the feat/tenant-admin-flag branch July 10, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant