Handshake failure 40 on incoming traffic from telegram to my server - telegram

My telegram Bot doesn't receive updates anymore, Because of the last api update Which only works with tls 1.2 .
I tried with wireshark listening to check , I found that the outgoing requests are sent over tls1.2 successfully But the INCOMING ONES (updates,commands sent to my bot) fail due to HANDSHAKE FAILURE.
Transport Layer Security
TLSv1.2 Record Layer: Alert (Level: Fatal, Description: Handshake Failure)
Content Type: Alert (21)
Version: TLS 1.2 (0x0303)
Length: 2
Alert Message
Level: Fatal (2)
Description: Handshake Failure (40)
Knowing that i tried :
Enabling Tls 1.2 using Internet Options
Added client and Server Keys to SChanel entry in registry
(DisabledByDefault = 0 ; Enabled = 1)
Installed This Update kb3140245
Installed all the important updates on my windows server 2012
What should i do to solve this issue ?
Thanks for your time.

Note: This is an edited repost of my original answer, as it was deleted for being low-quality.
The issue is that in the TLS1.2 set of cipher suites, the Telegram API only accepts a limited set. Of those only TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (0x9e) and TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (0x9f) are supported on Windows 2012. A secure channel for SSL / TLS could not be created on create new TelegramBotClient
However Microsoft has disabled their implementations of those ciphers on Windows 2012 already in 2014 as part of a remote code execution patch: MS14-066: Vulnerability in SChannel could allow remote code execution: November 11, 2014
They are considered unsafe ciphers by among others Qualys SSL Labs and NARTAC.
Note that the Telegram API supports many other, more secure ciphers even TLS 1.3, but none of those are supported by any version of Windows 2012. TLS 1.3 is not supported by any Windows version at the time of writing.
In summary, this explains why the problem occurs. The bad news is that there is no good solution on Windows Server 2012. The oldest Windows Server version that supports Telegram bots currently is Windows Server 2016. I'm moving my bot to a Ubuntu 19.10 server.

Related

Asp.net application TLS, RC4 cipher error

I have deployed a web application on IIS 10 and it was running till yesterday but now it is giving error with IE as.
Turn on TLS 1.0, TLS 1.1, and TLS 1.2 in Advanced settings and try connecting to again. If this error persists, it is possible that this site uses an unsupported protocol or cipher suite such as RC4 (link for the details), which is not considered secure. Please contact your site administrator
Please suggest any solution.

Can I use TLS1.2 with an MLLP adapter?

I'm being asked to send HL7 messages to an Azure-hosted system using MLLP/TCP with a TLS1.2 connection and client certificate for validation.
Is there a way of making BizTalk use TLS 1.2 with the MLLP adapter on a send port? I can't get it to send anything other than plan text. Or is a VPN the only solution here?
I have BizTalk 2016 CU9 installed and .Net 4.6.2
BizTalk MLLP adapter does not support TLS. One option which is not ideal is to setup a secured VPN tunnel.
It shouldn’t be hard to add this to adapter though by BizTalk product team.
There are several options to make BizTalk send ports use TLS 1.2
Add a WCF Endpoint Behaviour that set the TLS in code, but the MLLP probably doesn't have this option.
Make the .Net Layer use TLS 1.2, and that is through some registry key changes. Note: That this will make all connections use TLS 1.2 in preferences. There is also the option of disabling all the older TLS version and Ciphers, but that would require testing all interfaces. With earlier version of BizTalk that also required upgrading .Net and installing a later version of the SQL Client, but BizTalk 2016 should be fine. Again, not something you can to with MLLP as it doesn't support TLS at all.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=00000001
How to transmit data securely using MLLP adapter (MSDN Forum), which talks about a VPN tunnel or IPSEC to secure the channel for MLLP
See
Support for TLS 1.2 protocol in BizTalk Server (Microsoft)
Configure TLS 1.2 On BizTalk Server (Article)
BizTalk 2016 FP 3 CU6 and TLS 1.2 not working (StackOverflow)

Debugging Blazor Webassembly with gRPC Server as Hosting

I have a Blazor WASM Application that shall be hosted inside the Backend that is implemented using gRPC on ASP.NET with .NET 5.0. When I try to debug the WASM application and as soon as the debugging Browser starts I get this error:
fail: Microsoft.AspNetCore.Server.Kestrel[0]
HTTP/2 over TLS was not negotiated on an HTTP/2-only endpoint.
All development certificates are installed and trusted and the websocket connection is established using wss:// scheme. So from my point of view the TLS negotiation should succeed.
I already found out that I can workaround that to a certain point by changing the Kestrel endpoint settings to use Http1AndHttp2 the problem then becomes that the gRPC connection from the frontend to the backend fails because of the downgrade to Http/1.
So my question is: Is there any option to debug Blazot WASM when using an Http/2 server on the hosting site?
If this is not possible: Can I determine somehow that the gRPC endpoints get delivered using HTTP/2 and the debugging endpoints via HTTP/1.1?
Here are some tips for checking TLS negotiation limitation on Http/2:
TLS version 1.2 or later
Renegotiation disabled
Compression disabled
Minimum ephemeral key exchange sizes:
Elliptic curve Diffie-Hellman (ECDHE) [RFC4492]: 224 bits minimum
Finite field Diffie-Hellman (DHE) [TLS12]: 2048 bits minimum
Cipher suite not prohibited.
So the solution is quitq simple: I used the wrong package. When using Blazor with gRPC the Grpc.Client.Net.Web package must be used (as stated in this article: https://learn.microsoft.com/en-us/aspnet/core/grpc/browser?view=aspnetcore-6.0#configure-grpc-web-with-the-net-grpc-client).
Then you do not have to use HTTP/2 and everything works like a charm.

Connection fail in end user browser after disable weak ciphers and lower tls version in windows server

First I disable the following things in windows server 2016.
Triple DES cipher
RC4 cipher
TLS CBC Mode ciphers
TLS 1.0
TLS 1.1
Then, I reboot the server.
Finally, I call the web application which is hosted at above server from my client browser.
Here is the problem I can not connect to that web application via browser
What am I missing something?
What should I do to be able to use from end users?
Thank you.
Just turn off the windows server firewall to be able to connection from client site.
It works for me. It's not affected due to disability of above ciphers and tls.

Unable to connect to BizTalk group after enabling TLS 1.2 and disabling lower versions of SSL and TLS

After diabling lower security protocol versions SSL3.0, TLS1.0, TLS1.1 and enabling TLS 1.2, I am not able to connect to BizTalk group or use BizTalk server. The BizTalk server version I am using is 2013R2. Following is the error:
An attempt to connect to "BizTalkMgmtDb" SQL Server database on server "XXXXXX" failed.
Internal Error from OLEDB provider: "[DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error."
Also when I enable TLS 1.2 without disabling the lower versions I don't see any problems and everything seems working fine
Please suggest what can be done to make the server compatible while disabling lower versions
You need to install CU 8 and and also the prerequisite SQL Server 2012 Native Client version 11 as per Support for TLS 1.2 protocol in BizTalk Server
See also BizTalk: Configure TLS 1.2 on BizTalk Server
For BizTalk 2013 R2 we also installed .Net 4.6 and updated the BAM connection strings to use the SQL Server Native Client 11.
You will also have to ensure that any other endpoints that BizTalk communicates with or that communicates with BizTalk is capable of TLS 1.2, for anything using either HTTPS, FTPS or SQL.
So any SQL server you connect to also need to have SQL Server 2012 Native Client version 11 or above, and .NET 4.5 or greater.
Are you added this key on regedit?
Going to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319
then Add--> New DWORD --> SchUseStrongCrypto with value 1
Needing to do same operation on HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319

Resources