29 lines
461 B
Bash
29 lines
461 B
Bash
#! /usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
SCRIPT_NAME="${0##/*}"
|
|
usage() {
|
|
printf '%s\n' \
|
|
'SSH using Teleport with interactive selection and VAST-reasnoble defaults' \
|
|
'' \
|
|
"${SCRIPT_NAME} " \
|
|
'' \
|
|
'Usage:' \
|
|
''
|
|
exit 2
|
|
}
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
usage
|
|
fi
|
|
|
|
SEARCH="$1"
|
|
SSHUSER="${SSHUSER:-vastdata}"
|
|
TUNNEL="${TUNNEL:+-L ${TUNNEL}}"
|
|
|
|
TARGET="${SSHUSER}@$(tsh-get "$SEARCH" "$SSHUSER")"
|
|
|
|
tsh ssh ${TUNNEL} "${TARGET}" "${@:2}"
|
|
|