-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add SkipCA and SkipCN check requirement to WinRM/OMI HTTPS connection #8279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SkipCA and SkipCN check requirement to WinRM/OMI HTTPS connection #8279
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use new Pester features:
$exc = { & $scriptBlock } | Should -Throw -ErrorId "..." -PassThru
$exc.Exception.ErrorCode | Should -Be $expectedErrorCodeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sample from the repo
PowerShell/test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1
Lines 270 to 274 in 43e0394
| It 'Empty dynamically generated set throws in C#' { | |
| $exc = { | |
| Get-TestValidateSet5 -Param1 "TestString1" -ErrorAction Stop | |
| } | Should -Throw -ErrorId "ParameterArgumentValidationError,Test.Language.TestValidateSetCommand5" -PassThru | |
| $exc.Exception.InnerException.ErrorRecord.FullyQualifiedErrorId | Should -BeExactly "ValidateSetGeneratedValidValuesListIsNull" |
| <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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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