Files
ssh-netbox-wrapper/CHANGELOG.md
T
Sebastian UnterschützandClaude Opus 5.5 1660bb3098
Test / test (pull_request) Successful in 4m15s
feat: NetBox insights, host tools and configurable TUI
- info/open/whois: NetBox details (site, nested locations, rack units,
  role, platform, tenant, IPs per interface), web page, reverse IP lookup
- cache status, site, role, platform, tenant, location chain and rack;
  ask before connecting to hosts in ssh.warn_status (--force skips)
- ssh rules and command restrictions match site/role/platform/tenant/status
- tui.columns selects what the TUI shows; optional TCP reachability column;
  detail view (Ctrl+L), NetBox page (Ctrl+G), status/location filters
- resolver.fallback tries other strategies' addresses when unreachable
- copy-id, known-hosts reset and address-change notices
- export ansible (YAML/INI) and export ssh-config
- token: keyring stores NetBox tokens in the system keyring
- fix stale menu number in testenv configure test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 12:33:59 +01:00

177 lines
17 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Changelog
## v1.2.0
- Add `netssh info HOST` and `Ctrl+L` in the TUI: site, rack/U, role, platform, tenant, device type, serial, VM resources and all IP addresses per interface from NetBox; `--json` for scripts.
- Add `netssh open HOST` and `Ctrl+G` in the TUI to open the host's NetBox page (`--print` prints the URL).
- Add `netssh whois ADDRESS|HOSTNAME`: the device or VM, interface, DNS name and containing prefixes of an address across all NetBox instances, plus matching cached hosts.
- Cache NetBox ID, status, site, role, platform and tenant. Ask before connecting to hosts whose status is in `ssh.warn_status` (default: offline, planned, staged, failed, inventory, decommissioning); `--force` skips the question, non-interactive callers get a warning. The TUI shows a status badge and filters by `status:`, `site:`, `role:`, `platform:` and `tenant:`.
- `ssh.rules` and command restrictions match `site`, `role`, `platform`, `tenant` and `status` (name or slug), e.g. legacy key exchange for `platform: junos`. The wizard edits the new selectors.
- Show where a device is: site › all nested NetBox locations › rack › rack unit. `netssh info` and the TUI detail view add `Location`, `Rack` (units, height, face) and `Path`; the TUI gets a `location` column and `location:`/`rack:` filters; Ansible exports add `netbox_location`, `netbox_rack`, `netbox_position` and `--group-by location,rack`. Each location is fetched once per run.
- Add `tui.columns` to choose what the TUI shows next to each host and in which order: `alias`, `ip`, `kind`, `source`, `status`, `site`, `location`, `role`, `platform`, `tenant`, `cluster`, `tags`, `reachability` (default `[alias, ip, source, status]`). Also in `netssh configure`.
- Optional TUI reachability check (`reachability` column, off by default): listed hosts are probed on their SSH port and marked ✓/✗ (`tui.reachability_timeout`); hosts behind a jump host are skipped.
- Add `resolver.fallback`: when the chosen address does not answer, connect to the first answering address of the other strategies (or the other primary IP) for this connection.
- Add `netssh copy-id` to run ssh-copy-id with netssh's address, user, port, jump host and options, for single hosts, `tag:`, `cluster:` and `@group`.
- Report changed host addresses on connect and in `netssh cache refresh`, offer to remove the old known_hosts entry, and add `netssh known-hosts reset HOST...`.
- Add `netssh export ansible` (YAML or INI inventory with groups by tag/site/role/platform/… and `netbox_*` host variables) and `netssh export ssh-config`.
- Add keyring token storage: `token: keyring` reads the NetBox token from the system keyring; `netssh token set|migrate|delete|status` manage it, `netssh doctor` checks it.
## v1.1.0
- Add local post-disconnect/post-command scripts, execution timeouts, cancellation, per-command confirmation and host restrictions.
- Add configurable recent-host count, persistent favorites/pins, a TUI command menu and cache/live/stale indicators.
- Add doctor/explain diagnostics, parallel batch commands with failed-host retry, and optional bounded local action history.
- Add configuration export/import that excludes credentials and executable settings while preserving matching local credentials.
- Preserve terminal behavior and process exit status during supervised execution; test Bash/Python scripts, process cancellation, concurrency and batch retries.
## v1.0.0
- Consolidate the complete project into the initial v1 commit.
- Add configurable local host commands and automatically generated aliases, such as `mxg1` for `mtr` on host shortcut `xg1`. Commands resolve the destination at invocation using the configured resolver strategy.
- Support executable scripts and interpreter-based scripts, host/address placeholders, extra arguments, dry runs, and configuration through `netssh configure`.
- Include all previous SSH, SFTP/SCP, forwarding, multi-session, NetBox instance, shortcut, and security improvements.
## v0.0.29
- Add `ssh.pre_connect`: a shell command run locally before every connection (ssh, sftp, scp, tunnel), e.g. to check a VPN. A non-zero exit aborts the connection. Layered like `proxy_jump` (global → instance or static host → rules, `none` disables an inherited hook); the host is passed as `NETSSH_HOST`, `NETSSH_TARGET`, `NETSSH_INSTANCE`, `NETSSH_IP`, `NETSSH_KIND`, `NETSSH_TAGS`, `NETSSH_CLIENT`. Editable in `netssh configure`, also `NETSSH_SSH_PRE_CONNECT`. `--dry-run` shows it without running it.
- Add `shortcuts.show`: shows each host's shortcut alias (e.g. `fsnbx1` for `fsn1-bx1.hoster.de`) in the TUI and as an `ALIAS` column in `netssh cache list` and `netssh hosts list`, and offers shortcuts in Tab completion even when the full name matches. `--aliases` shows the column for a single call. Editable in `netssh configure`, also `NETSSH_SHORTCUTS_SHOW`.
## v0.0.25
- Security: `netssh.yaml` is read from the user config directory only. A file of that name in the working directory (e.g. of a cloned repository) was loaded when no user config existed, and could set ssh options such as `ProxyCommand` or a NetBox URL.
- Security: an address from NetBox or the cache that is neither an IP address nor a hostname is refused. A value such as `-oProxyCommand=…` was passed to ssh as an option.
- The resolver chain stops at an API failure instead of trying the next strategy. Before, a NetBox error in `management_subnet` or `interface_name` connected to the primary IP and cached it. A strategy that finds no address (including a missing interface) still falls through. Note: a token without permission to read IP addresses now gives an error instead of silently using `primary_ip`.
- `netssh --help` and `netssh -h` show netssh's help instead of `unknown option --help` and ssh's usage.
- Background cache refreshes are started at most every 5 minutes. While NetBox was unreachable, every command and every new shell started another one.
- `netbox.url` is validated like the URLs of named instances (HTTP or HTTPS, no query or fragment).
- Hosts with more than 100 IP addresses: all pages are read, so `management_subnet` no longer misses addresses.
- CI: tests, `go vet`, and a format check run on pull requests and pushes to `main`.
## v0.0.24
- Fix the `interface_name` resolver strategy: it sent filter names that NetBox ignores and therefore returned the host's first IP address instead of the named interface's. It now uses NetBox's `interface` and `vminterface` filters; a missing interface falls through to the next strategy.
- Fix `netssh sftp` and `netssh scp` with instance-qualified hosts (`prod/web01:/path`), which were taken for local paths.
- Fix shell aliases of instance-qualified hosts ignoring anchored rewrite rules (`fsn_fsn1-pve1` instead of `fsn_fsnpve1`).
- Add `netssh multi` to open several hosts side by side in tmux or zellij: host lists, `tag:`, NetBox virtualization clusters (`cluster:`, devices by default, `--kind vm|all`), and groups from the config (`@name`). `--sync` sends typing to all panes; `netssh sync` toggles it later. In the TUI, `Space` marks hosts and `Enter` opens them together. Configurable in `netssh configure` (multiplexer, panes per window, groups).
- tmux keys for broadcast in `netssh multi` windows: prefix `S` toggles all panes, prefix `e` excludes the current pane (border `[SOLO]`) or includes it again; also `netssh sync --pane`. Both keys are unbound in a default tmux, are not bound if your tmux.conf uses them, act only in netssh windows, and can be changed or turned off (`multi.sync_key`, `multi.solo_key`).
- `netssh multi` widens the status bar of its own tmux session, which tmux otherwise cuts to `[netssh-pv`.
- Cache entries remember the NetBox cluster of a host, for `cluster:` completion and offline use.
- Add `testenv/`, a local Docker environment with two NetBox instances, SSH targets, a jump host, tmux, zellij, and bash/zsh/fish, and 185 end-to-end checks of all features, including `netssh multi` with real tmux and zellij and screenshot checks of what a real terminal (xterm) renders (`testenv/up.sh`, `testenv/test.sh`). Not part of CI/CD.
## v0.0.23
- `netssh configure` now covers every setting: after the instances, a menu opens with SSH defaults, SSH options (jump host, host key checking, connection target, address family, extra arguments, `-o` options), SSH rules (add, edit, remove by tag, instance, kind, name pattern), resolver & cache (including the cache file), shortcuts & command alias, and completion (`max_results`). SSH options can also be set per NetBox instance from the instance list.
- Fix `netssh configure` dropping global SSH options, `ssh.rules`, and `completion.max_results` from the config file when saving.
- The configurator validates SSH options and rules before writing the config.
- Add `shortcuts.rewrites`: regex rules that shorten hostnames, e.g. `^([a-z]+)[0-9]+-` → `$1` turns `fsn1-bx1.hoster.de` into `fsnbx1`. Shortcuts work for connecting, shell aliases, and Tab completion (offered when the full name does not match), and can be edited in `netssh configure`.
- Add `netssh alias --test HOSTNAME` to show the shortcut of a name and the cached hosts it matches.
- Add `netssh sftp` and `netssh scp`: host lookup, shortcuts, instances, default user and port, SSH options and rules, jump host, `--dry-run`, and completion work as for ssh. IPv6 addresses are bracketed for host:path.
- Add named port forwards (`ssh.forwards` globally, per instance, and per rule), `netssh tunnel HOST NAME|SPEC...` (ssh -N with ExitOnForwardFailure), and `netssh --forward NAME`. Forwards are editable in `netssh configure` and completed in the shell.
- TUI: `Ctrl+O` opens SFTP, `Ctrl+T` starts a tunnel with configured or ad hoc forwards.
- Add the `hostname` resolver strategy: connect by the NetBox name (plus optional `resolver.hostname_domain`) instead of an IP, always or as a fallback after `primary_ip`.
- Add static hosts (`hosts:`) for machines that are not in NetBox, with user, port, tags, and SSH options, managed with `netssh hosts list|add|remove` and in `netssh configure`. They are found before NetBox, work offline and without any NetBox, and support shortcuts, rules (`kind: static`), completion, aliases, sftp, scp, tunnels, and the TUI.
- Fix options added by netssh landing after `--` (`netssh --no-jump -- host`), where ssh read them as the destination.
## v0.0.22
- Fix shell completion with multiple NetBox instances: typing a hostname without an instance prefix (`fsn1-bx1<Tab>`) found nothing in bash and zsh, because only `prod/…` was offered. Hostnames that are unique across all instances are now offered without the prefix; connecting to them still checks every instance for ambiguous names.
- zsh also accepts instance-qualified matches for the typed hostname, so names that exist in several instances are offered as `prod/…` and `stg/…`.
## v0.0.21
- Ship a zsh completion script built for large caches: 5000 hosts complete in under 0.1 s instead of hanging for seconds with Cobra's generated script.
- Add `completion.max_results` to limit the number of hostnames offered per completion.
- Register zsh completion in the managed `.zshrc` block (`fpath` and `compdef`), also when `compinit` already ran, e.g. with oh-my-zsh. The installer reports which completions it set up.
- Add `netssh uninstall [--keep-config] [--dry-run] [--yes]` to remove the binary, profile entries of all versions, completions, cache, and config (with a private backup).
- Write marked `# >>> netssh >>>` blocks from `netssh hook install` and the wizard, replacing unmarked entries of older versions instead of appending.
- Add jump host support: `ssh.proxy_jump` globally, per NetBox instance, and per rule, plus `--jump HOST` and `--no-jump`.
- Add `ssh.host_key_checking` (`strict`, `accept-new`, `off`) for netssh connections only.
- Add `ssh.target: name|hostname` so `~/.ssh/config` host patterns apply and known_hosts entries belong to the device, and `ssh.address_family`.
- Add `ssh.options` and `ssh.extra_args`, and `ssh.rules` that match by tag, instance, kind, or name pattern.
- Add `netssh --version` / `netssh version` and `netssh --dry-run` to print the final ssh command.
## v0.0.20
- Configure multiple named NetBox instances and search them together in parallel.
- Add, edit, and remove instances in the interactive setup wizard while retaining legacy single-instance configuration support.
- Display instance-qualified hostnames and support `instance/hostname` for SSH, completion, aliases, and notes.
- Keep credentials, IP resolution, comments, cache entries, and local notes tied to the correct instance.
- Preserve partial interactive search results with an outage warning; reject incomplete full refreshes and ambiguous direct connections.
- Add `cache refresh --instance NAME` and isolate caches when configured endpoints change.
- Add regression tests covering duplicate names and IDs across instances, outages, SSH routing, notes, aliases, and configuration round trips.
## v0.0.19
- Update Ultraviolet to commit `a45b7c8`.
## v0.0.18
- Require Go 1.27.3 and migrate Bubbles, Bubble Tea, Huh, and Lip Gloss to their v2 modules under `charm.land`.
- Update TUI rendering and keyboard events for Bubble Tea v2 while preserving alternate-screen behavior.
- Route paste events to the focused editor, size input fields explicitly, and keep host lists within the terminal height.
- Reject ambiguous cached shortcuts and skip duplicate hostnames during cache refresh.
- Use paginated, unambiguous host lookups for SSH connections.
- Accept shortcut domains with or without a leading dot during cold lookups.
- Parse combined SSH options and preserve explicit users and ports supplied through `-o`.
- Merge cache changes under a file lock to preserve updates from concurrent processes.
- Honor configured resolver strategies during refresh and remove entries that no longer resolve safely.
- Check the host kind before reusing a cached IP for a TUI selection.
## v0.0.17
- Update Go module dependencies to the latest versions within their existing module paths, including used transitive test dependencies.
- Remove obsolete indirect requirements and refresh module checksums with `go mod tidy`.
## v0.0.16
- Enable Bash, Zsh, and Fish completion for the configured command alias, such as `j`.
- Update or remove generated alias completion files when the command alias changes.
## v0.0.15
- Use `https://git.zb-server.de` for release download links and API requests instead of the runner's internal Gitea service URL.
## v0.0.14
- Enable Renovate updates for indirect Go modules as well as direct dependencies and CI actions.
- Enable Go version updates and keep Go module metadata tidy after dependency updates.
- Correct direct and indirect dependency declarations in `go.mod`.
- Include `install.sh` as a downloadable release asset.
- Include the installer in `checksums.txt` alongside the platform binaries.
- Link the installation command in release notes directly to the release's installer asset.
- Generate a change list from commits since the previous version tag for every release.
## v0.0.13
- Translate the remaining German setup message and test example into English.
- Correct the connection editor comment to reference `Ctrl+E`.
## v0.0.12
- Support updating an existing installation by running the installer again.
- Remove the installer's Python dependency.
- Require valid SHA-256 checksums before replacing the binary.
- Check required programs before downloading and list missing dependencies.
- Check for `sudo` before downloading when the installation directory requires elevated permissions.
- Consolidate legacy shell hooks and aliases in Bash, Zsh, and Fish profiles.
- Back up changed profiles and preserve symlinks and file permissions.
- Regenerate aliases and completions during installation and updates.
- Add a configurable command alias, such as `j`, to the setup wizard.
- Refresh or remove the generated command alias when its configuration changes.
## v0.0.11
- Add multiline local server notes and optional NetBox comments in the TUI.
- Add CLI commands to show, replace, and append server notes.
- Keep local notes separate from the host cache, with private permissions and atomic writes.
- Use NetBox ETags for comment conflict protection when supported by the server.
- Correct authentication for NetBox v2 tokens.
- Fix environment variable overrides for configuration keys.
- Preserve usage history when refreshing cached hosts.
- Discard stale TUI search results and use `Ctrl+E` for connection editing.
- Validate port overrides and preserve an explicit port 22.
- Resolve stale and live TUI selections through the configured resolver chain.
- Reject incomplete full cache refreshes and avoid marking filtered refreshes as full refreshes.
- Stop interpreting remote command flags as SSH options when applying defaults.