Add SkipCA and SkipCN check requirement to WinRM/OMI HTTPS connection#8279
Add SkipCA and SkipCN check requirement to WinRM/OMI HTTPS connection#8279adityapatwardhan merged 12 commits intoPowerShell:masterfrom PaulHigin:Unix_SkipCA_Fix
Conversation
src/System.Management.Automation/resources/RemotingErrorIdStrings.resx
Outdated
Show resolved
Hide resolved
|
@PaulHigin Please resolve merge conflict. Also, enable tests here for non-windows: https://github.com/PowerShell/PowerShell/blob/master/test/powershell/engine/Remoting/SessionOption.Tests.ps1 |
adityapatwardhan
left a comment
There was a problem hiding this comment.
Please enable SessionOption tests.
|
SessionOption.Tests.ps1 contains tests for WSMan SessionOption object, which we do not expose for non-Windows platforms. But I'll add tests for New-PSSessionOption. |
|
PowerShell Committee for the breaking change? |
|
Adding the committee to review the breaking change |
| throw "No Exception!" | ||
| } | ||
| catch { | ||
| $_.Exception.ErrorCode | Should -Be $expectedErrorCode |
There was a problem hiding this comment.
We can use new Pester features:
$exc = { & $scriptBlock } | Should -Throw -ErrorId "..." -PassThru
$exc.Exception.ErrorCode | Should -Be $expectedErrorCodeThere was a problem hiding this comment.
I like this pattern, however the ErrorId is not being checked. At least in my current version of Pester (4.4.2).
There was a problem hiding this comment.
Sample from the repo
| <value>Host system does not have the correct version of Hyper-V schema.</value> | ||
| </data> | ||
| <data name="UnixOnlyHttpsWithoutSkipCACheckNotSupported" xml:space="preserve"> | ||
| <value>HTTPS on Unix does not currently support CA or CN checks. Use the PSSessionOption -SkipCACheck and -SkipCNCheck if you are certain of the server you are connecting to.</value> |
There was a problem hiding this comment.
| <value>HTTPS on Unix does not currently support CA or CN checks. Use the PSSessionOption -SkipCACheck and -SkipCNCheck if you are certain of the server you are connecting to.</value> | |
| <value>HTTPS on Unix does not currently support CA or CN checks. Use the PSSessionOption -SkipCACheck and -SkipCNCheck if you are certain you trust the server you are connecting to and the network in between.</value> |
TravisEz13
left a comment
There was a problem hiding this comment.
One comment about the message
|
I thought |
|
@PowerShell/powershell-committee I did not realize this was marked for committee review. If this does not pass review, I will revert. |
|
@PowerShell/powershell-committee Also, consider if this should be back-ported to 6.1 and 6.0? |
PR Summary
OMI does not support server certificate validation, so this change is to add a requirement that -SkipCACheck and -SkipCNCheck options are specified before a connection is allowed. This way users will be aware that no server certificate validation is performed.
This only applies to PSCore6 remoting clients on non-Windows platforms, when creating a remote session to a Windows machine via WinRM\OMI.
This is a breaking change because these skip check options are now required. If the skip check options are not included then the connection will be denied.
Examples:
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests