Compare commits

..

4 Commits

Author SHA1 Message Date
eta 4611c14a81 visquitto: added discovery topic
build-and-push / check-branch (push) Successful in 11s
build-and-push / prepare (push) Successful in 9s
build-and-push / build (amd64, linux/amd64) (push) Successful in 1m22s
2026-11-04 16:19:15 +03:30
eta 209b697a39 mcm: edited device protocol 2026-10-31 14:07:20 +03:30
eta 676e0b3040 mcm: edited device protocol 2026-10-28 12:14:09 +03:30
eta cb4ac5c606 added visquitto changelog 2026-10-15 15:16:20 +03:30
4 changed files with 21 additions and 16 deletions
+9 -13
View File
@@ -18,23 +18,19 @@ step 2.
## 1. Generate a key pair and CSR (on-device, once) ## 1. Generate a key pair and CSR (on-device, once)
The private key never leaves the device. Generate an RSA-2048 (or EC The private key never leaves the device. Generate an EC
P-256) key pair and a PKCS#10 CSR with: P-256 (or RSA-2048 which is not recommended) key pair and a PKCS#10 CSR with:
- Common Name = whatever identity you want written into the issued - Common Name = whatever identity you want written into the issued
certificate. This does NOT have to be `device_id` and does NOT have to certificate. This have to be some `device_id`.
be unique per device — a common pattern is to share one CN across a
whole category of devices (e.g. every TH sensor uses CN `TH-Sensors`,
every light sensor uses CN `Light-Sensors`), which is useful if you're
writing broker ACL rules grouped by category rather than by individual
device.
- No need for other extensions in the CSR itself; the add-on sets the - No need for other extensions in the CSR itself; the add-on sets the
ones that matter (basic constraints, key usage, SAN) when it signs. ones that matter (basic constraints, key usage, SAN) when it signs.
Persist the key pair to flash. If a cert is later lost or expires, reuse Persist the key pair to flash. If a cert is later lost or expires, reuse
the same key and just repeat step 2 — no need to regenerate the key. the same key and just use auto renewal procedure (or repeat step 2 which
is not recommended) — no need to regenerate the key.
## 2. Publish the request ## 2. Publish the request (port = 1993)
Topic: `cert/enroll/<device_id>/request` Topic: `cert/enroll/<device_id>/request`
QoS: 1, retain: false QoS: 1, retain: false
@@ -64,7 +60,7 @@ of the device's current, still-valid cert, regardless of what a renewal
request's CSR claims. Changing identity requires a fresh, human-approved request's CSR claims. Changing identity requires a fresh, human-approved
enrollment, not a renewal. enrollment, not a renewal.
## 3. Subscribe for the result, before or immediately after publishing ## 3. Subscribe for the result, before or immediately after publishing (port = 1993)
Subscribe to both of these (QoS 1) so you catch whichever response comes. Subscribe to both of these (QoS 1) so you catch whichever response comes.
Since `device_id` is unique per device (per the requirement above), each Since `device_id` is unique per device (per the requirement above), each
@@ -105,14 +101,14 @@ setups where many devices might share one topic.
firmware to, say, stop operating or blink an error LED immediately firmware to, say, stop operating or blink an error LED immediately
rather than waiting for the next failed connection. rather than waiting for the next failed connection.
## 4. Install and reconnect ## 4. Install and reconnect (port = 9993)
Store `cert` and `ca` to flash alongside the existing private key. Store `cert` and `ca` to flash alongside the existing private key.
Reconnect to the broker using mutual TLS (client cert + key, broker CA Reconnect to the broker using mutual TLS (client cert + key, broker CA
trust anchor = the same `ca`). Once confirmed working, you can stop trust anchor = the same `ca`). Once confirmed working, you can stop
listening on the unauthenticated bootstrap connection for that device. listening on the unauthenticated bootstrap connection for that device.
## 5. Renewal ## 5. Renewal (port = 9993)
Devices are trusted to renew themselves automatically once they're within Devices are trusted to renew themselves automatically once they're within
`renewal_window_days` (default 30) of `not_after` — **no human approval `renewal_window_days` (default 30) of `not_after` — **no human approval
+4
View File
@@ -1,5 +1,9 @@
# Changelog # Changelog
## 0.6.0
- Added new ACL rules to support new renew system
## 0.5.8 ## 0.5.8
- Fixed TLS access control bug - Fixed TLS access control bug
+1 -1
View File
@@ -1,5 +1,5 @@
name: Visquitto name: Visquitto
version: "0.6.0" version: "0.7.0"
slug: visquitto slug: visquitto
description: Second private Mosquitto broker for bitopa nodes description: Second private Mosquitto broker for bitopa nodes
url: "https://gitea.viratak.com/bitopa/virarepo/src/branch/main/visquitto" url: "https://gitea.viratak.com/bitopa/virarepo/src/branch/main/visquitto"
+7 -2
View File
@@ -102,8 +102,13 @@ EOF
# TLS ACL # TLS ACL
cat > "$CONFIG/acl_tls" <<EOF cat > "$CONFIG/acl_tls" <<EOF
# Default rule for every certificate client. %u is the certificate CN. # Default rule for every certificate client. %u is the certificate CN.
pattern readwrite clients/%u/#
pattern write cert/enroll/%u/renew # data exchange topic
pattern readwrite clients/%u/#
# discovery topic
pattern write vmqtt/sensor/%u/#
# connection topics
pattern write cert/enroll/%u/renew
pattern write cert/enroll/%u/renew-begin pattern write cert/enroll/%u/renew-begin
pattern read cert/enroll/%u/challenge pattern read cert/enroll/%u/challenge
EOF EOF