aws / aws-iot-device-sdk-embedded-C

SDK for connecting to AWS IoT from a device using embedded C.
MIT License
980 stars 632 forks source link

Local device cannot connect to Greengrass Core #1863

Closed zhangzz0413 closed 11 months ago

zhangzz0413 commented 1 year ago

Running the greengrade local auth demo cannot connect to the greengrade core. The logs of the greengrass core are continuously printed in a loop: 2023-04-20T11:43:38.636Z [INFO] (nioEventLoopGroup-7-23) io.moquette.broker.metrics.MQTTMessageLogger: Channel Inactive. {} 2023-04-20T11:43:41.511Z [INFO] (nioEventLoopGroup-7-24) io.moquette.broker.MoquetteIdleTimeoutHandler: Firing channel inactive event. MqttClientId = null.. {}

The SDK demo keeps printing error:

[ERROR] [Transport_OpenSSL_Sockets] [opensslposix.c:302] SSL connect failed to perform TLS handshake. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:721] Failed to establish a TLS connection. [ERROR] [DEMO] [greengrass_demo_local_auth.c:370] Connection to the broker failed, all attempts exhausted. [ERROR] [DEMO] [greengrass_demo_local_auth.c:906] Failed to connect to MQTT broker 10.0.78.18.

My steps are as follows:

  1. Created a thing on the IoTCore and download the certificate and private key: Device_Certificate.crt, Device.key.
  2. Set up core devices and deploy components on them: aws.greengrass.clientdevices.Auth aws.greengrass.clientdevices.mqtt.Moquette aws.greengrass.clientdevices.mqtt.Bridge aws.greengrass.clientdevices.IPDetector
  3. Configure cloud discovery and used greengrass_auth_conf.json to set auth component, and set the correct 'certificateAuthority'.
  4. Create the costomerCA on greengrass core: openssl genrsa -out ca.key 2048 openssl req -x509 -new -nodes -key ca.key -sha256 -days 1826 -out ca.crt
  5. Running demo: cmake -S . -Bbuild -DGREENGRASS_ADDRESS="10.0.78.18" \ -DROOT_CA_CERT_PATH="/home/zzz/cert/ca.crt" \ -DCLIENT_CERT_PATH="/home/zzz/cert/Device_Certificate.crt" \ -DCLIENT_PRIVATE_KEY_PATH="/home/zzz/cert/Device.key" \ -DTHING_NAME="test_gg_sub_thing" cmake -S . -Bbuild && cd build && make greengrass_demo_local_auth
archigup commented 1 year ago

Hi, we are looking into this issue. Thanks for your patience.

dachalco commented 1 year ago

Hi @zhangzz0413

Just posting update. I'll be looking into the issue, but need some time to get and set up a personal green grass core.

zhangzz0413 commented 1 year ago

Hi @dachalco

What is the status of this issue? Are there any updates?

rawalexe commented 1 year ago

Hello @zhangzz0413, Apologies for the delayed response, unfortunately dave is no longer able to work on the ticket. I'll be taking over this ticket and will provide updates as soon as possible.

rawalexe commented 1 year ago

Hello @zhangzz0413, I'm trying to reproduce your problem locally. Just to make sure do you have a greengrass nucleus running at a different terminal?

rawalexe commented 11 months ago

As there was no response I am closing out the issue, please feel free to open again if the problem is not resloved