Steps to reproduce
- Set up PowerShell SSH remoting as both client and host on a Windows or Linux machine
- Establish that remoting is working back to the same machine
Enter-PSSession -hostname LocalComputerName -userName User
- Delete and recreate the host keys
On Windows go to where Win32-OpenSSH is installed and delete all "ssh_host_key*" files
Then create new files by running ssh-keygen.exe -A
- Try to create a new remote session
Enter-PSSession -hostname LocalComputerName -userName User
Expected behavior
Get complete SSH host key revocation error message
The entire SSH error message should be
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:Etb4yw1QyVJnP4eGKdvOG/xPy9F5rKEw+Xk02wXmJGU.
Please contact your system administrator.
Add correct host key in C:\\Users\\UserName/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\UserName/.ssh/known_hosts:1
ECDSA host key for LocalComputerName has changed and you have requested strict checking.
Host key verification failed.
Actual behavior
Enter-PSSession : [paulhig-3] The background process reported an error with the following message: The SSH client session has
ended with error message: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
At line:1 char:6
+ $s = nsn -HostName paulhig-3 -UserName redmond\paulhi
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
gTransportException
+ FullyQualifiedErrorId : 2100,PSSessionOpenFailed
The PowerShell error only contains the first part of the SSH error message and is not very useful.
Environment data
Name Value
---- -----
WSManStackVersion 3.0
PSEdition Core
SerializationVersion 1.1.0.1
BuildVersion 3.0.0.0
PSVersion 6.0.0-alpha
PSRemotingProtocolVersion 2.3
CLRVersion
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
GitCommitId v6.0.0-alpha.17-67-g42f2e3ca820d7fd7f9dd57f2bbb90e5da2ab2de0
Steps to reproduce
Enter-PSSession -hostname LocalComputerName -userName User
On Windows go to where Win32-OpenSSH is installed and delete all "ssh_host_key*" files
Then create new files by running ssh-keygen.exe -A
Enter-PSSession -hostname LocalComputerName -userName User
Expected behavior
Get complete SSH host key revocation error message
The entire SSH error message should be
Actual behavior
The PowerShell error only contains the first part of the SSH error message and is not very useful.
Environment data