FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix key exchange hang for outofproc transports by PaulHigin · Pull Request #11380 · PowerShell/PowerShell · GitHub

Fix key exchange hang for outofproc transports - #11380

Merged
Andrew (anmenaga) merged 6 commits into
PowerShell:masterfrom
PaulHigin:fix-outofproc-transport-key-hang
Dec 18, 2019
Merged

Fix key exchange hang for outofproc transports#11380
Andrew (anmenaga) merged 6 commits into
PowerShell:masterfrom
PaulHigin:fix-outofproc-transport-key-hang

Conversation

Paul Higinbotham (PaulHigin) commented Dec 17, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

PR Summary

This PR fixes the remoting key exchange hang in OutOfProc transport connections, when transferring SecureString objects.
Fixes issue: #259

PR Context

When a SecureString object is transferred over the remoting layer, a key exchange algorithm is lazily run so that the contents of the SecureString can be encrypted. This is not strictly necessary since both WinRM and SSH remoting channels already encrypt data on the wire by default. But the key exchange must remain for compatibility reasons.

The hang occurs when the target sends an encrypted SecureString object to the client for the first time. The client begins a key exchange handshake with the target so that it can handle the object. This works fine for WinRM based remote connections because the client processes session and command protocol messages on different threads. But the OutOfProc based transport implementations process client protocol messages on a single thread, and the lazily initiated key exchange results in a deadlock.

The fix is to update the OutOfProc transport manager base class to detect and process command and session client protocol messages on separate threads.

This is not a low risk change since it affects four remote implementations that are based on the OutOfProc transport: background jobs, PowerShellDirect, named pipes, SSH.

Repro Steps:

$session = New-PSSession -Host localhost
Invoke-Command $session { $ss = ConvertTo-SecureString "Hello" -AsPlainText -Force }
Invoke-Command $session { $ss }

#Result
Hang

#Expected
SecureString object to be returned.

PR Checklist

…essing threads for session and command protocol messages.

Steve Lee (SteveL-MSFT) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

One NIT

Steve Lee (SteveL-MSFT) commented Dec 17, 2019
edited
Loading

Copy link
Copy Markdown
Member

Paul Higinbotham (@PaulHigin) merge upstream/master tp pick up fix for the nulconditional tests

Copy link
Copy Markdown
Member

This will probably fix Azure/azure-functions-powershell-worker#259

Copy link
Copy Markdown
Member

Will this issue be considered for GA? Otherwise, the Azure Function issue won't really be resolved until 7.1, which maybe a year later.

Steve Lee (SteveL-MSFT) added this to the GA-consider milestone Dec 18, 2019
Andrew (anmenaga) merged commit 76a009e into PowerShell:master Dec 18, 2019
Andrew (anmenaga) added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Dec 18, 2019
Paul Higinbotham (PaulHigin) deleted the fix-outofproc-transport-key-hang branch December 18, 2019 22:11

TylerLeonhardt commented Dec 20, 2019
edited
Loading

Copy link
Copy Markdown
Member

I would love for it to make it into GA.

Dongbo Wang (daxian-dbw) added this to the 7.0.0-rc.2 milestone Jan 11, 2020

Copy link
Copy Markdown

Hello, just trying to understand, i see GA-approved for this PR, does it mean it will also solve for the Azure Functions issue ? (Azure/azure-functions-powershell-worker#259)

Copy link
Copy Markdown
Member

Yes, this will address that issue, as soon as the Azure Functions team adopts PowerShell 7 in their runtime.

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

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL