[PR #14042] [MERGED] Dynamically generate profiles from hosts in OpenSSH config files #29895

Open
opened 2026-01-31 09:37:29 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14042
Author: @jonthysell
Created: 9/20/2022
Status: Merged
Merged: 12/9/2022
Merged by: @zadjii-msft

Base: mainHead: dynamicssh


📝 Commits (10+)

  • 3e851a9 Dynamically generate profiles from hosts in OpenSSH config files
  • bc5a6c6 Refactor for more robust config parsing
  • 1bb40d6 Merge branch 'main' into dynamicssh
  • 7ce71d7 Updated profile schema
  • 58680fd Addressing naming feedback
  • 63feb70 Addressing wstring feedback
  • 28b47da add feature flag
  • 917ab35 Merge remote-tracking branch 'origin/main' into dynamicssh
  • f2a0711 spell
  • 7b9c67b Merge branch 'main' into dynamicssh

📊 Changes

7 files changed (+223 additions, -0 deletions)

View changed files

📝 .github/actions/spelling/allow/names.txt (+1 -0)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp (+6 -0)
📝 src/cascadia/TerminalSettingsModel/Microsoft.Terminal.Settings.ModelLib.vcxproj (+2 -0)
📝 src/cascadia/TerminalSettingsModel/Microsoft.Terminal.Settings.ModelLib.vcxproj.filters (+6 -0)
src/cascadia/TerminalSettingsModel/SshHostGenerator.cpp (+161 -0)
src/cascadia/TerminalSettingsModel/SshHostGenerator.h (+40 -0)
📝 src/features.xml (+7 -0)

📄 Description

This PR adds a new dynamic profile generator which creates profiles to
quickly connect to detected SSH hosts.

This PR adds a new SshHostGenerator inbox dynamic profile generator.
When run, it looks for an install of our
Win32-OpenSSH client app
ssh.exe in all of the (official) places it gets installed. If the exe
is found, the generator then looks for and parses both the user and
system OpenSSH config files for valid SSH hosts. Each host is then
converted into a profiles to call ssh.exe and connect to those hosts.

VALIDATION
Installed OpenSSH, configured host for alt.org NetHack server, connected
and played some NetHack from the created profile.

  • When OpenSSH is not installed, don't add profiles
  • Detected when installed via Optional Features (installs in
    System32\OpenSSH, added to PATH)
  • Detected when installed via the 32-Bit OpenSSH MSI from GitHub
    (installs in Program Files (x86)\OpenSSH, not added to PATH)
  • Detected when installed via the 64-Bit OpenSSH MSI from GitHub
    (installs in Program Files\OpenSSH, not added to PATH)
  • Detected when installed via winget install Microsoft.OpenSSH.Beta (uses MSI from GitHub)
  • With "disabledProfileSources": ["Windows.Terminal.SSH"] the
    profiles are not generated

Closes #9031


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/14042 **Author:** [@jonthysell](https://github.com/jonthysell) **Created:** 9/20/2022 **Status:** ✅ Merged **Merged:** 12/9/2022 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `main` ← **Head:** `dynamicssh` --- ### 📝 Commits (10+) - [`3e851a9`](https://github.com/microsoft/terminal/commit/3e851a9095535d6468a94b504ae165493006bada) Dynamically generate profiles from hosts in OpenSSH config files - [`bc5a6c6`](https://github.com/microsoft/terminal/commit/bc5a6c62fefc4b4f01d73aebda1b620b511628ea) Refactor for more robust config parsing - [`1bb40d6`](https://github.com/microsoft/terminal/commit/1bb40d62b9c360cf224d61a0240a235487bb6820) Merge branch 'main' into dynamicssh - [`7ce71d7`](https://github.com/microsoft/terminal/commit/7ce71d7de630b3d8ed64e8ad6fefabd6bfd1208d) Updated profile schema - [`58680fd`](https://github.com/microsoft/terminal/commit/58680fd0039533491e001155613465e753b4ad57) Addressing naming feedback - [`63feb70`](https://github.com/microsoft/terminal/commit/63feb7053e751c07cf090505d433d0ad361917ea) Addressing wstring feedback - [`28b47da`](https://github.com/microsoft/terminal/commit/28b47dab8ac41c2009e6593f8381ee7828a41fbe) add feature flag - [`917ab35`](https://github.com/microsoft/terminal/commit/917ab35a516235043e95dcf7567223ff6b7ba085) Merge remote-tracking branch 'origin/main' into dynamicssh - [`f2a0711`](https://github.com/microsoft/terminal/commit/f2a07114a9b308381ff53e7388f477988d52cbf1) spell - [`7b9c67b`](https://github.com/microsoft/terminal/commit/7b9c67bb26eb3434596bd9a054f5b4fcf64a05a0) Merge branch 'main' into dynamicssh ### 📊 Changes **7 files changed** (+223 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/allow/names.txt` (+1 -0) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp` (+6 -0) 📝 `src/cascadia/TerminalSettingsModel/Microsoft.Terminal.Settings.ModelLib.vcxproj` (+2 -0) 📝 `src/cascadia/TerminalSettingsModel/Microsoft.Terminal.Settings.ModelLib.vcxproj.filters` (+6 -0) ➕ `src/cascadia/TerminalSettingsModel/SshHostGenerator.cpp` (+161 -0) ➕ `src/cascadia/TerminalSettingsModel/SshHostGenerator.h` (+40 -0) 📝 `src/features.xml` (+7 -0) </details> ### 📄 Description This PR adds a new dynamic profile generator which creates profiles to quickly connect to detected SSH hosts. This PR adds a new `SshHostGenerator` inbox dynamic profile generator. When run, it looks for an install of our [Win32-OpenSSH](https://github.com/PowerShell/Win32-OpenSSH) client app `ssh.exe` in all of the (official) places it gets installed. If the exe is found, the generator then looks for and parses both the user and system OpenSSH config files for valid SSH hosts. Each host is then converted into a profiles to call `ssh.exe` and connect to those hosts. VALIDATION Installed OpenSSH, configured host for alt.org NetHack server, connected and played some NetHack from the created profile. * [x] When OpenSSH is not installed, don't add profiles * [x] Detected when installed via Optional Features (installs in `System32\OpenSSH`, added to PATH) * [x] Detected when installed via the 32-Bit OpenSSH MSI from GitHub (installs in `Program Files (x86)\OpenSSH`, not added to PATH) * [x] Detected when installed via the 64-Bit OpenSSH MSI from GitHub (installs in `Program Files\OpenSSH`, not added to PATH) * [x] Detected when installed via `winget install Microsoft.OpenSSH.Beta` (uses MSI from GitHub) * [x] With `"disabledProfileSources": ["Windows.Terminal.SSH"]` the profiles are not generated Closes #9031 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:37:29 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29895