github darkoperator/Posh-SSH v4.0.0
Posh-SSH 4.0.0

4 hours ago

Posh-SSH 4.0.0 is the first stable release of the v4 line. It moves the module to vanilla SSH.NET, rewrites trusted host management in C#, and keeps v3.2.7 scripts working unchanged, with the exceptions listed under Before you upgrade.

Thanks to everyone who contributed, especially @MVKozlov for the multi-key trusted host work and the SSH.NET 2025 migration.

⚠️ Before you upgrade

  • Back up ~/.poshssh/hosts.json. v4.0 reads a v3 hosts.json as is, but the first time the store is saved it rewrites the file in the new multi-key format, which v3.x cannot read. Keep a copy if you might downgrade.
  • Known host entries are now looked up per port. Connecting on a non-default port looks up host:port, which matches the OpenSSH [host]:port convention. Entries recorded under a bare host name are no longer found for non-standard ports. To fix this, re-accept the key with -AcceptKey or add a [host]:port entry.
  • The registry functions were renamed with no alias. Get-SSHRegistryKnownHost is now Get-SSHRegistryTrustedHostStore, and Convert-SSHRegistryToJsonKnownHost is now Convert-SSHRegistryToJSonTrustedHost.
  • The -Force host key warning text changed. It now names the host (Host key for <computer> is not being verified since the Force switch was used.). Update any script that matches on the old text.

Library

  • Built against vanilla SSH.NET 2025.1.0 from NuGet (up from 2024.0.0). The Cisco-patched Renci.SshNetDev.dll fork is no longer needed and has been removed.
  • New runtime dependency BouncyCastle.Cryptography.dll, shipped in Assembly/.
  • The legacy .NET Framework 4.7.2 project is gone. A single SDK-style project targets netstandard2.0 and runs on Windows PowerShell 5.1 and PowerShell 7.x on Windows, Linux and macOS.

Trusted host store

  • New-SSHTrustedHost, Add-SSHTrustedHost, Get-SSHTrustedHost and Remove-SSHTrustedHost are now C# binary cmdlets (they were PowerShell functions in v3.x).
  • A host can now have more than one host key, to support key rotation and hosts that use several key algorithms.
  • The store cmdlets were renamed from "known host" to "trusted host store": New-SSHMemoryTrustedHostStore, Get-SSHJsonTrustedHostStore and Get-SSHOpenSSHTrustedHostStore. The v3 names still work as aliases.
  • Host keys are now displayed as SHA256 fingerprints by default (was MD5).
  • Security fix: a trusted host entry with a blank key name skipped the fingerprint check, so it accepted any host key for that host. The fingerprint is now always checked.
  • An ssh-rsa entry now matches servers that negotiate rsa-sha2-256/rsa-sha2-512 (#632). This fixes "No matching host key algorithm" against OpenSSH 8.8+ servers.
  • When a host key is rejected, the error now shows the key type and fingerprint the server offered, the fingerprints already on record, and the command to run once you have verified the change.

v3.x script compatibility

Every v3.2.7 command and parameter was compared against this build, and each gap was closed with an alias or a positional parameter:

  • -KnownHost is now an explicit alias of -TrustedHostStore on New-SSHSession, New-SFTPSession, Get-SCPItem and Set-SCPItem.
  • -KnownHostStore and -KnowHostStore work again on the trusted host cmdlets.
  • Get-SSHTrustedHost accepts the store as a positional argument again.
  • The Get-SSHJsonKnowHost alias is back.

New features

  • Get-SSHAlgorithm lists the algorithms the bundled SSH.NET supports. With -ComputerName it also shows what the server offers and what the two have in common. It needs no credentials. Algorithm negotiation errors now point to it.
  • A session can use several authentication methods, for example a password and a key together.
  • New -Encoding parameter on the session and command cmdlets, for correct non-ASCII output.
  • New -Overwrite switch on Get-SCPItem, so you no longer have to disable host key verification with -Force just to overwrite a local file.

Bug fixes

  • #604, #533: command timeouts in Invoke-SSHCommand.
  • #582: Get-SCPItem -PathType File downloads to a .partial file and only replaces the destination once the download succeeds.
  • #633: the overwrite notice on Get-SCPItem is now verbose output instead of a warning.
  • #174: the -Force host key warning now names the host.
  • #381, #496: long-standing edge cases.
  • Get-SFTPItem can download to an absolute Windows path again.
  • Move-SFTPItem can move an item into an existing directory.
  • Remove-SSHTrustedHost no longer asks for confirmation by default, which also fixes a NullReferenceException in non-interactive sessions.
  • Remote file names containing * or : are saved with _ in their place on Windows.

Build and tests

  • Build-Module.ps1 builds, verifies every exported cmdlet, validates the manifest files and packages the module. It fails if the bundled Renci.SshNet.dll doesn't match the version PoshSSH.dll was compiled against (the cause of the 3.2.6/3.2.7 mismatches).
  • The test suite now requires Pester 5 and passes with nothing skipped. There is a new integration suite, plus a Linux VM provisioning script covering 12 authentication setups.

Full details are in CHANGELOG.md.

Package: Posh-SSH-4.0.0.zip, SHA256 61D726C986086C670BBECCDDFB18FD9B6DAE7A8592C9A2840698B71658E1A9D9

Don't miss a new Posh-SSH release

NewReleases is sending notifications on new releases.