Repository navigation
entries: one entry, several protocols - #299
jseifeddine wants to merge 4 commits into
Conversation
|
Thanks Jad, this is solid work and it answers all our questions from #296: credentials falling back protocol → host → folder defaults, We're going to park it for now though, for two reasons:
Two things we found, for when we pick it up:
If you'd like to keep it moving, splitting the access rules into their own PR would make the rest easier to take on its own, and it removes the first issue. |
4e4c37b to
d7a6c85
Compare
A machine reached over more than one protocol needed one entry per protocol, with the hostname, display name and credentials copied between them. An entry can now hold a list of protocols. The entry's own fields are the host's defaults. Each item in `protocols` inherits them and sets only what differs; an empty value clears an inherited one, and `port` is never inherited. The first protocol is the primary. An optional `name` tells two protocols of the same type apart. - Existing flat entries are read as one protocol and connect exactly as before. An entry is stored in the flat form whenever that loses nothing, so older instances keep reading it, and the write API still accepts the flat body, including the NetBox webhook's. - Connecting resolves host and protocol to one flat entry, so folder defaults, credential variables, recording and the rest apply per protocol unchanged. Credentials come from the protocol, then the host, then the folder's defaults for that type. - The connect endpoint and `/api/connect` take an optional `protocol` (a name, or a type), defaulting to the primary. Sessions and recordings record the protocol they used. - Updates keep stored secrets per protocol, matched by name. - Connections: the editor has a Host section and a tab per protocol. The list shows a badge per protocol, the primary first, folding the rest into a +N chip. Connect is a split button whose menu lists every protocol, the primary marked as default. - Docs: entries in api.md, a multi-protocol NetBox webhook in netbox.md, and an upgrade note in migration.md. Refs sol1#296
The Type cell of an entry with several protocols kept to two lines and hid the rest behind a +N chip, so seeing them all took a hover or the Connect menu. It now shows a badge for every protocol, the primary first, and wraps onto as many lines as it needs. Refs sol1#296
An update keeps each protocol's stored secrets by matching names, so a protocol renamed through the API lost its password or key. The editor does not allow renaming, but an API client or script can. A protocol in an update body can now name its old name in `renamed_from`, and its stored secrets move with it to the new name. It is used for that update only and never stored or returned; a malformed one is refused like a malformed name. Refs sol1#296
d7a6c85 to
f6b6f8c
Compare
An ad-hoc connection is one protocol to one host. A body with a `protocols` list failed with "unknown session type", since it has no top-level type; it now says what is wrong. Refs sol1#296
|
Thanks for the review, Dave. I've taken your suggestion and updated the PR (description updated to match). Access rules split out. The entry- and protocol-level Your two findings:
Other changes since your review:
Upgrade order across instances sharing a Vault: with the rules removed, an older instance can't expose anything it shouldn't. It can't read an entry in the new form, so it leaves it out of its lists and refuses an update to it (an edit, or the webhook's Tests: clippy is clean, |
Closes #296.
One connection entry can now offer several protocols for the same machine (RDP, SSH, VNC, SPICE, Proxmox, Web, VDI), instead of one entry per protocol. This follows the model from the discussion on #296: every protocol lives in
protocols, and the host level holds the defaults they inherit. Rebased on v1.13.4.Entry- and protocol-level access rules were split out into draft #320, to be settled with #294.
Data model
{ "hostname": "10.0.0.10", "display_name": "server01.example.com", "username": "Administrator", "protocols": [ { "type": "rdp", "port": 3389 }, { "type": "ssh", "port": 22, "username": "admin" }, { "type": "ssh", "name": "ssh-2222", "port": 2222 }, { "type": "web", "url": "https://10.0.0.10/", "hostname": "" } ] }""or[].portis never inherited, so each protocol gets its own or its type's standard port.protocoluse it.nameis optional, defaulting to the type, and must be unique within the entry. It tells two protocols of the same type apart. Links select a protocol by it, and stored secrets are matched on it. To rename a protocol through the API, send its old name asrenamed_fromand its secrets move with it.hostname, the recording settings and fullscreen can each be set on the host and overridden per protocol.Credentials
Resolved per protocol: the protocol's own, then the host's, then the folder
.defaultsfor that protocol's type, then$credentialvariables. Connecting resolves host and protocol to one flat single-type entry, so the existing connect path (folder defaults, variables, recording, the session request) is reused unchanged.Existing installations
typeand noprotocolsis read as one protocol and connects exactly as before; tests compare the resolved entry field by field with the stored one. Nothing in Vault is rewritten on upgrade.PUT) rather than overwrite it. Creating a new entry with the same name there would replace it.docs/migration.mdsays to upgrade every instance before using multi-protocol entries.PUT ...?move=trueand check that it upserts, moves, keeps stored secrets and connects as before./api/connect?scope&folder&entry) open the primary. Old&protocol=<type>links still work, because a protocol is matched by name and then by type.API
POST .../entries/:entry/connectand/api/connecttake an optionalprotocol.protocols. The existing top-level fields (session_type,port, ...) still describe the primary, so existing clients keep working.renamed_fromfor a rename.POST /api/addressbook/adhoc/connectrefuses aprotocolslist: an ad-hoc connection is one protocol.UI
+Nchip, per the review on Proposal: allow one connection entry to offer multiple protocols (SSH / RDP / VNC / Web) #296). The Type filter matches any protocol.NetBox
docs/netbox.mdkeeps the single-protocol webhook documented and supported. It adds a multi-protocol body template, rendered and checked under Jinja2's sandbox:remote_protocol/remote_portkeep their meaning as the primary protocol and its port;remote_protocols(multiple selection) andremote_ports(JSON, only for non-standard ports) add the rest;&protocol=) can share a Custom Link group, so they show as one Console dropdown.A sync source that drives protocols some other way (for example from device tags) only needs to send the
protocolsarray.Known limits
renamed_from.With #298
#298 is merged, and this is rebased on top of it: the selected protocol goes through its shared
session_request_from_entry()conversion, the ad-hoc endpoint refuses aprotocolslist, and the ad-hoc editor hides the Host section and protocol tabs.Testing
cargo fmt --checkandcargo clippy --all-targets -- -D warnings: clean.cargo test: 453 passed in the main binary, plus 33 in the other suites. The twovault::tests::test_build_client_mtls_*tests fail in my container withUnsupportedCertVersion, the same as on unchanged main.multi-protocol-entries.spec.mjscovers:src/entry_protocols.rsandsrc/api.rscover:renamed_from;