feat(routeros): bootstrap v2 - host-driven REST delivery + netinstall driver #112
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lab/iac!112
Loading…
Reference in a new issue
No description provided.
Delete branch "routeros-bootstrap-64"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #64.
What this is
routeros/bootstrap/: render a per-device bootstrap.rsc(identity, clock, NTP, DNS, mgmt VLAN/address + route, terraform user, human SSH keys, OpenBao-issued certificate, service hardening), then deliver it over industry-standard mechanisms and prove it landed.Two delivery paths, no hand-rolled console anything:
first-contact.sh— host-driven REST. A factory CHR serveswwwwith blankadmin:on its MAC-derived link-local IPv6; the host classifies the device with an early-401 retry loop, serves the rendered script from a one-shot HTTP server, and has the router/tool/fetch+/importit, exactly like the vendoredchr-launch.shfirst-boot. The/importresponse is treated as untrusted on purpose (the script disableswwwand rewrites the executing admin's password mid-flight); success is proven by read-back overwww-sslwith CA and hostname verification.netinstall-deliver.sh+BENCH-RUNBOOK.md— MikroTik's official tool for routers with no reachable IP, using the default-configuration slot (-s) for reset replay. Pinned decision: wipe (-e) by default, because a kept factory RB5009 config (DHCP client and WAN firewall on ether1) has never been exercised against this bootstrap;--keep-configexists and says so.Proven live on CHR 7.25.1 (throwaway sandbox, destroyed after)
Session closedhttp=400 (expected), read-back up in 1–2 s over verified TLS, acceptance checks a–d + protected set pass, reset → host re-provision → snapshot byte-identical./system clock setrefuses dates before package build time).lab-router-certs.shreference line for line (issuance, escaper); secrets never leave mode-600 gitignored files, verified by independent audit of the tree.Findings that changed the design (details in README)
service=attribute is a no-op relic on 7.25.1 — REST rejects the parameter, CLI accepts any value with no effect. The real gate is group policy (api+write). We ship noserviceattribute rather than advertise a wall that does not exist.GET /certificatereportssubject: nullfor all certs via REST; subject proof is the TLS handshake itself./importof a script containing certificate imports answers{}, neverret:true; drivers must not gate on it./system default-configuration custom-scriptis writable only by netinstall, which is why replay testing is bench-scoped.Not exercised here (bench list in BENCH-RUNBOOK.md)
netinstall end-to-end (containers do not netboot), RB5009 factory-config interactions, slow-boot 401 windows (retry logic covers them, not reproduced on fast KVM boots).
Notes
HANDOFF-64.mdkeeps the full v1 (console-era, superseded) and v2 records.bao+python3; no pipeline/runner changes.first-contact.sh is the host twin of the harness chr-launch flow: factory www on the link-local derived by EUI-64 from the router REAL MAC (input FC_MAC, never the official image MAC+1 quirk), admin: blank, early 401s retryable until BOOT_WAIT (classification also probes www-ssl so reruns against a provisioned device exit idempotently). The router pulls the render via /tool/fetch from one-shot-serve.py (one-shot host HTTP server, link-local bind with %zone); /import fires with its response UNTRUSTED (Session closed / 400 / dead connection / {} all expected, since the script disables www and rewrites the executing admin password mid-flight) and success is proven by CA-and-hostname-verified read-back over www-ssl with the new credentials, including cleanup of the fetched key-bearing file. Live-proven on CHR 7.25.1: boot:one green; import answered "Session closed" http=400 while the full protected set landed (HANDOFF-64.md v2). sim/r64-launch.sh is deleted: every provisioning responsibility is now host-side, the container runs the plain mikrotik/chr image, and its one worthwhile idea (early-401 classification retry) lives in first-contact.sh.