-
Notifications
You must be signed in to change notification settings - Fork 13
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
Make IgnoreSSLErrors parameter on New-ISHSession and Test-ISHSession to have local scope #22
Comments
Please elaborate technically how to do this... I seem to remember it is tied to the AppDomain.
-Dave
|
This is not easy to achieve. Having said that a couple of ideas
Pretty much this is what happens inside @Jaykyl implementation |
I feel summoned ... For what it's worth, you're welcome to use my code under your Apache license. If you're adding a parameter on your own command, you can probably handle it the same way my proxy commands for the built-in network commands do: just call However, if I understand how this module's being used, a better solution is probably to just make available a |
I would like to avoid making changes to the operating system. PowerShell is in general a non parallel executing environment. I like your approach @Jaykul because it's build upon this idea. I run into this issue because I needed to run some pester testers against To work around the issue of ISHRemote and actually all other tests that accesses url's like Describe "test" {
BeforeAll {
Enable-SSLOverrideForLocalHost
}
AfterAll {
Disable-SSLOverrideForLocalHost
}
It "Test ISHWS ConnectionConfiguration.xml" {
$uri="https://localhost/$($deployment.WebAppNameWS)/ConnectionConfiguration.xml"
Get-UriStatus -Uri $uri | Should BeExactly 200
}
} To support this flow I wrapped a bit of @Jaykul functionality function Enable-SSLOverrideForLocalHost
{
begin {
if (-not ("Huddled.Net.TunableValidator" -as [type]))
{
Add-Type -Path "$PSScriptRoot\TunableValidator.cs"
}
}
process {
try {
[Huddled.Net.TunableValidator]::SetValidator()
Get-UriStatus -Uri "https://localhost"
}
catch
{
[Huddled.Net.TunableValidator]::ApproveLastRequest()
}
finally
{
}
}
end {
}
}
function Disable-SSLOverrideForLocalHost
{
begin {
}
process {
if ("Huddled.Net.TunableValidator" -as [type])
{
[Huddled.Net.TunableValidator]::TrustedCerts.Clear()
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = $null
}
}
end {
}
}
I could had extracted and/or enhanced the functionality of |
Resolved in #115, so ISHRemote v7+ |
Current if someone executes
New-IshSession -WsBaseUrl $uri -IgnoreSslPolicyErrors
orTest-IshSession -WsBaseUrl $uri -IgnoreSslPolicyErrors
then all certificate validation is ignored for the lifetime of the process.As the parameter is defined on the cmdlet, it's scope should be for the scope of creating the session and using the session by the rest of the cmdlets.
But it should not affect anything else
The text was updated successfully, but these errors were encountered: