Skip to content

Send workshop machine ID with workshopctl requests - #962

Open
tlm wants to merge 4 commits into
mainfrom
workshop-machine-id
Open

Send workshop machine ID with workshopctl requests#962
tlm wants to merge 4 commits into
mainfrom
workshop-machine-id

Conversation

@tlm

@tlm tlm commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

Forward the LXD-provided workshop machine ID from workshopctl to workshopd in the workshop-machine-id HTTP header.

This enables follow-up secrets work: workshopctl and workshopd need a shared workshop identity to communicate and validate the workshop from which a secret request originates. The daemon records the received ID in debug request logs to support diagnosis.

This PR intentionally only transports the identifier. It does not validate the ID or authorise secret access; those checks will be added in follow-up secrets PRs.

Self-review quick check

  • Make decisions that cost a lot to reverse explicit in the PR description.
  • Avoid nested conditions.
  • Delete dead code and redundant comments.
  • Normalise symmetries by sticking to doing identical things identically.
  • Check that coupled code elements, files, and directories are adjacent.
  • Put variable declaration and initialisation together.
  • Divide large expressions into digestible and self-explanatory ones.
  • Put a blank line between two logically different chunks of code.
  • Follow the style guide for new error messages.

Docs

  • I confirm the PR has no implications for documentation.

tlm added 4 commits July 24, 2026 04:19
Read and trim the machine identifier injected into each workshop. Return a sentinel error when the file is missing or empty, and add unit coverage for valid, empty, and missing machine ID files.
Attach the workshop machine ID to outgoing HTTP requests. Warn when the ID is unavailable, and prevent requests when it cannot otherwise be read.
Apply an optional round tripper wrapper after constructing the client transport, and verify wrapped requests reach the server as expected.
Configure workshopctl to decorate its API transport with the workshop machine ID, and include received machine IDs in daemon debug request logs.
@jonathan-conder

Copy link
Copy Markdown
Contributor

just FYI from machine-id(5):

This ID uniquely identifies the host. It should be considered "confidential", and must not be exposed in untrusted environments, in particular on the network. If a stable unique identifier that is tied to the machine is needed for some application, the machine ID or any part of it must not be used directly. Instead the machine ID should be hashed with a cryptographic, keyed hash function, using a fixed, application-specific key. That way the ID will be properly unique, and derived in a constant way from the machine ID but there will be no way to retrieve the original machine ID from the application-specific one. The sd_id128_get_machine_app_specific(3) API provides an implementation of such an algorithm.

I don't think the socket necessarily counts as the "network," but it seems like a good idea regardless.

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.

2 participants