eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.61k stars 2.33k forks source link

mosquitto_sub does not present client certificate #3026

Open Erikvv opened 3 months ago

Erikvv commented 3 months ago

I connect to Azure Event Grid with mosquitto_sub. The --cert and --key arguments are ignored. I conclude this because:

When I use a different client such as paho-mqtt it does work.

Docker compose file:

services:
  mosquitto_sub:
    image: eclipse-mosquitto:2.0.18
    entrypoint: mosquitto_sub
    volumes:
      - ./cert:/cert
    command: >
      --debug
      --host lessgrid.francecentral-1.ts.eventgrid.azure.net
      --port 8883
      --id mosquitto_sub
      --cert /cert/mosquitto_sub.crt
      --key /cert/mosquitto_sub.key
      --topic moment
      --protocol-version 5

Command output:

$ docker compose run mosquitto_sub
Client mosquitto_sub sending CONNECT
Client mosquitto_sub received CONNACK (135)
Connection error: Not authorized
Client mosquitto_sub sending DISCONNECT
MichaelSteurer commented 3 months ago

I followed the Quickstart and then managed to publish with this command:

mosquitto_pub \
    -i client1 -u client1 \
    --cafile intermediate_ca.crt \
    --cert client1-authn-ID.pem \
    --key client1-authn-ID.key \
    --tls-use-os-certs \
    -h my.eventgrid.azure.net -p 8883 \
    -t my/topic -m "my_message" \
    -d