RouterOS SSH host keys: assigned from OpenBao at bootstrap, rendered into known_hosts (SSH CA exception) #41
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lab/machine-configs#41
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Child of the SSH certificate epic lab/machine-configs#19. The permanent RouterOS exception to the host-cert story: RouterOS can neither present nor validate SSH certificates, so the routers need provisioned
known_hostsentries instead of@cert-authoritytrust.Why RouterOS is an exception
Checked 2026-11-17 against the RouterOS 7.26 manual:
/ip/ssh/export-host-key,/ip/ssh/import-host-key). There is noHostCertificateequivalent, so a CA-signed host cert cannot be installed./user/ssh-keys/importper user. NoTrustedUserCAKeysequivalent./ip/ssh/known-hosts) pins rawssh-ed25519/ssh-rsalines only.Without this issue, every OpenSSH box gets TOFU-free trust from the epic, but
ssh admin@rb5009-*andcrs309still prompt (or hard-fail underStrictHostKeyChecking=yes).Design: the host key is assigned, not harvested
Each router gets a host key generated once per device name, stored in OpenBao, and imported by the bootstrap. The device never keeps a key of its own making.
secret/routeros-secretsalready holds its admin and terraform passwords). No new class of secret.Rejected: harvesting the device-generated key (REST
export-host-keyorssh-keyscan). It needs a re-harvest after every re-image, leaves an ambiguous mismatch window, andexport-host-keywrites the private key to flash as a file that would have to be cleaned up each time.Scope
/ip/ssh/import-host-keyaccepts an ed25519 private key generated off-device, the server then presents exactly that key (ssh-keyscanmatches), and the key survives a reboot. If ed25519 import is unsupported, fall back to RSA 4096 and note it here.rb5009-a,rb5009-b,crs309, future devices), created once, kept in Bao (proposedsecret/routeros-secrets/<device>/ssh-host-key, private + public). Never regenerated unless a rotation is intended.import-host-key, delete the file in the same step) before SSH is reachable from anywhere but the bench. Already-deployed routers get it once through the same path; record the date here./etc/ssh/ssh_known_hosts:@cert-authority <fleet domain> <host CA pubkey>for OpenSSH hosts, plus one raw line per router listing every name and address used as an SSH target: canonical name (ADR-0005), VLAN 10 management address, legacy LAN address while it exists (10.15.1.252/.253), and the VLAN 20 router address (10.30.20.2/.3). Example:rb5009-a.net.caosh.int.animeteamspeak.moe,10.15.1.252,10.30.10.2,10.30.20.2 ssh-ed25519 AAAA.... The same file lands on arch-ws via home-manager.StrictHostKeyCheckingstaysyes. Retire theStrictHostKeyChecking=no/UserKnownHostsFile=/dev/nullpaths in Taskfiles wherever the rendered file covers the target (installer and VM bootstrap stay exempt as today).host-key-fingerprintwith the stored public key and alerts on any mismatch.Out of scope: the routers' own SSH client (
/ip/ssh/known-hosts). Nothing scripts out of the routers over SSH; mktxp and terraform use REST with thepki-net-caoshx509 cert.Done when
~/.ssh/known_hosts,ssh -o BatchMode=yes admin@<each name/address>succeeds underStrictHostKeyChecking=yes.docs/ssh-ca.md(from #18) documents the RouterOS exception and the assigned-key design.~/.ssh/known_hosts.Links: epic lab/machine-configs#19, renderer/host side lab/machine-configs#18, OpenBao host signer lab/iac#49, bootstrap lab/iac#64, drift job lab/iac#72.
known_hosts for RouterOS: harvest host keys over REST, distribute fleet-wide (SSH CA exception)to RouterOS SSH host keys: assigned from OpenBao at bootstrap, rendered into known_hosts (SSH CA exception)