Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » PSK TLS does not work with mosquitto broker
PSK TLS does not work with mosquitto broker [message #1852844] Tue, 07 June 2022 14:05 Go to next message
Ken Teh is currently offline Ken TehFriend
Messages: 2
Registered: June 2022
Junior Member
I am unable to get PSK TLS to work. PKI TLS works fine so it's not a show stopper for me.

I'm running mosquitto with the following config.

connection_messages true
per_listener_settings true
listener 8883
socket_domain ipv4
psk_hint myfavoriteapple
psk_file /home/teh/hackware/mosquitto/psk.identities
use_identity_as_username false
password_file /home/teh/hackware/mosquitto/tpasswords


mosquitto_sub connects just fine
mosquitto_sub \
-p 8883 \
-i trucker -t home \
--psk `cat ken.psk` \
--psk-identity ken \
-u ken \
-P 'Ar+++4um'


but paho_c_sub with the same cli args fails to connect.
paho_c_sub \
-c ssl://127.0.0.1:8883 \
-i trucker -t home \
--psk `cat ken.psk` \
--psk-identity ken \
-u ken \
-P 'Ar+++4um'


The mosquitto broker says

1654609477: New connection from 127.0.0.1:56552 on port 8883.
1654609477: OpenSSL Error[0]: error:1417A0C1:SSL routines:tls_post_process_client_hello:no shared cipher
1654609477: Client <unknown> disconnected: Protocol error.


Ok, no shared cipher. So I specify a ciphers in to mosquitto config. Same as above but with
ciphers RSA-PSK-AES256-GCM-SHA384:RSA-PSK-CHACHA20-POLY1305:RSA-PSK-AES128-GCM-SHA256


added to the config file. Then, I add the '--ciphers' option to both
mosquitto_sub
and
paho_c_sub
. Now both utilities don't work with the same error 'no shared cipher'. Btw, I selected the ciphers from the list printed out by
openssl ciphers -s -psk
.

I'm going to dig a little into the mosquitto code to see why it works in the first case with no ciphers specified and not the latter. Seems to me either I don't know how to use the utilities or there's some mismatch between paho.mqtt and mosquitto codes when it comes to PSK handling.

I'm tossing this out now in the hopes someone knows the answer. As I said, PKI TLS works so it's no a show stopper., though my initial preference was to use PSK.

One more thing: I wrote my own paho subscriber using the paho c libraries. It has the exact same error: 'no shared ciphers'.



Re: PSK TLS does not work with mosquitto broker [message #1852942 is a reply to message #1852844] Sat, 11 June 2022 20:45 Go to previous message
Ken Teh is currently offline Ken TehFriend
Messages: 2
Registered: June 2022
Junior Member
One more data point.

I tried openssl s_client to connect to the mosquitto broker with psk. It works! It suggests that the paho mqtt c library's handling of psk tls is faulty or I just don't know the magic sequence of command line options to make it work.

Pki tls works fine.

Previous Topic:RUST mqtt-sn crate help
Next Topic:ConnectionRefusedError After Update
Goto Forum:
  


Current Time: Fri May 03 07:02:39 GMT 2024

Powered by FUDForum. Page generated in 0.03244 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top