Skip to content

Mosquitto restarts following dynamic-security command over bridge #3261

Description

@BrodieGriggs

I am using mosquitto with the dynamic-security plugin as part of chirpstack-docker.

I need the dynamic security plugin to be controllable from another broker, so I have configured a bridge from the mosquitto broker to remote within mosquitto.conf:

connection remote-control-test
cleansession true
bridge_outgoing_retain false
address ...
remote_clientid mqtt-bridge
remote_username ...
remote_password ...
local_clientid mqtt-bridge
local_username ...
local_password ...
topic application/# out 0 "" LoRaWAN/
topic $CONTROL/dynamic-security/v1/response out 0 "" LoRaWAN/
topic $CONTROL/dynamic-security/v1 in 0 "" LoRaWAN/

I have tested dynamic-security interactions using the login provided to the bridge (local_username/local_password). Connecting using Mqtt Explorer to mosquitto, everything works with no issues.

However, when I attempt to send a command from the remote broker, via the bridge, the mosquitto broker restarts immediately after the publish is received:

2025-04-24 15:56:42 1745506602: Received PUBLISH from mqtt-bridge (d0, q0, r0, m0, '$CONTROL/dynamic-security/v1', ... (128 bytes))
2025-04-24 15:56:43 1745506603: mosquitto version 2.0.21 starting

If I issue a command on the mosquitto broker, the response is successfully forwarded to the remote broker $CONTROL/dynamic-security/v1/response. so it seems to be an issue solely with issuing commands via the bridge.

Is there something wrong with my configuration, or is it not possible to publish to the $CONTROL/dynamic-security/v1 topic using mosquitto's bridge connections?

Full mosquitto.conf

Activity

  1. ralight commented on May 1, 2025

    @ralight
    Contributor

    Thanks for the full details. This is related to using per_listener_settings true with the bridge control topic that you're doing. The fix will result in the control topics not working in this scenario - the bridges aren't connected to a listener, so they can't interact with any of those per-listener plugins.

    Having said that, the fix for what you actually want to do is straightforward. You have no need for per_listener_settings true in your config file, so just use this instead:

    log_type all
    
    plugin /usr/lib/mosquitto_dynamic_security.so
    plugin_opt_config_file /mosquitto/data/dynamic-security.json
    
    listener 1883 127.0.0.1
    
    listener 8883
    cafile /mosquitto/tls-certs/ca-chain.pem
    certfile /mosquitto/tls-certs/chirpstack-mosquitto.pem
    keyfile /mosquitto/tls-certs/chirpstack-mosquitto-key.pem
    
    connection remote-control-test
    cleansession true
    bridge_outgoing_retain false
    address ...
    remote_clientid mqtt-bridge
    remote_username ...
    remote_password ...
    local_clientid mqtt-bridge
    local_username ...
    local_password ...
    topic application/# out 0 "" LoRaWAN/
    topic $CONTROL/dynamic-security/v1/response out 0 "" LoRaWAN/
    topic $CONTROL/dynamic-security/v1 in 0 "" LoRaWAN/
    
  2. added a commit that references this issue on May 1, 2025
    0d8f163
  3. added this to the 2.0.22 milestone on May 1, 2025
  4. added
    Status: CompletedNothing further to be done with this issue, it can be closed by the requestor or committer.
    and removed
    Status: AvailableNo one has claimed responsibility for resolving this issue.
    on May 1, 2025
  5. added theissue type on May 1, 2025
  6. locked as resolved and limited conversation to collaborators on Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: mosquitto-brokerStatus: CompletedNothing further to be done with this issue, it can be closed by the requestor or committer.

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions