Note

Why h-ssh exists: safe parallel changes on a production backbone

What a fleet change needs around the single device session: probing first, gated writes, and a record of what changed.

6 min read ToolingNetworking

DRAFT, owner to edit. Mock body built from the outline in docs/ux/notes-outlines.md (Story 1) so the layout can be reviewed. Every OWNER item in the outline is still open.

The problem with changing many routers at once

A per-device session is a solved problem. What is left is everything around it. h-ssh runs across one device or three hundred: Juniper, any SSH host, or a console that still speaks telnet.

What goes around the session

Runs are parallel by default behind an asyncio semaphore, with --workers 8 out of the box. Results are collected per device, so one dead box does not sink a run.

Every run probes first, with no login: a TCP connect plus the SSH banner, 100 boxes at a time. A dead box is a FAIL in seconds.

A rate limiter and cooldown (--safety-file) allow 10 attempts per host per 60 s, with a 120 s cooldown after a failure, so a router that already failed is not hammered.

h-ssh --probe
h-ssh -sC "show bgp summary" --every 30 R1:10.0.1.1:junos R2:10.0.1.2:junos

Making a write safe

--dry-run loads the change, diffs it and runs commit_check, then discards the candidate (Junos over NETCONF). --show-diff shows every diff, asks once, and refuses a commit if the device changed since the preview. --commit-confirmed N puts the device back unless you confirm within N minutes.

Every edit prompts y/N. With no terminal and no -y, an edit is refused before anything is sent. Refusals are honest: a transport that cannot honour a flag fails that device with the reason, and never fakes it.

h-ssh --user admin -eC "set system ntp server 10.0.0.1" --dry-run
h-ssh --user admin -eB configs/all.set --commit-confirmed 10 -y

Looking before committing

The two commands above are the pair to remember: preview first, then commit with a confirm window.

A record of what changed

--audit-log appends 0600 JSONL with secret redaction, one entry per device, with diffs for edits. Every run is also kept in ./h-ssh.db, and h-ssh-store reads it back. Exit codes and a structured summary line on stderr make a run scriptable.

[h-ssh] {"targets": 3, "ok": 2, "fail": 1, "skipped": 0, "probe_ms": 512, "elapsed_ms": 812, "mode": "show"}

What it deliberately does not do

OWNER: the limits and non-goals in your own words. The README names Junos-only flags and the licence terms (PolyForm Noncommercial 1.0.0), which matters if the post invites reuse.

Sources

Contact

Most engagements start with a 30-minute call.

Ask AI

Suggestions

Runs on a small LLM I host myself. Honest answers, not marketing. [email protected]