AntoineGS/TeamsStatusV2

Could not create SSL/TLS secure channel

1kohm opened this issue · 1 comments

1kohm commented

Hi,

I'm not able to start the Get-TeamsStatus.ps1 script.

I did add TSHATOKEN and TSHAURL as system variable in Windows 10
TSHAURL: https://myha.domain.com
TSHATOKEN: eyJhbGc..... (long token)
I can access my ma from outside via other API

that's the output of the script:

Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure channel.
At C:\Users\test\source\TeamsStatusV2-main\TSFunctions.ps1:21 char:5
+     Invoke-RestMethod -Uri "$HAUrl/api/states/$entityId" -Method POST ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc 
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
 
Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure channel.
At C:\Users\test\source\TeamsStatusV2-main\TSFunctions.ps1:21 char:5
+     Invoke-RestMethod -Uri "$HAUrl/api/states/$entityId" -Method POST ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc 
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
 

How to resolve that issue?

Thanks

After some googling I found this: link.
Can you try editing the TSFunctions.ps1 file and adding:
[Net.ServicePointManager]::SecurityProtocol = "Tls12, Tls11, Tls, Ssl3"
Before:
Invoke-RestMethod -Uri "$HAUrl/api/states/$entityId" -Method POST -Headers $headers -Body ([System.Text.Encoding]::UTF8.GetBytes($params)) -ContentType "application/json"

To see if it fixes it?
I do not currently use https on my HA installation.