Skip to content

Instantly share code, notes, and snippets.

@dileepbapat
Created January 31, 2022 04:14
Show Gist options
  • Save dileepbapat/f79c93fc9b8dfbdc1d969ddd37db5f59 to your computer and use it in GitHub Desktop.
Save dileepbapat/f79c93fc9b8dfbdc1d969ddd37db5f59 to your computer and use it in GitHub Desktop.
Mosquitto-ssl
Securing mosquitto
```shell script
# Create certificate authority key
openssl genrsa -des3 -out ca.key 2048
openssl req -new -x509 -days 1826 -key ca.key -out ca.crt
# Server key
openssl genrsa -out server.key 2048
openssl req -new -out server.csr -key server.key
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 360
>
(.venv) ➜ mosquitto ls -1
ca.crt
ca.key
ca.srl
server.crt
server.csr
server.key
```
Configure tls on and keys in mosquitto.conf
```
tls_version tlsv1.2
listener 8883
cafile mosquitto/ca.crt
certfile mosquitto/server.crt
keyfile mosquitto/server.key
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment