Skip to content

Instantly share code, notes, and snippets.

@gregswift
Created March 3, 2017 03:52
Show Gist options
  • Save gregswift/75e55a742aec2eecafab1531a22cc06b to your computer and use it in GitHub Desktop.
Save gregswift/75e55a742aec2eecafab1531a22cc06b to your computer and use it in GitHub Desktop.
balabit ssh wrapper
function enable-bastion() {
function ssh() {
if [[ $1 == \-v* ]]; then
VERBOSITY=${1}
TARGET=${2}
else
unset VERBOSITY
TARGET=${1}
fi
[ -z "$SSO" ] && SSO=${USER}
[[ $TARGET != *"@"* ]] && TARGET=${SSO}@${TARGET}
[ -z "$BASTION" ] && set-bastion
/usr/bin/ssh ${VERBOSITY} gu=${SSO}@${TARGET}@${BASTION}
}
}
function disable-bastion() {
unset -f ssh
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment