To get PS to use TLS 1.3, you have to upgrade to at least .NET 4.8, verify that it’s enabled in the registry (it isn’t by default), and set it to be used.
Option:
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls13
Only:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls13
Also, I honestly don’t know how much of .NET 4.8 was updated to work with TLS 1.3. Most of that work went into .NET (Core) 6.3 and above.
I have been unable to get SNI level of detail using PS. I use nmap for that purpose.
You might be able to get it by creating an SSL stream object.
Thanks.
Regards,
Michael B. Smith
Managing Consultant
Smith Consulting, LLC
--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ntpowershell...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ntpowershell/CADy1Ce70ZAF5mMuYtysOu921LG6CkEq6nP8Z_K9RRj2Ad1UfuQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntpowershell...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce4SUAtbcvsO1kG-g88Lxskipgbec8tJbxpRYhVkrahZxw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CAAfzEuzwvqHHZqn%3D_uX1Ybwh4iuy2mvyh8BY3t_yFDO7dUz37g%40mail.gmail.com.
What exactly are you wanting to look at in the certificate? There is no reason to save it to disk before you examine it. But you might have to map it, depending on desired attributes.
These are hanging because you aren’t closing them and I think the pool is only 20 sites:
$site1 = [Net.WebRequest]::Create("https://site1.com")
try { $site1.GetResponse() } catch {}
$certsite1 = $site1.ServicePoint.Certificate
$bytessite1 = $certsite1.Export([Security.Cryptography.X509Certificates.X509ContentType]::Cert)
set-content -value $bytessite1 -encoding byte -path "C:\temp\tshark-capture\$(Get-Date -Format "yyyy-MM-dd-HHmm")-site1.cer"
S/b:
$site1 = [Net.WebRequest]::Create("https://site1.com")
try { $response = $site1.GetResponse() } catch {}
if( $response )
{
$certsite1 = $site1.ServicePoint.Certificate
$bytessite1 = $certsite1.Export([Security.Cryptography.X509Certificates.X509ContentType]::Cert)
set-content -value $bytessite1 -encoding byte -path "C:\temp\tshark-capture\$(Get-Date -Format "yyyy-MM-dd-HHmm")-site1.cer"
$response.Close()
}
Thanks.
Regards,
Michael B. Smith
Managing Consultant
Smith Consulting, LLC
From: ntpowe...@googlegroups.com <ntpowe...@googlegroups.com>
On Behalf Of Kurt Buff
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce5wpEux0Yb30BBmNKQynU5GCBuR1vsEX8%2BaYbeSqCRd3Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/6992494d314a413182aa33f01cd45313%40smithcons.com.
$site1.ServicePoint.certificate.Subject will give you the subject name of the cert.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce5BFvoA%3DHBCq2uPMkobGF4Kd5crvOaVCoyEcPGZ4zKO%2BA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/44fbe72f7c244bdfb2d7d5ba88d94f51%40smithcons.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/6992494d314a413182aa33f01cd45313%40smithcons.com.
Overspecification.
All you need is $certsite1.Subject
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce4tHa75nFWs4kGHA6be1rtKrs3KSOvGz96G%2BXbtXTmcaA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/6e4bad6e454b410f99ebb7b3f62c89ea%40smithcons.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/6e4bad6e454b410f99ebb7b3f62c89ea%40smithcons.com.
Now you’ve exceeded me. 😊
But I suspect it’s due to caching.
But an idea. “Clear-Variable x” is equivalent to “$x = $null”. So it doesn’t do anything in .NET, just in the PS host. You might try this instead:
Clear-variable x
Remove-variable x
[GC]::WaitForPendingFinalizers()
[GC]:Collect()
Thanks.
Regards,
Michael B. Smith
Managing Consultant
Smith Consulting, LLC
From: ntpowe...@googlegroups.com <ntpowe...@googlegroups.com>
On Behalf Of Kurt Buff
Sent: Wednesday, March 22, 2023 3:57 PM
To: ntpowe...@googlegroups.com
Subject: Re: [ntpowershell] Testing web pages with POSH
Well nuts. I think I ran into a snag.
It looks like the site has set session Max-Age to 36000 seconds - 10 hours.
PHPSESSID=465eb7d6427f82c22d04e77f11f97b83; expires=Thu, 23-Mar-2023 05:32:03 GMT; Max-Age=36000; path=/; domain=site1.com; secure; HttpOnly; SameSite=Lax
Currently as configured the script is using TLS 1.2, as I noted earlier, but the certificate isn't coming through. Instead, I'm seeing this in Wireshark:
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce4_HwviXOiZH8-Z9DPAJG83vL0hnDPJn%2BRv3fNF9kQp7w%40mail.gmail.com.
Or changing the cache timeouts in the net.webrequest.
Thanks.
Regards,
Michael B. Smith
Managing Consultant
Smith Consulting, LLC
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/e87b39e6c2de4325b6189dc7396db778%40smithcons.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/e87b39e6c2de4325b6189dc7396db778%40smithcons.com.
I haven’t tested this, but since you indicated that opening a new PS window worked, what if you spawned a new PowerShell window from the script to perform each connection test? I’ve spawned additional windows in the past to help run multiple robocopy jobs that I can monitor and I wonder if a similar approach may help here. I recognize it’s not as elegant though.
-Aakash Shah
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce4BpgcV6wdjo8LbJJD54dfzAY3NNXUOUnSumXC5YrGSaA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/SJ0P221MB073708515BF62D85DD4CC709F2879%40SJ0P221MB0737.NAMP221.PROD.OUTLOOK.COM.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/SJ0P221MB073708515BF62D85DD4CC709F2879%40SJ0P221MB0737.NAMP221.PROD.OUTLOOK.COM.