Created
July 9, 2019 01:30
-
-
Save jufemaiz/46b359863fa5dde2a99c416371cf2cd0 to your computer and use it in GitHub Desktop.
Bastion the easy way!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bastion-the-easy-way.sh | |
# | |
# Allowing you to easily bastion into a remote location! So nice! | |
# | |
# $ bastion path_to_target_key path_to_bastion_key target_ip_address bastion_ip_address target_user bastion_user | |
function bastion { | |
__message='Welcome to bastion the easy way!' | |
ssh -f -i ${2:-$__bastion_key} -L 6969:${3:-$__target_ip_address}:22 ${6:-ec2-user}@${4:-$__bastion_address} echo $__message | |
ssh -i ${1:-$__target_key} ${5:-ec2-user}@localhost -p 6969 -o "UserKnownHostsFile /dev/null" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment