feat: Windows + WSL support for SSH-over-TLS#61
Open
shaunymca wants to merge 2 commits intohdresearch:mainfrom
Open
feat: Windows + WSL support for SSH-over-TLS#61shaunymca wants to merge 2 commits intohdresearch:mainfrom
shaunymca wants to merge 2 commits intohdresearch:mainfrom
Conversation
Add platform detection with a Node.js-native fallback for Windows, where openssl s_client ProxyCommand and SSH ControlMaster (Unix sockets) fail. New file: extensions/vers-ssh-utils.ts - IS_WINDOWS constant (platform() === 'win32') - ensureWinProxy(vmId): local TCP->TLS proxy per VM using node:tls/node:net - platformSSHArgs(vmId): returns platform-appropriate SSH connection args Modified: vers-vm.ts, vers-lieutenant.ts, vers-swarm.ts, vers-vm-copy.ts - Import shared utils, replace hardcoded ProxyCommand with platformSSHArgs() - Guard ControlMaster/ControlPath behind !IS_WINDOWS checks - Make sshArgs() async where needed to support the async proxy setup Design: - Zero changes to Linux/macOS behavior (all behind IS_WINDOWS guards) - No new dependencies (uses Node built-in tls and net modules) - rejectUnauthorized:false matches openssl s_client -quiet behavior (TLS is transport only; SSH key auth provides actual security)
On WSL, os.tmpdir() returns a Windows filesystem path (e.g. /mnt/c/Users/.../Temp) where POSIX permission bits are ignored — every file appears as 0777. SSH refuses to use a private key that is world-readable, causing authentication failures. Detect WSL (Linux + tmpdir starts with /mnt/) and write SSH keys to /tmp instead, where chmod 0600 works correctly.
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.
Summary
Adds Windows and WSL support to all Vers SSH extensions. Zero changes to Linux/macOS behavior.
Problem
On Windows:
On WSL:
3. returns a Windows filesystem path (e.g. ) where POSIX permission bits are ignored — every file is 0777. SSH refuses world-readable private keys.
Solution
**Commit 1: **
New file:
Modified: , , ,
**Commit 2: **
Design decisions
Testing
Tested on Windows 11 (native) and WSL2 with pi-v VM operations (create, SSH, copy, lieutenant, swarm).