newrelic-dotnet-agent icon indicating copy to clipboard operation
newrelic-dotnet-agent copied to clipboard

Staging: Some integration tests are unable to connect to New Relic after TLS 1.2 upgrade

Open JcolemanNR opened this issue 2 years ago • 1 comments

We are experiencing errors for some integration tests after the organization disabled the TLS 1.0 and 1.1 protocols for the staging collector. This appears to vary between environments as the Integration Tests were entirely successful when run in GHA, but some are failing when run locally by our team.

✔️ Things that are confirmed working

  • GHA CI Runs including HostedWebCore tests (Server 2019)
  • .NET 5/6 Test apps on local developer machines (Win10)
  • .NET Framework 4.6.2 test apps on local developer machines (Win10)
  • Some Integration tests on local developer machines (Win10)

🚫 Thing that are confirmed broken

  • Most (all?) Integration tests that use the HostedWebCore on local developer machines (Win10/Win11)

When the error occurs the following can be seen in the agent logs:

2022-08-30 23:57:46,941 NewRelic  DEBUG: [pid: 7656, tid: 24] Request(e5ac9909-9078-4bb2-a5f1-6f5899cf782d): An error occurred invoking method "preconnect": System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at NewRelic.Agent.Core.DataTransport.HttpCollectorWire.SendRequestPayload(WebRequest request, Byte[] payload)
   at NewRelic.Agent.Core.DataTransport.HttpCollectorWire.SendRequest(WebRequest request, Byte[] requestPayloadData)
   at NewRelic.Agent.Core.DataTransport.HttpCollectorWire.SendData(String method, ConnectionInfo connectionInfo, String serializedData, Guid requestGuid)
   at NewRelic.Agent.Core.DataTransport.ConnectionHandler.SendDataOverWire[T](ICollectorWire wire, String method, Object[] data)
2022-08-30 23:57:46,943 NewRelic  ERROR: [pid: 7656, tid: 24] Unable to connect to the New Relic service at staging-collector.newrelic.com:443 : System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at NewRelic.Agent.Core.DataTransport.HttpCollectorWire.SendRequestPayload(WebRequest request, Byte[] payload)
   at NewRelic.Agent.Core.DataTransport.HttpCollectorWire.SendRequest(WebRequest request, Byte[] requestPayloadData)
   at NewRelic.Agent.Core.DataTransport.HttpCollectorWire.SendData(String method, ConnectionInfo connectionInfo, String serializedData, Guid requestGuid)
   at NewRelic.Agent.Core.DataTransport.ConnectionHandler.SendDataOverWire[T](ICollectorWire wire, String method, Object[] data)
   at NewRelic.Agent.Core.DataTransport.ConnectionHandler.SendNonDataRequest[T](String method, Object[] data)
   at NewRelic.Agent.Core.DataTransport.ConnectionHandler.Connect()

JcolemanNR avatar Aug 31 '22 01:08 JcolemanNR

After testing on two machines, all failures appear to occur when the agent is attached to the Hosted Web Core. Adding the following registry keys resolves this issue:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions"=dword:00000001

JcolemanNR avatar Aug 31 '22 02:08 JcolemanNR

This information has been added to the New Developer Onboarding Guide

JcolemanNR avatar Sep 13 '22 18:09 JcolemanNR

https://issues.newrelic.com/browse/NEWRELIC-3503