Skip to content

(GH-1495) Experimental SSH subsystem for DSC - #1810

Draft
Gijs Reijn (Gijsreyn) wants to merge 1 commit into
PowerShell:mainfrom
Gijsreyn:gh-1495/main/dsc-ssh-subsystem
Draft

Gijs Reijn (Gijsreyn) wants to merge 1 commit into
PowerShell:mainfrom
Gijsreyn:gh-1495/main/dsc-ssh-subsystem

Conversation

@Gijsreyn

Copy link
Copy Markdown
Collaborator

PR Summary

This change:

  • Adds the --target ssh://[user@]host[:port] option to run dsc config get, set, test and export on another machine.
  • Adds a ssh_subsystem.dsc.yaml configuration that registers dsc server as the dsc SSH subsystem on the target.
  • Makes the MCP server report itself as dsc with its version, and adds the equivalent CLI exit code to invoke_dsc_config errors.
  • Adds Pester tests for the remote path and extends the server tests.
  • Implements the experimental part of the RFC in RFC Draft of SSH subsystem #1803. Relates to DSC as a SSH subsystem #1495.

PR Context

#1495 asks for a way to apply a configuration to a machine without copying files to it or wrapping dsc in a remote shell command. The target already has what's needed: dsc server speaks MCP over standard input and output, and sshd can start it as a subsystem.

With --target, dsc reads the document and parameters on the client, starts the system ssh client with the dsc subsystem, calls the invoke_dsc_config tool once, and prints the result as a local run does. Nothing has to exist on the target except dsc and the subsystem entry.

Remarks on the design

  • Uses the system ssh client. Authentication, host keys, jump hosts and ~/.ssh/config aliases work as they do for ssh. DSC handles no credentials. A password in the URI is rejected, and port and user are left to ssh when the URI has none.
  • Rejected before connecting. Any command other than the four config operations, --system-root, and a target that isn't a plain ssh:// URI fail as invalid arguments, so an unsupported combination never opens a connection.
  • Server version check. The client refuses a server that doesn't identify itself as dsc 3.4.0-preview.3 or newer. Older servers ignore arguments they don't know, so --what-if would apply changes for real.
  • Same exit codes as a local run. The server puts the CLI exit code in the error data and the client returns it. A connection or handshake failure returns the new exit code 11, with what ssh wrote on standard error.
  • Remote traces. The subsystem runs with --trace-format json. The client emits those traces through its own tracing settings, prefixed with the host.
  • Include resolves on the target. A document that uses Microsoft.DSC/Include gets a warning that file paths are resolved on the target, not on the client.
  • Size limits. A request over 16 MB is refused on the client, because the server drops it without answering.
  • DSC_SSH_EXECUTABLE. Replaces the ssh found on PATH. The tests use it to run against a stand-in client.
  • Out of scope. Other transports, dsc resource commands, multiple targets in one run, and reference docs and a changelog entry, which wait on the RFC.

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