testenv/ starts two real NetBox 4.7 instances (v2 and v1 token), SSH targets on public, mgmt, and prod networks, a jump host, an IPv6-only host, a static host, and a client with ssh, sftp, scp, tmux, zellij, bash, zsh, and fish. A seed script fills NetBox through the REST API. 141 end-to-end checks cover cache and refresh filters, connecting, all resolver strategies, multiple instances, shortcuts and rewrites, SSH options and rules, static hosts, sftp/scp incl. IPv6 and jump hosts, tunnels, local notes and NetBox comments, completion and shell hooks, the TUI (driven through tmux), the configurator, and uninstall. Local only: testenv/up.sh, test.sh, shell.sh, down.sh. Not part of CI/CD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.8 KiB
Bash
35 lines
1.8 KiB
Bash
# Jump hosts, rules, host key checking, connection target, options, extra args.
|
|
known="$HOME/known_hosts"
|
|
config <<EOF
|
|
cache: {ttl: 0}
|
|
resolver: {strategies: [primary_ip]}
|
|
ssh:
|
|
default_user: ops
|
|
options:
|
|
UserKnownHostsFile: $known
|
|
ServerAliveInterval: "30"
|
|
extra_args: ["-T"]
|
|
rules:
|
|
- match: {tag: web}
|
|
proxy_jump: ops@10.231.0.30
|
|
- match: {tag: pve}
|
|
proxy_jump: ops@10.231.0.30
|
|
host_key_checking: strict
|
|
- match: {name: "fsn1-pve2*"}
|
|
host_key_checking: accept-new
|
|
- match: {name: "fsn1-pve3*"}
|
|
host_key_checking: "off"
|
|
target: name
|
|
EOF
|
|
expect_eq "rule by tag adds jump host" "ssh -T -l ops -J ops@10.231.0.30 -o serveraliveinterval=30 -o userknownhostsfile=$known 10.231.2.21" netssh --dry-run fsn/web1
|
|
expect_eq "connect through rule jump" "web1" netssh fsn/web1 hostname
|
|
expect_out "--no-jump removes it" "-o ProxyJump=none" netssh --dry-run --no-jump fsn/web1
|
|
expect_out "--jump overrides it" "-J ops@10.231.0.30" netssh --dry-run --jump ops@10.231.0.30 fsn/v6-host
|
|
expect_fail "strict rejects an unknown host key" "Host key verification failed" netssh fsn/fsn1-pve1.hoster.test hostname
|
|
expect_eq "later rule accept-new wins" "fsn1-pve2" netssh fsn/fsn1-pve2.hoster.test hostname
|
|
expect_out "accept-new stored the key" "10.231.2.12" cat "$known"
|
|
expect_out "off prints a notice" "host key checking is disabled" netssh fsn/fsn1-pve3.hoster.test hostname
|
|
expect_out "target name keeps the address" "-o HostName=10.231.2.13 -o HostKeyAlias=fsn1-pve3.hoster.test" netssh --dry-run fsn/fsn1-pve3.hoster.test
|
|
expect_out "target name destination" " fsn1-pve3.hoster.test" netssh --dry-run fsn/fsn1-pve3.hoster.test
|
|
expect_out "user -o wins over config" "-o ServerAliveInterval=5" netssh --dry-run -o ServerAliveInterval=5 fsn/web1
|