Skip to content

Instantly share code, notes, and snippets.

@snambi
Last active October 8, 2015 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snambi/355f36ce5a58ffad2fda to your computer and use it in GitHub Desktop.
Save snambi/355f36ce5a58ffad2fda to your computer and use it in GitHub Desktop.
Host domain1
Hostname bastion.domain1.com
forwardagent yes
gatewayports yes
ServerAliveInterval 30
Compression yes
CompressionLevel 4
Port 22
Host domain2
Hostname bastion.domain2.com
forwardagent yes
gatewayports yes
ServerAliveInterval 30
Compression yes
CompressionLevel 4
Port 22
# This makes SSH automatically proxy over a bastion when the host pattern matches
Host *.domain2.com !*bastion*
ProxyCommand ssh snambi@bastion.domain2.com -W %h:%p
Host *.domain1.com !*bastion*
ProxyCommand ssh bastion.domain1.com -W %h:%p
Host ubuntu
IdentityFile ~/.ssh/aws/aws_keypair.pem
HostName ubuntu14.04.domain1.com
User stack
ProxyCommand ssh -W %h:%p phx
Host *
StrictHostKeyChecking no
ControlMaster auto
ControlPath ~/.ssh/sockets/ssh-mux-%h_%p_%r
ControlPersist 600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment