Last active
October 28, 2022 03:00
-
-
Save tristanmorgan/b3a25bc346a73cdfe4d76521c637fa2c to your computer and use it in GitHub Desktop.
ssh/config with proxy environment switch.
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
Host * | |
StrictHostKeyChecking no | |
ServerAliveInterval 60 | |
FingerprintHash md5 | |
VisualHostKey yes | |
ControlPath /tmp/%r@%h:%p | |
IdentityFile ~/.ssh/id_rsa | |
Host github.com | |
ControlMaster auto | |
ControlPersist yes | |
Match Host github.com exec "env | fgrep -q HTTPS_PROXY" | |
User git | |
HostName ssh.github.com | |
Port 443 | |
ProxyCommand /usr/bin/nc -x 127.0.0.1:3128 -X connect %h %p | |
Host bastion 35.201.4.241 | |
HostName 35.201.4.241 | |
Port 22 | |
Host 10.0.0.* | |
ProxyJump bastion |
P.S. "nc" does the job that we used to use corkscrew for....
P.P.S. has ProxyJump
been around for long? skips the classic ProxyCommand ssh -W %h:%p -q bastion
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The magic I'm trying to achieve is to use a tunnel through a proxy only if the proxy env var is set. Assuming the proxy refuses to connect to non-http ports, github provides ssh on port 443 if you connect to the alternative host ssh.github.com