Skip to content
gunkslab

Security

Checking it on a real bot

The bots’ side of the logins has been run off the bot only. A bot makes its key, prints a request, checks the certificate it’s given, and logs in over TLS. That code ran on a PC, on the same mbedTLS as the ESP32’s (2.28), and the certificate it got logged in to the broker’s configuration. What only a real ESP32 can show is below. Until it’s been run, the bots’ part of desk-issues#5 stays open.

These checks need a bot on the bench, on USB, and bench mode or the cluster’s broker. Logins and certificates has the steps for each; this page says what to look for.

The checks

# Do Expect
1 Flash it with MQTT_CA, MQTT_PORT 8883 [mqtt] login: TLS, but no certificate yet: cert-request
2 cert-request A request between BEGIN CERTIFICATE REQUEST and END CERTIFICATE REQUEST, in about a second; openssl req -in bot-xxxxxx.csr -noout -verify says verify OK
3 cert-request again The same key: openssl req -noout -pubkey gives the same for both requests
4 scripts/bot-cert bot-xxxxxx.csr, then cert and paste [tls] certificate kept, until 2028-10-29; logging in as bot-xxxxxx, then [mqtt] up as bot-xxxxxx
5 Watch the broker’s log New client connected ... as bot-xxxxxx, its TLS version and cipher
6 Watch the page, or scripts/broker watch Its hello, status and telemetry, as a simulated bot’s; it drives through the station
7 Its telemetry’s free memory Stays steady over ten minutes; write down how much TLS took (against a build without MQTT_CA)
8 Power it off and on It logs in again by itself, with no new cert-request
9 Restart the broker It’s offline for a moment, then back by itself
10 MQTT_CA from another CA, reflash [mqtt] TLS failed: it won’t talk to a broker it can’t check
11 Revoke its certificate (scripts/certs revoke bot-xxxxxx) Dropped at once, and refused from then on; cert-clear then cert-request starts it over
12 Set your e-stop, then someone else’s; clear yours, then theirs (as an admin) estop_on once; still stopped after yours is cleared; estop_off after theirs; it drives again only on a fresh command
13 An update over the air, with TLS in (scripts/bot-ota upload) It fits, [ota] signed by this bot's key, and the bot comes back up with its certificate and the new fw
14 An update signed with another key: GUNKSLAB_BENCH set to an empty folder, scripts/fw-sign key new there, then the upload [ota] update refused, the signature isn't by this bot's key; it keeps driving; power it off and on, and its fw is still the old
15 An unsigned update: the build’s own firmware.bin sent with PlatformIO’s espota.py [ota] update refused, not signed; the same after a power cycle
16 A file-system upload: espota.py -s with any file [ota] update refused: firmware only, and the upload fails
17 Pirate Stage, the same, once the car exists As above

Once they pass

  • Fill in the bench guide’s and the logins guide’s expected output from what the bot really printed.
  • Close the bots’ part of desk-issues#5.
  • Note the memory TLS takes, and the flash left (scripts/firmware build), in the firmware reference.