-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MQTT connection to AWS IoT with Rpi0 #566
Comments
@MAkcanca - You're not alone. MQTT to AWS IoT is surprisingly hard to debug. It's not really the MQTT part, but getting the SSL part right. My company has been working with @gausby to try to make this easier by adding a library around Tortoise called Jackalope. See https://github.com/smartrent/jackalope. Unfortunately, the most important code snippet for you was dropped from the repo. I added smartrent/jackalope#28 to see if someone could post it back. I'll check back during the week if no one responds. |
FWIW, first time communication with AWS MQTT typically requires that your signer CA cert be in with the So for your options, you'd need something like: ...
cacerts: [your_signer_ca_der | :certifi.cacerts()],
certfile: "/srv/erlang/lib/network_led-0.1.0/priv/testdev01.cert",
keyfile: "/srv/erlang/lib/network_led-0.1.0/priv/testdev01.private.key",
... where This is typically just needed for initial connect. If that doesn't fix things, there is probably something with the AWS setup that needs to be handled there |
I will try this one out and update here. Thank you for the insight! |
singer_cert_path
|> File.read!()
|> X509.Certificate.from_pem!()
|> X509.Certificate.to_der() This should prob do it for you |
What is the correct way to read in the cert file as der?
|
I added in the AmazonRootCA1 since I used their One Click Certificate to generate certs, but it still hangs. Edit: If I remove the customize_hostname_check line, it hangs, otherwise it fails hostname_check |
Environment
Current behavior
I'm trying to create an example project with AWS IoT Core, and it's supposed to just connect to the MQTT server and send hello world message, using the tortoise library. I even did a code search on whole github but couldn't find a proper working example. I believe AWS IoT and Nerves could have a happy marriage but it's really hard to bring them together (at least for me).
I wrote a simple connection function using the resources(error questions) I found from here and there. This code hangs, probably due to SSL keychain, depth, hostname_check, sni or other mambo jambo. I tried certifi.cacerts, certifi.cacertsfile etc but had no success. Is it really that hard to just send a Hello World message to an AWS IoT MQTT server using Nerves?
Expected behavior
It should publish the MQTT message with proper settings. An example implementation could help a lot.
I also raised this issue on Tortoise library. gausby/tortoise#127
Thanks a lot.
The text was updated successfully, but these errors were encountered: