RouterOS 002: Bootstrap netinstall script (boot config v1) #64

Closed
opened 2026-11-14 01:41:03 +00:00 by ginjiruu · 2 comments
Owner

Part of #43

Refs: lab/iac#44, lab/iac#45
Migrated from router-as-code tracker 002 (docs/routeros/tracker in this repo history). Research notes: docs/routeros/notes/.

The bench netinstall Configure script, the only text artifact of the whole
system. ~30 lines, hand-written once, never grows. Everything after it is
Terraform. See note §1 (120 s timeout, reset-rerun semantics) and README
decision 3 (REST rides www-ssl).

Contents

  • /system identity, timezone, note off.
  • Mgmt address on the existing mgmt VLAN/subnet (keep subnets, OpenBao and
    friends must keep resolving — iac#45 comment 10628).
  • admin password + terraform API-only user (restricted group; the user
    Terraform authenticates as), SSH keys for the humans.
  • OpenBao-issued cert, never self-signed (ADR-0009, 2026-11-14). At render time the renderer asks OpenBao (pki-net-caosh, role routeros) for this router's cert and key (<router>.net.caosh.int.animeteamspeak.moe plus its mgmt IP SAN) and embeds them: /certificate import both, then /ip service set www-ssl certificate=<name> disabled=no. That makes the device reachable by the provider, which verifies it against the lab root. Binary api and api-ssl stay disabled. No cert-sign wait on the box any more.
    • The rendered .rsc now holds a private key: never in git, shredded after netinstall.
    • Day 2 renewal is Terraform's (vault_pki_secret_backend_cert -> routeros_system_certificate import -> www-ssl binding), so the cert objects and the www-ssl certificate binding leave the protected set. The bootstrap still enables www-ssl; #74's rollback timer covers a bad rotation.
  • NTP client enable (cert validity needs a synced clock; wait loop ≤30 s).

Rules baked in

  • Self-contained and idempotent: it re-runs after every reset-configuration
    (verified behaviour) and survives upgrades.
  • This script owns the protected set and nothing else: mgmt VLAN/SVI/IP,
    www-ssl, users, SSH keys, identity. No firewall, no VLANs beyond mgmt.

Done when

  • Netinstall to each device (later, via sim first: import into factory CHR,
    #001) boots a device that answers REST at https:///rest with the
    terraform user.
Part of #43 Refs: lab/iac#44, lab/iac#45 Migrated from router-as-code tracker 002 (docs/routeros/tracker in this repo history). Research notes: docs/routeros/notes/. The bench netinstall Configure script, the only text artifact of the whole system. ~30 lines, hand-written once, never grows. Everything after it is Terraform. See note §1 (120 s timeout, reset-rerun semantics) and README decision 3 (REST rides www-ssl). ## Contents - `/system identity`, timezone, note off. - Mgmt address on the existing mgmt VLAN/subnet (keep subnets, OpenBao and friends must keep resolving — iac#45 comment 10628). - `admin` password + `terraform` API-only user (restricted group; the user Terraform authenticates as), SSH keys for the humans. - **OpenBao-issued cert, never self-signed (ADR-0009, 2026-11-14).** At render time the renderer asks OpenBao (`pki-net-caosh`, role `routeros`) for this router's cert and key (`<router>.net.caosh.int.animeteamspeak.moe` plus its mgmt IP SAN) and embeds them: `/certificate import` both, then `/ip service set www-ssl certificate=<name> disabled=no`. That makes the device reachable by the provider, which verifies it against the lab root. Binary `api` and `api-ssl` stay disabled. No cert-sign wait on the box any more. - The rendered `.rsc` now holds a private key: never in git, shredded after netinstall. - Day 2 renewal is Terraform's (`vault_pki_secret_backend_cert` -> `routeros_system_certificate` import -> `www-ssl` binding), so the cert objects and the `www-ssl` certificate binding leave the protected set. The bootstrap still enables `www-ssl`; #74's rollback timer covers a bad rotation. - NTP client enable (cert validity needs a synced clock; wait loop ≤30 s). ## Rules baked in - Self-contained and idempotent: it re-runs after every `reset-configuration` (verified behaviour) and survives upgrades. - This script owns the protected set and nothing else: mgmt VLAN/SVI/IP, www-ssl, users, SSH keys, identity. No firewall, no VLANs beyond mgmt. ## Done when - Netinstall to each device (later, via sim first: `import` into factory CHR, #001) boots a device that answers REST at https://<mgmt-ip>/rest with the terraform user.
Author
Owner

Bootstrap v2 delivered in PR #112 (branch routeros-bootstrap-64): host-driven REST first-contact + netinstall-cli driver, sim-proven on CHR 7.25.1, audited. Notable: per-user service= is a no-op relic on 7.25.1; group policy api+write is the real REST gate. Bench items (netinstall e2e, RB5009 factory-config) listed in BENCH-RUNBOOK.md; netinstall defaults to wipe. Awaiting review before merge.

Bootstrap v2 delivered in PR #112 (branch routeros-bootstrap-64): host-driven REST first-contact + netinstall-cli driver, sim-proven on CHR 7.25.1, audited. Notable: per-user service= is a no-op relic on 7.25.1; group policy api+write is the real REST gate. Bench items (netinstall e2e, RB5009 factory-config) listed in BENCH-RUNBOOK.md; netinstall defaults to wipe. Awaiting review before merge.
Author
Owner

Bench outcome 2026-11-16 (closed by #112; follow-ups #113-#115):

  • netinstall-cli 7.24.2 with -r -s installs the bootstrap on all three devices: rb5009-a HMK0BE3QXBH, rb5009-b HMK0BD2DJXG, crs309 HD608FYE951. check-suite all pass against the production root (OpenBao pki-net-caosh certs). Builds after 2026-09-04 loop on BOOTP; -s alone keeps the old config; -e with -s is refused.
  • Recovery address replaces the mgmt address in the bootstrap (#114): rb5009 ether8 .61/.62, crs309 ether1 .63, 192.168.88.0/24, no gateway; roots import it.
  • Button-free netboot: device-mode advanced + routerboard=yes (power cycle confirms), then boot-device=try-ethernet-once-then-nand and reboot.
  • Passwords in OpenBao secret/routeros-secrets, read by mini ESO through the openbao store (#115, clusters#1702).
  • Not proven on hardware: slot replay after reset-configuration (runbook 6.4).
Bench outcome 2026-11-16 (closed by #112; follow-ups #113-#115): - netinstall-cli 7.24.2 with `-r -s` installs the bootstrap on all three devices: rb5009-a HMK0BE3QXBH, rb5009-b HMK0BD2DJXG, crs309 HD608FYE951. check-suite all pass against the production root (OpenBao pki-net-caosh certs). Builds after 2026-09-04 loop on BOOTP; `-s` alone keeps the old config; `-e` with `-s` is refused. - Recovery address replaces the mgmt address in the bootstrap (#114): rb5009 ether8 .61/.62, crs309 ether1 .63, 192.168.88.0/24, no gateway; roots import it. - Button-free netboot: device-mode `advanced` + `routerboard=yes` (power cycle confirms), then `boot-device=try-ethernet-once-then-nand` and reboot. - Passwords in OpenBao secret/routeros-secrets, read by mini ESO through the `openbao` store (#115, clusters#1702). - Not proven on hardware: slot replay after reset-configuration (runbook 6.4).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/iac#64
No description provided.