Skip to main content

Ssh Key Inventory

@svendowideit/ssh-key-inventoryv2026.10.24.2· MIT· 1d agoBEHAVIORSWORKFLOWSREPORTS
01README

Inventory, assess and safely replace SSH private keys across every host your control account can reach, with an HTML report and per-key remediation advice. WHAT IT DOES

Finds private key files and authorized_keys entries on remote hosts over SSH, fingerprints and deduplicates them, scores each unique key for algorithm, size, age, encryption, permissions and reuse, and renders an HTML report showing where each key lives and where it is authorized. It also upgrades a set of hosts to a specified key by adding, testing, then (only after success) removing the old authorized key, with per-host backup and rollback. Host targets accumulate across runs.

INSTALL

swamp extension pull @svendowideit/ssh-key-inventory

DEPENDENCIES

An OpenSSH client (ssh, ssh-keygen) on the machine running swamp, and SSH access (keys or agent) to the target hosts. No other extension.

RUN

# Register hosts (additive across runs).
swamp model @svendowideit/ssh-key-inventory method run add-hosts ssh-keys \
  --input 'hosts:json=["alice@host1.example", "bob@host2.example"]'

# Inventory private keys and authorized keys over SSH.
swamp model @svendowideit/ssh-key-inventory method run inventory ssh-keys

# Write the HTML report.
swamp model @svendowideit/ssh-key-inventory method run report ssh-keys

# Or run the whole sweep workflow.
swamp workflow run @svendowideit/ssh-key-inventory-sweep

# Upgrade selected hosts to a new key (test before removing the old one).
swamp workflow run @svendowideit/ssh-key-upgrade \
  --input 'hosts:json=["alice@host1.example"]' \
  --input newKey=~/.ssh/id_ed25519_new

CONFIGURE

Global arguments (set at creation with --global-arg, or per call with --input):

sshUser           Default user for bare host entries (default: current user)
outputDir         Where the HTML report is written
connectTimeoutSec SSH connect timeout in seconds (default: 10)
keyPaths          Remote directories searched for private keys

WHAT IT INSTALLS

Nothing on remote hosts except timestamped authorized_keys backups during upgrade. It writes swamp resources (hosts, inventory, upgrade) and an HTML report locally.

02Behaviors1
@svendowideit/ssh-key-inventoryv2026.10.24.2ssh_key_inventory.ts

Global Arguments

ArgumentTypeDescription
sshUser?string
outputDir?string
connectTimeoutSec?number
keyPaths?array
includeLocal?boolean
fn add-hosts(hosts: array)
Add user@host targets to the cumulative known hosts list
ArgumentTypeDescription
hostsarray
fn hosts()
Show the known (additive) host list
fn inventory(hosts?: array, includeLocal?: boolean)
Inventory SSH private keys across known (or supplied) hosts
ArgumentTypeDescription
hosts?array
includeLocal?boolean
fn report(outputPath?: string)
Render the inventory to an HTML report file
ArgumentTypeDescription
outputPath?string
fn upgrade(hosts: union, newPrivateKeyPath: string, oldFingerprint?: string, testCommand?: string, removeOld?: boolean)
Add the specified key, test it, then remove the old key
ArgumentTypeDescription
hostsunion
newPrivateKeyPathstring
oldFingerprint?string
testCommand?string
removeOld?boolean

Resources

hosts(infinite)— Additive list of user@host targets
inventory(infinite)— SSH key inventory output
upgrade(infinite)— SSH key upgrade result
03Workflows2
@svendowideit/ssh-key-inventory-sweep42976068-4f52-456e-ad4a-acbbc6bdb73c

Inventory SSH keys across known hosts and write an HTML report.

mainInventory known hosts, then render HTML.
1.inventory— Collect private and authorized keys from known hosts.
2.report— Render the HTML report from the inventory data.
@svendowideit/ssh-key-upgrade2c3c4a52-56c0-4214-b445-bb2026353e75

Upgrade selected hosts to a specified SSH key with tested replacement.

mainUpgrade selected hosts to the new key.
1.upgrade— Add, test, and remove the old key.
04Reports1
@svendowideit/ssh-key-summarymethod
ssh_key_inventory_report.ts

Format SSH key inventory results as a human-friendly summary

sshkeyssecurity
05Stats
A
100 / 100
Downloads
0
Archive size
31.0 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned
06Platforms