25 lines
1.3 KiB
Bash
25 lines
1.3 KiB
Bash
# sftp and scp: upload, download, jump host, IPv6, errors.
|
|
config <<'EOF'
|
|
resolver:
|
|
strategies: [management_subnet, primary_ip]
|
|
management_subnets: [10.231.1.0/24]
|
|
ssh:
|
|
default_user: ops
|
|
rules:
|
|
- match: {kind: vm, instance: fsn}
|
|
proxy_jump: ops@10.231.0.30
|
|
EOF
|
|
echo "payload $$" >"$HOME/up.txt"
|
|
check "scp upload" netssh scp "$HOME/up.txt" fsn/fsn1-pve1.hoster.test:/tmp/up.txt
|
|
expect_eq "uploaded content" "payload $$" netssh fsn/fsn1-pve1.hoster.test cat /tmp/up.txt
|
|
check "scp download" netssh scp fsn/fsn1-pve1.hoster.test:/tmp/up.txt "$HOME/down.txt"
|
|
expect_eq "downloaded content" "payload $$" cat "$HOME/down.txt"
|
|
check "scp to a VM through the bastion" netssh scp "$HOME/up.txt" fsn/web1:/tmp/up.txt
|
|
expect_eq "VM content" "payload $$" netssh fsn/web1 cat /tmp/up.txt
|
|
check "scp to IPv6 host" netssh scp "$HOME/up.txt" fsn/v6-host:/tmp/v6.txt
|
|
expect_eq "IPv6 content" "payload $$" netssh fsn/v6-host cat /tmp/v6.txt
|
|
expect_out "sftp starts in the path" "Remote working directory: /tmp" bash -c 'echo pwd | netssh sftp -b - fsn/fsn1-pve2.hoster.test:/tmp'
|
|
expect_out "sftp to IPv6 host" "v6.txt" bash -c 'echo "ls /tmp" | netssh sftp -b - fsn/v6-host'
|
|
expect_out "sftp through the bastion" "up.txt" bash -c 'echo "ls /tmp" | netssh sftp -b - fsn/web1'
|
|
expect_fail "two remote hosts" "not supported" netssh scp fsn/web1:/a fsn/web2:/b
|