Azure / azure-iot-sdk-java

A Java SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-java/
Other
198 stars 237 forks source link

Add support for device client to use AMQPS_WS with X509 authentication #728

Open timtay-microsoft opened 4 years ago

timtay-microsoft commented 4 years ago

I tested out removing the "iothob-no-client-cert=true" query string from the amqp stack here and it allowed for the connection to succeed sometimes. It's about a 50/50 chance of a successful connection and for a "An existing connection was closed by the remote host" transport exception.

I'm not sure if this is due to some persisted state (not cleaning up the previous connection correctly?), so this needs further investigation. It's worth solving because we want to provide support for AMQPS_WS to use CA signed certs like all the other protocols in this SDK will (after #727 ).

Repro steps are to run the SendEventX509 sample with CA signed certs and AMQPS_WS configured.

timtay-microsoft commented 3 years ago

Closing due to lack of demand. We'll revisit this feature at a later date

pearstar commented 2 years ago

We are using AMQPS with CA signed X509 cert for iothub connections and everything works fine. But recently we are facing customers that only allow certain ports to be opened on their firewalls, so we are exploring AMQPS_WS since it's on 443. As soon as I switched the protocol from AMQPS to AMQPS_WS I got the following exception when trying to connect:

E/AmqpsIotHubConnection: Amqp session closed unexpectedly. Closing this connection...
    com.microsoft.azure.sdk.iot.device.transport.amqps.exceptions.AmqpUnauthorizedAccessException: {"errorCode":401002,"trackingId":"43585caddddb442ca2c22ca1e6f19efe-G:0-TimeStamp:12/07/2021 20:41:41","message":"Unauthorized","timestampUtc":"2021-12-07T20:41:41.7446033Z"}

Comparing Azure portal logs, the authType is null when using AMQPS_WS and when using AMQPS the authType is a proper "x509Certificate". Not sure if it helps or not.

I eventually found this issue page and perhaps this is the answer to my problem. But will it be revisited or fixed? Or any other solutions you may suggest? Thanks.

I also tried MQTT and MQTT_WS and they all work. But we still prefer AMQP protocol.

Xerxekyran commented 1 year ago

Hi everyone, due to this bug: https://github.com/Azure/azure-iot-sdk-java/issues/1648 I would like to use AMQPS_WS with X509, is this feature planned to be implemented soon or is there any planned release shedule?