Azure-iot-sdk-csharp: [Bug Report] HTTP proxy authentication failure

Created on 27 Jul 2020  路  5Comments  路  Source: Azure/azure-iot-sdk-csharp

Original issue: https://github.com/Azure/iotedge/issues/852

Context

  • OS, version, SKU and CPU architecture used: RHEL7 x86_64
  • Application's .NET Target Framework : netstandard2.0
  • Device: UNKNOWN
  • SDK version used:

    • Microsoft.Azure.Devices: 1.22.0

    • Microsoft.Azure.Devices.Client: 1.27.0

Description of the issue

I'm behind a corporate proxy so I configured the edge node as suggested (https://docs.microsoft.com/en-us/azure/iot-edge/how-to-configure-proxy-support). However I doubt that the the proxy_host in format user:password@proxy_host is used correctly everywhere - still it should work as https://docs.microsoft.com/en-us/azure/iot-edge/how-to-configure-proxy-support documents.

/etc/iotedge/config.yaml:

https_proxy: "http://user:password@proxy-server:8080/"
UpstreamProtocol: "AmqpWs"

Logging of the azure IOT Edge container:

[SEE ORIGINAL ISSUE]

If I take a look at the tcpdump I see that the proxy is answering with a "HTTP/1.1 407 Proxy Authentication Required" to the connect request of the edgeAgent container - but the connect from the edgeAgent doesn't provide an authentication header (also it should).

My guess is that the edge correctly detects the proxy credentials (proofed by the logging line "Detected proxy http://[user]:**@[proxy]:8080/") but for whatever reason doesn't use the provided credentials to connect via AmqpWs to the IotHub.

Code sample exhibiting the issue

iotedge delegates IoT hub connection details to the device SDK. This comment provides some background: https://github.com/Azure/iotedge/issues/852#issuecomment-663080655

Console log of the issue

[UNKNOWN]

bug

Most helpful comment

From this comment: https://github.com/Azure/iotedge/issues/852#issuecomment-662233451

I encountered this problem first in February 2019, but then we used a proxy without authentication and everything works fine

Specifically, "Credentials didn't seem to make it to the connect telegram to the proxy (sic)" where the proxy is set up with basic authentication.

All 5 comments

To confirm, you are able to have the requests forwarded via a proxy, if you set up a proxy without authentication?

From this comment: https://github.com/Azure/iotedge/issues/852#issuecomment-662233451

I encountered this problem first in February 2019, but then we used a proxy without authentication and everything works fine

Specifically, "Credentials didn't seem to make it to the connect telegram to the proxy (sic)" where the proxy is set up with basic authentication.

If the issue is that the ModuleClient doesn't respect the proxy settings when sending the HSM request to the edgelet, then can you test this branch out? https://github.com/Azure/azure-iot-sdk-csharp/tree/timtay/hsmProxySupport

In this branch, the module client should pass the proxy settings down into the HSM request, and the HSM request should go through the configured proxy and should include the proxy authentication header.

Closing this issue due to inactivity

@abhipsaMisra, @R25l84IHeXjIxy6HO1QXn0y0Dq9mt8EN, @timtay-microsoft, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey

Was this page helpful?
0 / 5 - 0 ratings