feat: per-tenant admin flag + doctor key-placement invariants#5
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a per-tenant
admin: trueflag totenants.yaml(defaultfalse) 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 orauthorized_keys— key minting/delivery is the deployment layer's job (companion Ansible PR).Changes
internal/config:Tenant.Adminfield, parser case inapplyTenant(parseBool, mirrorsmanage_tunnel),Save()round-trip (admin: trueemitted only when set). Rejects-unknown-key parser unchanged.cmd/vswarm/doctor.go: two real invariants over the well-known pathconfig/<name>/home/.ssh/vswarm-admin(doctor runs as root on the host):vswarm-adminkey file (a stranded key after a flag downgrade FAILs the gate);0600.DEPLOYMENT.mdadmin-SSH section (split-ownership contract,ssh -i ~/.ssh/vswarm-admin ubuntu@<gateway>usage, gateway =172.31.<10+index>.1);tenants.example.yamldocuments the key.adminkey.Verification
gofmt -l .clean,go build ./...,go vet ./...,go test ./...all pass (golang:1.22-bookworm).