sonnyyu / mtls-mosquitto

Mosquitto SSL Configuration - MQTT TLS Security

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use mtls-cert-manage generate server/client/ca certificate

https://github.com/sonnyyu/mtls-cert-manage

Copy Certificate from mtls-cert-manage

cd ~/mtls-cert-manage/pki
./server.sh
./client.sh

Copy Certificate from mtls-cert-manage

cd ~/mtls-cert-manage/pki/servercerts 
cp * ~/mtls-mosquitto/certs
cd ~/mtls-cert-manage/pki/clientcerts
cp * ~/mtls-mosquitto/certs

Getting started mosquitto with certificate

cd ~/mtls-mosquitto
docker-compose build

Getting started mosquitto with certificate

docker-compose up -d

Quit

docker-compose down 

Quit and remove Volume

docker-compose down -v

Test mTLS

cd ~/mtls-mosquitto/certs/
mosquitto_sub -p 8883 --cafile ca.crt --cert client1.crt --key client1.key -h 192.168.1.204 -t msg 
# Start a an other SSH session from the command line
mosquitto_pub -p 8883 --cafile ca.crt --cert client1.crt --key client1.key -h 192.168.1.204 -t msg -m "test"

About

Mosquitto SSL Configuration - MQTT TLS Security

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Dockerfile 96.5%Language:Shell 3.5%