feat: Add TLS encryption to MQTT bridge for secure connection to base station#537
Conversation
There was a problem hiding this comment.
Pull request overview
Adds TLS configuration for the base station’s Mosquitto MQTT bridge so it can connect securely to the car broker on port 8883, while keeping a local unencrypted listener on 1883 for existing services.
Changes:
- Added a full Mosquitto configuration including a TLS-enabled bridge to
192.168.100.12:8883. - Added a
.gitignoreundersiren-base/mosquitto/to keep cert/key material out of version control. - Added
secure_mqtt.patchas a future, repo-wide 1883→8883 migration patch.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| siren-base/mosquitto/mosquitto.conf | Introduces Mosquitto config with bridge-to-car TLS settings and keeps local listener on 1883. |
| siren-base/mosquitto/.gitignore | Ignores .key and .crt files in the mosquitto config directory. |
| secure_mqtt.patch | Adds a “future migration” patch for changing services to use 8883. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| diff --git a/compose/compose.brick.yml b/compose/compose.brick.yml | ||
| index 007ef16..f7c2537 100644 | ||
| --- a/compose/compose.brick.yml | ||
| +++ b/compose/compose.brick.yml |
There was a problem hiding this comment.
This patch file references paths that don't exist in the current repo (e.g., compose/compose.*.yml and siren-base/compose.siren.yml), so it won’t apply cleanly and is likely to become stale. Consider removing it from version control (or moving it to external documentation/issue notes) unless it’s kept in sync with the current file layout and validated with git apply.
|
|
||
| #include_dir | ||
|
|
||
| max_qos 2 # *** moved to bottom see bug https://github.com/eclipse/mosquitto/issues/2991 |
There was a problem hiding this comment.
max_qos 2 has an inline comment. Mosquitto only treats # as a comment when it starts the line, so this will be parsed as part of the value and can prevent the broker from starting. Move the comment onto its own line above (or make the whole line a comment) so the directive is just max_qos 2.
| max_qos 2 # *** moved to bottom see bug https://github.com/eclipse/mosquitto/issues/2991 | |
| # *** moved to bottom see bug https://github.com/eclipse/mosquitto/issues/2991 | |
| max_qos 2 |
| allow_anonymous true | ||
|
|
||
| # ----------------------------------------------------------------- | ||
| # Default authentication and topic access control | ||
| # ----------------------------------------------------------------- | ||
|
|
||
| #password_file |
There was a problem hiding this comment.
The MQTT broker is configured with allow_anonymous true, which means any client that can reach this listener can connect, subscribe, and publish without authentication. If port 1883 is exposed on the host or network (as suggested by the accompanying compose configuration), an attacker on the network could inject or read MQTT messages destined for the car, potentially controlling or monitoring vehicle functions. Consider disabling anonymous access and requiring authentication and/or mutual TLS for this listener, or strictly binding it to a trusted interface/network segment so that only trusted services can connect.
| allow_anonymous true | |
| # ----------------------------------------------------------------- | |
| # Default authentication and topic access control | |
| # ----------------------------------------------------------------- | |
| #password_file | |
| allow_anonymous false | |
| # ----------------------------------------------------------------- | |
| # Default authentication and topic access control | |
| # ----------------------------------------------------------------- | |
| password_file /mosquitto/config/passwordfile |
Changes
Configured the base station's MQTT bridge to connenc tot he car over TLS on port 8883, while keeping the local listener on port 1883 so existing services can remain unencrypted prior to integration. This is the first step towards fully encrypting MQTT communications on the NER network but for now encryption has been configured on both the car and the base station.
siren-base/mosquitto/mosquitto.confsiren-base/mosquitto/.gitignore.gitignoreto exclude certificate private keys (.key) and certificate files (.crt) from version controlsecure_mqtt.patchNotes
Test Cases
To Do
Any remaining things that need to get done
Checklist
It can be helpful to check the
ChecksandFiles changedtabs.Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.
package-lock.jsonchanges (unless dependencies have changed)Closes # (issue #)