Last active
May 17, 2019 08:34
-
-
Save chunkhang/08e7d1690c708ae7a48339400d0de457 to your computer and use it in GitHub Desktop.
Dynamic SSH config for bastion and private hosts
This file contains hidden or 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
| # Connect to bastion host | |
| # `ssh bastion` | |
| Host bastion | |
| HostName bastion.example.com | |
| User admin | |
| IdentityFile ~/.ssh/bastion.example.com.pem | |
| # Connect to private host through bastion host | |
| # `ssh bastion+ip-1-2-3-4.example.internal` | |
| Host bastion+* | |
| User admin | |
| IdentityFile ~/.ssh/bastion.example.com.pem | |
| ProxyCommand ssh bastion -W $(echo %h | cut -d+ -f2-):%p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment