Skip to content

Fix Windows SSH compatibility: ProxyCommand, key ACLs, and ESM require - #70

Open
shaunymca wants to merge 1 commit into
hdresearch:mainfrom
shaunymca:fix/windows-ssh-compat
Open

Fix Windows SSH compatibility: ProxyCommand, key ACLs, and ESM require#70
shaunymca wants to merge 1 commit into
hdresearch:mainfrom
shaunymca:fix/windows-ssh-compat

Conversation

@shaunymca

Copy link
Copy Markdown

Summary

  • vers-client.ts, swarm.ts: remove 2>/dev/null from ProxyCommand — this Unix shell redirect is passed literally to openssl on Windows native ssh.exe (System32), breaking every SSH connection. The -quiet flag already suppresses the relevant stderr output.
  • vers-client.ts, swarm.ts: replace UserKnownHostsFile=/dev/null with a platform-aware value (NUL on Windows, /dev/null elsewhere) — /dev/null works on Windows by accident via an internal OpenSSH mapping but is not guaranteed across all Windows versions.
  • vers-client.ts: after writing the SSH private key file, run icacls on Windows to set correct ACLs — Node's { mode: 0o600 } is silently ignored on Windows NTFS, leaving the key accessible to SYSTEM and Administrators, causing Windows native ssh.exe to refuse it with bad permissions.
  • vers-client.ts: replace require('fs').readFileSync with a proper ESM importrequire() is unavailable in strict ESM and only worked due to Bun's leniency.

Test plan

  • SSH connection to a Vers VM succeeds from Windows PowerShell with Windows native ssh.exe (System32)
  • SSH private key is accepted without bad permissions error on Windows
  • UserKnownHostsFile uses NUL on Windows and /dev/null on Unix
  • No regressions on macOS/Linux

🤖 Generated with Claude Code

- vers-client.ts, swarm.ts: remove 2>/dev/null from ProxyCommand — this
  Unix shell redirect is passed literally to openssl on Windows native
  ssh.exe (System32), breaking every SSH connection. The -quiet flag
  already suppresses the relevant stderr output.
- vers-client.ts, swarm.ts: replace UserKnownHostsFile=/dev/null with
  a platform-aware value (NUL on Windows, /dev/null elsewhere) — /dev/null
  works on Windows by accident via internal OpenSSH mapping but is not
  guaranteed across all Windows versions and distributions.
- vers-client.ts: after writing the SSH private key file, run icacls on
  Windows to set correct ACLs — Node's mode: 0o600 is ignored on Windows
  NTFS, leaving the key accessible to SYSTEM and Administrators, which
  causes Windows native ssh.exe to refuse the key with bad permissions.
- vers-client.ts: replace require('fs').readFileSync with a proper ESM
  import — require() is not available in strict ESM and was only working
  due to Bun's leniency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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