You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@edgent.apache.org by Bruce M Potter <bp...@us.ibm.com> on 2016/08/05 12:24:43 UTC

SSL Connection to MQTT


I want to have my quarks app make a secure connection to an mqtt broker.
So far i've succeeded in connecting to the broker using the connect() and
publish() methods of org.eclipse.paho.client.mqttv3.MqttClient.  But i'm
not sure how to integrate that with my topology stream.  And i can't find
an example of using quarks.connectors.mqtt.MqttConfig and
quarks.connectors.mqtt.MqttStreams with ssl and can't quite work it out
from the javadoc.  What have others done when they want to publish stream
data to mqtt using ssl?  Are there any examples?  Thx.

Bruce Potter        STSM, Cloud Innovation Lab Architect, IBM,
Poughkeepsie, NY
Email: bp@us.ibm.com    Phone:  external: 845-433-7073, internal: TL
293-7073

Re: SSL Connection to MQTT

Posted by Bruce M Potter <bp...@us.ibm.com>.
Dale,

Ah, i hadn't yet found that test code, and the README it references is very
helpful.  Thx, i think that's what i need!

Bruce Potter        STSM, Cloud Innovation Lab Architect, IBM,
Poughkeepsie, NY
Email: bp@us.ibm.com    Phone:  external: 845-433-7073, internal: TL
293-7073




From:	Dale LaBossiere <dm...@gmail.com>
To:	dev@quarks.incubator.apache.org
Date:	08/05/2016 10:19 AM
Subject:	Re: SSL Connection to MQTT




There’s a general MqttSample that should also work w/SSL configs here
https://github.com/apache/incubator-quarks/blob/master/samples/connectors/src/main/java/org/apache/edgent/samples/connectors/mqtt/README
 <
https://github.com/apache/incubator-quarks/blob/master/samples/connectors/src/main/java/org/apache/edgent/samples/connectors/mqtt/README
>

If the mqtt server uses a CA-signed certificate, then all you should have
to do is specify use of the ssl://… MQTT server URL.

For a non-CA-signed cert, you’ll have to manually add the server’s cert to
a trust store and set the MqttConfig’s “trustStore” and
“trustStorePassword” items for it.

There's an SSL config test for MqttStreams here that nets out to the above:
https://github.com/apache/incubator-quarks/blob/master/connectors/mqtt/src/test/java/org/apache/edgent/test/connectors/mqtt/MqttStreamsTestManual.java#L1155
 <
https://github.com/apache/incubator-quarks/blob/master/connectors/mqtt/src/test/java/org/apache/edgent/test/connectors/mqtt/MqttStreamsTestManual.java#L1155
>

Hope that helps.
— Dale


> On Aug 5, 2016, at 8:24 AM, Bruce M Potter <bp...@us.ibm.com> wrote:
>
>
>
> I want to have my quarks app make a secure connection to an mqtt broker.
> So far i've succeeded in connecting to the broker using the connect() and
> publish() methods of org.eclipse.paho.client.mqttv3.MqttClient.  But i'm
> not sure how to integrate that with my topology stream.  And i can't find
> an example of using quarks.connectors.mqtt.MqttConfig and
> quarks.connectors.mqtt.MqttStreams with ssl and can't quite work it out
> from the javadoc.  What have others done when they want to publish stream
> data to mqtt using ssl?  Are there any examples?  Thx.
>
> Bruce Potter        STSM, Cloud Innovation Lab Architect, IBM,
> Poughkeepsie, NY
> Email: bp@us.ibm.com    Phone:  external: 845-433-7073, internal: TL
> 293-7073




Re: SSL Connection to MQTT

Posted by Dale LaBossiere <dm...@gmail.com>.
There’s a general MqttSample that should also work w/SSL configs here https://github.com/apache/incubator-quarks/blob/master/samples/connectors/src/main/java/org/apache/edgent/samples/connectors/mqtt/README <https://github.com/apache/incubator-quarks/blob/master/samples/connectors/src/main/java/org/apache/edgent/samples/connectors/mqtt/README>

If the mqtt server uses a CA-signed certificate, then all you should have to do is specify use of the ssl://… MQTT server URL.

For a non-CA-signed cert, you’ll have to manually add the server’s cert to a trust store and set the MqttConfig’s “trustStore” and “trustStorePassword” items for it.

There's an SSL config test for MqttStreams here that nets out to the above:  https://github.com/apache/incubator-quarks/blob/master/connectors/mqtt/src/test/java/org/apache/edgent/test/connectors/mqtt/MqttStreamsTestManual.java#L1155 <https://github.com/apache/incubator-quarks/blob/master/connectors/mqtt/src/test/java/org/apache/edgent/test/connectors/mqtt/MqttStreamsTestManual.java#L1155>

Hope that helps.
— Dale


> On Aug 5, 2016, at 8:24 AM, Bruce M Potter <bp...@us.ibm.com> wrote:
> 
> 
> 
> I want to have my quarks app make a secure connection to an mqtt broker.
> So far i've succeeded in connecting to the broker using the connect() and
> publish() methods of org.eclipse.paho.client.mqttv3.MqttClient.  But i'm
> not sure how to integrate that with my topology stream.  And i can't find
> an example of using quarks.connectors.mqtt.MqttConfig and
> quarks.connectors.mqtt.MqttStreams with ssl and can't quite work it out
> from the javadoc.  What have others done when they want to publish stream
> data to mqtt using ssl?  Are there any examples?  Thx.
> 
> Bruce Potter        STSM, Cloud Innovation Lab Architect, IBM,
> Poughkeepsie, NY
> Email: bp@us.ibm.com    Phone:  external: 845-433-7073, internal: TL
> 293-7073