diff --git a/mqtt-cert-manager/CHANGELOG.md b/mqtt-cert-manager/CHANGELOG.md index b873ac4..d98cc8f 100644 --- a/mqtt-cert-manager/CHANGELOG.md +++ b/mqtt-cert-manager/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## 0.4.2 + - Certificate Common Name (CN) is now taken from each device's own CSR instead of being forced to equal its `device_id`. Enables deployments where many devices intentionally share one CN per @@ -10,11 +11,14 @@ CN alongside `device_id` for each entry. ## 0.4.1 + - Changed SAN default for generating server certificate - Added two new options for organizations ## 0.4.0 + - Replaced RSA algorithm with EC for encryption. ## 0.3.0 + - Initial release. \ No newline at end of file diff --git a/mqtt-cert-manager/DEVICE_PROTOCOL.md b/mqtt-cert-manager/DEVICE_PROTOCOL.md index eeaad07..a69f5ca 100644 --- a/mqtt-cert-manager/DEVICE_PROTOCOL.md +++ b/mqtt-cert-manager/DEVICE_PROTOCOL.md @@ -20,6 +20,7 @@ step 2. The private key never leaves the device. Generate an RSA-2048 (or EC P-256) key pair and a PKCS#10 CSR with: + - Common Name = whatever identity you want written into the issued certificate. This does NOT have to be `device_id` and does NOT have to be unique per device — a common pattern is to share one CN across a @@ -39,6 +40,7 @@ Topic: `cert/enroll//request` QoS: 1, retain: false Payload (JSON): + ```json { "csr": "-----BEGIN CERTIFICATE REQUEST-----\n...\n-----END CERTIFICATE REQUEST-----\n", @@ -48,6 +50,7 @@ Payload (JSON): } } ``` + `meta` is optional and only shown to the human approving the request — put anything there that helps you recognize the device in the UI. @@ -69,26 +72,31 @@ device has its own dedicated topics here — no filtering needed, unlike setups where many devices might share one topic. - `cert/enroll//issued` — retained. Payload: + ```json { "cert": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n", "ca": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n" } ``` + Because this is retained, if the device subscribes *after* a cert was already issued (e.g. after a reboot), it will receive it immediately without needing to re-request. - `cert/enroll//rejected` — not retained. Payload: + ```json { "reason": "human-readable reason" } ``` - `cert/enroll//revoked` — not retained, best-effort only. Payload: + ```json { "reason": "human-readable reason" } ``` + Sent if you revoke a device's cert after it was issued. This is informational — actual enforcement happens at the TLS layer via Mosquitto's CRL check, which a revoked device will hit on its *next* @@ -117,6 +125,7 @@ Topic: `cert/enroll//renew` QoS: 1, retain: false Payload (JSON): + ```json { "csr": "-----BEGIN CERTIFICATE REQUEST-----\n...\n-----END CERTIFICATE REQUEST-----\n", diff --git a/visquitto/CHANGELOG.md b/visquitto/CHANGELOG.md new file mode 100644 index 0000000..e08abc9 --- /dev/null +++ b/visquitto/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 0.1.0 + +- Initializing the Application diff --git a/visquitto/Dockerfile b/visquitto/Dockerfile new file mode 100644 index 0000000..bfc15b2 --- /dev/null +++ b/visquitto/Dockerfile @@ -0,0 +1,4 @@ +FROM eclipse-mosquitto:2 +COPY run.sh /run.sh +RUN chmod a+x /run.sh +CMD ["/run.sh"] \ No newline at end of file diff --git a/visquitto/README.md b/visquitto/README.md new file mode 100644 index 0000000..8da9dbd --- /dev/null +++ b/visquitto/README.md @@ -0,0 +1,61 @@ +# Visquitto + +Visquitto is a simple Mosquitto broker setup intended to run on a separate port and be used alongside [mqtt-cert-manager](../mqtt-cert-manager) and custom MQTT nodes. + +This is not a full certificate-management platform or a Home Assistant-only app. It is a lightweight broker instance for local MQTT traffic, designed to coexist with [mqtt-cert-manager](../mqtt-cert-manager) and custom client code. + +## What it is + +- A standard Mosquitto broker +- Configured for a dedicated port, separate from the default broker +- Meant to be used alongside [mqtt-cert-manager](../mqtt-cert-manager) and custom MQTT nodes +- Intended for local/private network use + +## Why use it + +If you want a second MQTT broker for a specific project, workflow, or device group, Visquitto gives you: + +- a clean, separate broker port +- a simple local MQTT endpoint for custom nodes and devices +- isolation from your main broker traffic +- an easy way to pair it with your own app logic + +## Typical setup + +Visquitto is designed to be used like this: + +- Your main app runs normally +- Custom nodes or devices connect to the Visquitto broker +- The broker listens on its own port instead of the default Mosquitto port +- Traffic is kept separate from the primary broker environment + +## Requirements + +- A machine/container/environment capable of running Mosquitto +- A separate port for the broker +- Your own app and custom MQTT clients/nodes +- Local or private network access as needed + +## Configuration + +Common settings include: + +- broker port +- listener configuration +- allow/deny rules if needed +- persistence settings +- logging options +- TLS settings if you choose to enable them + +This project is intentionally minimal: it provides a broker for your other app and custom nodes rather than trying to manage a larger certificate or onboarding system. + +## Notes + +- This is a plain Mosquitto-based broker setup +- It is meant to complement another app, not replace it +- It is best suited for local experiments, custom node integrations, and paired app workflows +- If you are using TLS or custom auth, configure it explicitly for your environment + +## License + +Please check the repository license file for usage terms if one is included in the project. diff --git a/visquitto/config.yaml b/visquitto/config.yaml new file mode 100644 index 0000000..6db1312 --- /dev/null +++ b/visquitto/config.yaml @@ -0,0 +1,18 @@ +name: Visquitto +version: "0.1.0" +slug: visquitto +description: Second private Mosquitto broker for bitopa nodes +arch: + - amd64 +init: false +startup: services +boot: auto +ports: + 1883/tcp: 1993 + 8883/tcp: 9993 +ports_description: + 1883/tcp: MQTT (plain) + 8883/tcp: MQTT over TLS +map: + - addon_config:rw + - ssl:ro \ No newline at end of file diff --git a/visquitto/run.sh b/visquitto/run.sh new file mode 100644 index 0000000..de9c10d --- /dev/null +++ b/visquitto/run.sh @@ -0,0 +1,33 @@ +#!/bin/sh +set -e + +mkdir -p /data/mosquitto /config/certs +chown -R mosquitto:mosquitto /data/mosquitto + +if [ ! -f /config/mosquitto.conf ]; then + cat > /config/mosquitto.conf <<'EOF' +allow_anonymous false +password_file /config/passwd +acl_file /config/acl +persistence true +persistence_location /data/mosquitto/ + +listener 1883 + +listener 8883 +cafile /ssl/mqtt-cert-manager-ca.crt +certfile /ssl/mosquitto-server.crt +keyfile /ssl/mosquitto-server.key +tls_version tlsv1.2 +EOF + touch /config/acl +fi + +for f in passwd /ssl/mqtt-cert-manager-ca.crt /ssl/mosquitto-server.crt /ssl/mosquitto-server.key; do + if [ ! -f "/config/$f" ]; then + echo "Missing /config/$f, see the app docs" >&2 + exit 1 + fi +done + +exec mosquitto -c /config/mosquitto.conf \ No newline at end of file