Mono.Security.Protocol.Tls.TlsException: buffer underrun

时间:2015-07-28 23:56:55

标签: c# asp.net soap mono mod-mono

I have a very strange problem.

We implemented a Soap API to talk to a third party. The API sort of works. There is an select --just added to make the example runnable SUM(CONVERT(DECIMAL(8,2),[can]/1.2)) + SUM(CONVERT(DECIMAL(8,2),[carton]/1.2)) AS [N], CONVERT(DECIMAL(8,2), --add this line (SUM(CONVERT(DECIMAL(8,2),[can]/1.2)) + SUM(CONVERT(DECIMAL(8,2),[carton]/1.2)))*0.2 ) --and an additional close bracket AS [V] from (select 1.0 [can], 1.0 [carton] union all select 2.0, 3.0) x --just added to make the example runnable method which checks if the third party service is alive.

Our application is hosted on an IsAlive server under Ubuntu 14.04 with Apache (Mod-Mono).

We call this API when we load a particular page. It works up to a point then we get an error. I.E. You can make a request to the Mono xxx (It's random) amount of times and it works, then next time you try and do it the following exception gets thrown:

IsAlive

The API at this point does not work anymore. Even if we refresh the page and make another call. We try to re-request 2-3 times then we get another error.

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Net.WebException: Error writing headers ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: buffer underrun


  at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] in <filename unknown>:0
  at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) [0x00000] in <filename unknown>:0
  at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0  ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: buffer underrun
  at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] in <filename unknown>:0
  at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) [0x00000] in <filename unknown>:0
  at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Net.WebConnection.EndWrite (System.Net.HttpWebRequest request, Boolean throwOnError, IAsyncResult result) [0x00000] in <filename unknown>:0
  at System.Net.WebConnectionStream+<SetHeadersAsync>c__AnonStorey1.<>m__0 (IAsyncResult r) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
  at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Web.UI.Page.ProcessException (System.Exception e) [0x00000] in <filename unknown>:0
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
  at ASP.somepage_aspx.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0

Mono.Security.Protocol.Tls.TlsException: buffer underrun
  at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] in <filename unknown>:0
  at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0

The only way to make the API work again is if we restart the Ubuntu Server.

Here is a snippet of how we send the request.

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Net.WebException: The request timed out
  at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Web.UI.Page.ProcessException (System.Exception e) [0x00000] in <filename unknown>:0
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
  at ASP.somepage_aspx.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0

System.Net.WebException: The request timed out
  at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0

Does anyone know what is wrong here? Is there a problem with my implementation or is this a Mono framework issue?

I have tried the instructions on this page: http://www.mono-project.com/docs/faq/security/ but no success. When I run thetest, it passes the first and sometimes the second time but fails after that.

1 个答案:

答案 0 :(得分:0)

原来我们的第三方存在证书问题。他们更新了证书,我们将它们添加到我们的商店,并且有效。

我们的API SSL证书容易受到LogJam攻击。证书的加密导致我们的服务器出现问题。

link帮助我们测试并发现了问题。