poshbotio / PoshBot

Powershell-based bot framework
MIT License
537 stars 108 forks source link

TLS changes causing MS teams to fail #138

Closed TobyHawkes closed 5 years ago

TobyHawkes commented 5 years ago

Our MS teams poshbot stopped responding to messages recently

Current Behavior

An error is logged in poshbot.log "Error authenticating to Teams" which is caused by Invoke-RestMethod "The underlying connection was closed: An unexpected error occurred on a send." The command it is running is: $members = Invoke-restmethod -uri $uri -headers $headers which is on line 7939 (in version 0.11.3)

Possible Solution

MS have updated their requirements for TLS as noted here: https://blog.botframework.com/2018/11/06/announcement-azure-bot-service-enforcing-transport-layer-security-tls-1-2/ To enforce tls version 1.2 when the module is running invoke-restmethod I added "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12" at the top of poshbot.psm1

Your Environment

devblackops commented 5 years ago

Thanks for reporting this @TobyHawkes! Easy fix to ensure we're using TLS 1.2 with the code you provided.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
TobyHawkes commented 5 years ago

Great, thanks for the quick response