Here's a very simple solution if you sometimes have to use corkscrew and sometimes not when you could access the host directly.
I'm using socat to replace the corkscrew call if needed. Please comment if you know a better way.
Here's the script (called it selective-corkscrew):#! /bin/bash refhost="$1" timeout=1 ping -w$timeout -c1 "$refhost" >/dev/null 2>&1 &&\ exec socat - "TCP4:$4:$5" ||\ exec corkscrew "$2" "$3" "$4" "$5"And add this to your ~/.ssh/config. Replace what you have to:
Host *.domain ProxyCommand selective-corkscrew referencehost.domain proxy.domain 3128 %h %p
Corkscrew is now only used if referencehost.domain doesn't answer the ping within 1 second.
If you don't know what's this all about, read this: using-corkscrew-to-tunnel-ssh-over-http!
No comments:
Post a Comment