philipparndt / mqtt-analyzer

Apache License 2.0
97 stars 6 forks source link

Connecting to AWS IoT / MQTT issue #44

Closed AndreCouture closed 4 years ago

AndreCouture commented 4 years ago

Hello,

I've tried, without success, to connect to AWS IoT. I enter my endpoint "xxxxxxx-ats.iot.us-east-1.amazonaws.com" then created a .p12 certificate by first combining the rootCA + certificate + private and then use the openssl command to convert the combined file into user.p12

Uploaded the file to the app via Finder

When I try to connect it timeout after 10 trials.

philipparndt commented 4 years ago

Hi there,

in my test setup I've created the .p12 file by using: openssl pkcs12 -export -in user.crt -inkey user.key -out user.p12

The listener configuration is:

# Secured Listener
listener 8883
cafile /mosquitto/config/ca.crt
keyfile /mosquitto/config/server.key
certfile /mosquitto/config/server.crt
require_certificate true
use_identity_as_username true
allow_anonymous false

I've tried some different configuration mistakes but always get an error message so I guess I do not have found exactly your configuration. Can you give me some demo configuration I can start with docker?

AndreCouture commented 4 years ago

Actually my issue was the port number which supposed to be 8883

— Regards,

Andre Couture Senior Cloud Solution Architect

andre.couture@me.com https://www.linkedin.com/in/andrecouture

On May 1, 2020, at 13:39, Philipp Arndt notifications@github.com wrote:

 Hi there,

in my test setup I've created the .p12 file by using: openssl pkcs12 -export -in user.crt -inkey user.key -out user.p12

The listener configuration is:

Secured Listener

listener 8883 cafile /mosquitto/config/ca.crt keyfile /mosquitto/config/server.key certfile /mosquitto/config/server.crt require_certificate true use_identity_as_username true allow_anonymous false I've tried some different configuration mistakes but always get an error message so I guess I do not have found exactly your configuration. Can you give me some demo configuration I can start with docker?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

philipparndt commented 4 years ago

@AndreCouture what port number are you trying to use? I was now able to reproduce this but not with a different port number (tried 8882 an it still worked) but by switching to Moscapsule in More settings.

Do you still have your old setting, so that you can check whether CocoaMQTT or Moscapsule is selected?

AndreCouture commented 4 years ago

The old and default port in the app is 1883 while aws seem to be using 8883 As soon as I changed the port to 8883 it connected to AWS IoT MQTT

— Regards,

Andre Couture Senior Cloud Solution Architect

andre.couture@me.com https://www.linkedin.com/in/andrecouture

On May 2, 2020, at 09:00, Philipp Arndt notifications@github.com wrote:

 @AndreCouture what port number are you trying to use? I was now able to reproduce this but not with a different port number (tried 8882 an it still worked) but by switching to Moscapsule in More settings.

Do you still have your old setting, so that you can check whether CocoaMQTT or Moscapsule is selected?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

AndreCouture commented 4 years ago

I just checked and still using default CocoaMQTT Switching to anything else did not work as I just tried.

Only combinaison is CocoaMQTT:8883

— Regards,

Andre Couture Senior Cloud Solution Architect

andre.couture@me.com https://www.linkedin.com/in/andrecouture

On May 2, 2020, at 09:14, Andre Couture andre.couture@me.com wrote:

The old and default port in the app is 1883 while aws seem to be using 8883 As soon as I changed the port to 8883 it connected to AWS IoT MQTT

— Regards,

Andre Couture Senior Cloud Solution Architect

andre.couture@me.com https://www.linkedin.com/in/andrecouture

On May 2, 2020, at 09:00, Philipp Arndt notifications@github.com wrote:

 @AndreCouture what port number are you trying to use? I was now able to reproduce this but not with a different port number (tried 8882 an it still worked) but by switching to Moscapsule in More settings.

Do you still have your old setting, so that you can check whether CocoaMQTT or Moscapsule is selected?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

philipparndt commented 4 years ago

Hi @AndreCouture thanks for letting me know. I've expected Moscapsule not to work with this. This will get be deprecated soon CocoaMQTT supports better error handling and better SSL support.

I've created a AWS IoT instance today to test this and now I see why you struggled with the port setting. It is was pretty unclear to me on the AWS page what settings they expect.

I think a good solution for this would be to add some kind of preset template for AWS in order to assist during creation of this setting or maybe initialize the default values for AWS when entering/pasting the *.amazonaws.com url. What do you (and you @RoSchmi) think? Would this help?

AndreCouture commented 4 years ago

Hi @philipparndt and thanks for the reply.

I think either way would work, maybe both. In case the user already overwritten the port, maybe do not overwrite??

philipparndt commented 4 years ago

yes, that would be bad. I've now added a suggestion button which the user has to press in order to apply the preset. aws-iot

AndreCouture commented 4 years ago

Great idea!

Thanks

— Regards,

Andre Couture Senior Cloud Solution Architect

andre.couture@me.com https://www.linkedin.com/in/andrecouture

On May 9, 2020, at 07:54, Philipp Arndt notifications@github.com wrote:

 yes, that would be bad. I've now added a suggestion button which the user has to press in order to apply the preset.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

AndreCouture commented 4 years ago

Hi again

The aws detection works great !

Is there a way you could allow to browse the device for the certificate? Many apps allow this and it is very handy and easier compare to have to use iTunes or Finder to place the certificate in the app folder. Could also allow to copy/paste the content into variable...

Another enhancement would be to graph values when drilling down the messages For example when I drop down to see temperatures..

— Regards,

Andre Couture Senior Cloud Solution Architect

andre.couture@me.com https://www.linkedin.com/in/andrecouture

On May 9, 2020, at 07:56, Andre Couture andre.couture@me.com wrote:

Great idea!

Thanks

— Regards,

Andre Couture Senior Cloud Solution Architect

andre.couture@me.com https://www.linkedin.com/in/andrecouture

On May 9, 2020, at 07:54, Philipp Arndt notifications@github.com wrote:

 yes, that would be bad. I've now added a suggestion button which the user has to press in order to apply the preset.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

RoSchmi commented 4 years ago

Another enhancement would be to graph values…….. Do you mean something like this

https://apps.apple.com/de/app/charts4azure/id1442910354

AndreCouture commented 4 years ago

Cool, yes

— Regards,

Andre Couture Senior Cloud Solution Architect

andre.couture@me.com https://www.linkedin.com/in/andrecouture

On May 12, 2020, at 9:10 AM, RoSchmi notifications@github.com wrote:

Another enhancement would be to graph values…….. Do you mean something like this

https://apps.apple.com/de/app/charts4azure/id1442910354 https://apps.apple.com/de/app/charts4azure/id1442910354 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/philipparndt/mqtt-analyzer/issues/44#issuecomment-627333449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOXRKTFWCGFCIKQFFD37J2DRRFDC5ANCNFSM4MXD44ZA.

philipparndt commented 4 years ago

Hi again The aws detection works great !

Thanks a lot for testing and helping with this feature!

Is there a way you could allow to browse the device for the certificate? Many apps allow this and it is very handy and easier compare to have to use iTunes or Finder to place the certificate in the app folder. Could also allow to copy/paste the content into variable...

I've opened a ticket for this https://github.com/philipparndt/mqtt-analyzer/issues/52

Another enhancement would be to graph values when drilling down the messages For example when I drop down to see temperatures..

This is a great idea, I already had this implemented in a first alpha version of the app but the canceled the development on this topic as I currently do not have a good idea on how to handle with app cancellation by the operating system. iOS cancels the app shortly after it is send to background and there seems to be no way around (for battery reasons). The only solution I currently see would be to introduce a server side component but with that the user could also just use grafana or something similar. I'm open to any suggestion how we could implement this :)

RoSchmi commented 4 years ago

This is a great idea, I already had this implemented in a first alpha version of the app but the canceled the development on this topic as I currently do not have a good idea on how to handle with app cancellation by the operating system. iOS cancels the app shortly after it is send to background and there seems to be no way around (for battery reasons).

There are many aspects that have to be considered, so here are my two cents: The most important aspect is what you want to achieve. As I don’t know what you want, I can first tell what I would like to have: In the list of topics I would like to have the option to tap on this subscribed topic and have the option to get to a graphical view of the sampled values over a time interval. The sensor values will have to be stored in some database and as there may be many data it seems not advisable to store those data on the mobile device but this should be done with a database in the cloud. As you told, the App will stop action when it is sent to the background. So writing to the cloud database cannot be done by the App but has to be done either by the sensor-mcu itself (as I do it in my setup) or by e.g. a mqtt-broker (seems to be the better solution). When using the mqtt-broker the action to store incoming data in a database has to be configured on the Web-UI of the broker service (as I think on AWS and Azure this should be feasible, I don’t know enough about the features on other platforms). At the moment I don’t see a way how this configuration could be done by the MQTT-Analyzer App. The MQTT-Analyzer App could have the table name (e.g. sensor-name) of the cloud-database and so could read the sensor-values from the cloud. Unfortunately the steps of the configuration of the App and the mqtt-broker seem to be so complicated that a user with no IT-skills will hardly get it managed. As for users with IT-skills there will be the following problems: Will they find the App and will they be convinced that the App is what they are searching for.