Comments (9)
I finally found something that could do this... The GNU Makefile in the samples directory was linking the ssl_publish sample to the non-SSL version of the Paho C library. I just pushed the fix for that to the 'develop' branch.
Please make sure that you're linking to the Paho C library paho-mqtt3as
(with the 's' at the end).
I tested this against the certificates in the Paho C test directory. I ran mosquitto with the configuration from there:
git clone https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
mosquitto -c test/tls-testing/mosquitto.conf
And then I used the file "test-root-ca.crt" from that directory (paho.mqq.c/test/tls-testing) as the trust store for ssl_publish. That all worked for me.
Other than that, the C++ library just passes the names of the SSL/TLS certificates down to the C library. If there are still issues, perhaps we can get help from the folks working directly with the C library.
from paho.mqtt.cpp.
Thank you very much for the suggestions!
I will try it immediately and then I will inform you if this work.
from paho.mqtt.cpp.
OK,
thank you again,
I have tested ssl_publish on an ubuntu machine and,, following your iindications, it works properly,
But I have stll the same problem indicated in my first post, running it in my raspberry (with the same configuration and certificates).
Some other hints:
- sync_publisher works also on the raspberry, it iconnects itself to the mosquitto correctly.
- I have started mosquitto in verbose mode and when I start the ssl_publish client, it doesn't print on console (it is not a TLS handshake problem). It doesn't receive the connection.
Please, let me know if you have some other suggestion,
from paho.mqtt.cpp.
So, if I understand... It works over localhost on either an Ubuntu PC or a Raspberry Pi, but if you try to connect a client on the Pi to the mosquitto broker on a PC, it doesn't work?
Does it work with another client across this connection? (Java client or maybe mosquitto utility like mosquitto_pub)? Could there be a firewall getting in the way? Or the server configured for only localhost?
I have a few hundred RPi's at my office, so I can try this as well. But I won't be there for a few days.
from paho.mqtt.cpp.
No sorry I have not been clear,
I have installed the paho.mqtt library and the mosquitto server both on the ubuntu PC and on the raspberry Pi, and for both, I have tested the localhost connection, running mosquitto using the same configuration that you have indicated: test/tls-testing/mosquitto.conf.
If I run ssl_publish on the Ubuntu PC, the connection to the local mosquitto works.
if I run ssl_publish on the Raspberry Pi, the connection to the local msquitto doesn't work.
I hope to have been more clear now,
from paho.mqtt.cpp.
Oh. OK. I've got it now. I will test that as soon as I can.
from paho.mqtt.cpp.
I tested on a RaspberryPi, and it worked as expected. I did not see a problem.
I'm using Raspbian Jessie on an RPi2, and I did a full apt-get update/upgrade before starting the tests. This also updated my version of mosquitto:
$ uname -a
Linux thrivepi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
$ mosquitto -h
mosquitto version 1.4.11 (build date Mon, 20 Feb 2017 22:47:27 +0000)
...
I tested with the latest development version of both Paho C & C++ (the 'develop' branches of each, as of this morning) and did a native build of both using GCC v 4.9.2.
The sample showed the usual output:
$ ./ssl_publish
Initializing for server 'ssl://localhost:18885'...
...OK
Connecting...
Waiting for the connection...
...OK
Sending message...
Delivery complete for token: ...OK
Sending next message...
1
Delivery complete for token: 2
...OK
Disconnecting...
...OK
and mosquitto (running with the verbose '-v' option) showed:
1492447514: New connection from 127.0.0.1 on port 18885.
1492447514: New client connected from 127.0.0.1 as CppAsyncPublisherSSL (c1, k60, u'testuser').
1492447514: Sending CONNACK to CppAsyncPublisherSSL (0, 0)
1492447514: Received PUBLISH from CppAsyncPublisherSSL (d0, q1, r0, m1, 'hello', ... (0 bytes))
1492447514: Sending PUBACK to CppAsyncPublisherSSL (Mid: 1)
1492447514: Received PUBLISH from CppAsyncPublisherSSL (d0, q1, r0, m2, 'hello', ... (0 bytes))
1492447514: Sending PUBACK to CppAsyncPublisherSSL (Mid: 2)
1492447514: Received DISCONNECT from CppAsyncPublisherSSL
1492447514: Client CppAsyncPublisherSSL disconnected.
from paho.mqtt.cpp.
OK, thank you very much for the test,
in my tests I have used the master version of paho-mqtt-c and not the develop branch. I will try with that branch and then I will let you know the result.
from paho.mqtt.cpp.
This seems to be working now.
from paho.mqtt.cpp.
Related Issues (20)
- No consumer notification when broker cleanly disconnects HOT 3
- paho.mqtt.cpp looks for PahoMqttC, but the package named - eclipse-paho-mqtt-c. HOT 2
- CMake Error when PAHO_BUILD_SAMPLES=TRUE (Cannot find src/samples/async_consume_v5.cpp) HOT 1
- Why is this project under Eclipse v1.0 when paho.mqtt.c is under Eclipse v2.0? HOT 1
- Building paho.mqtt.cpp: cmake doesn't pick up my c++ compiler correctly. HOT 4
- Homebrew Installation HOT 1
- Automatic Reconnect Crashes MQTT when `client.reconnect()` is called HOT 7
- Connect failed, more to try HOT 1
- SSL_read() Segmentation fault
- Build with PAHO_WITH_MQTT_C is broken HOT 3
- broker(emqx) already support QUIC, and i Hope client also supports the Quic protocol HOT 1
- arm cross get error HOT 5
- Add getter for the connect_options object (connOpts_) in async_client
- Operation not permitted on try_consume_message async HOT 1
- Base64TestOpenSSL giving problem and how to use only paho-mqtt3as libraray project in visual studio
- Cross compilation of paho.mqtt.cpp HOT 7
- cmake issue in Docker container HOT 2
- error in install_paho_mqtt_c.sh in the installation process of the latest version of paho.mqtt.cpp
- ThreadSanitizer: lock-order-inversion (potential deadlock) paho 1.2.0
- Linker-Error when compiling with v1.3.2 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paho.mqtt.cpp.