User by user certificates, or server wide certificates? #1776
-
Background: I run mosquitto behind traefik, providing an unsecure MQTT broker on port 1883 for users. Where it concerns certificates, do they have to be distributed on a user by user basis? or can everyone use a 'server wide' certificate, extracted from the traefik produced acme.json file? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
It depends on what you're trying to do. TLS uses certificates in multiple ways. The most common is to have a certificate that's presented by the server to connecting clients, which the clients can use to authenticate the server. This is how most websites work. Some people choose to use "mutual TLS" (or mTLS) where every client identity is also issued a unique certificate for their identity. The server then uses this to authenticate the client. mTLS is not widely used, pretty complex, has many fun failure modes and is hard to manage. Unless you have a very good reason to take that approach, using server-side TLS with clients simply authenticating with credentials is usually a better option. If you're using acme (I assume with letsencrypt?) then the signed server certificate should be installed on your traefik instance. You don't need to distribute anything to clients, as they'll get presented that certificate when they connect, I validate it's signature against the device's root cert store (which should include LE). |
Beta Was this translation helpful? Give feedback.
-
The certs can be pulled ('built from', would be a more apt way to explain it) from the acme.json file, but they don't exist as cert or key files anywhere on my server. (at least, as far as I can tell) Further clarifying your post, if I used server side TLS via traefik, and when connecting to the mosquitto server through port 8883.. the traffic is encrypted? |
Beta Was this translation helpful? Give feedback.
-
Then you're going to have to fumble your way into PEM files which you'll have to install on Android. I would avoid doing that if at all possible; it's a pain. Server-side TLS means traffic will be encrypted. Just as with HTTPS. |
Beta Was this translation helpful? Give feedback.
-
You ought to be able to see the certs from Traefik by running
The resulting lines between
If you see something like let's encrypt then you ought to be able to use MQTT on our Android app without further configuration. |
Beta Was this translation helpful? Give feedback.
-
Thanks @jpmens, I tried the commands you mentioned, I'm not getting any certificates though.
I'm running (all in docker containers):
any suggestions? or ideas to put into the docs? |
Beta Was this translation helpful? Give feedback.
-
s_client shows that output when it's talking to a non-TLS endpoint
|
Beta Was this translation helpful? Give feedback.
-
OK, I've got it working. Should this be part of the docs/booklet? |
Beta Was this translation helpful? Give feedback.
Then you're going to have to fumble your way into PEM files which you'll have to install on Android. I would avoid doing that if at all possible; it's a pain.
Server-side TLS means traffic will be encrypted. Just as with HTTPS.