0

Here's my ssh config:

Host *.*
    ProxyCommand /usr/bin/connect-proxy    -S proxy.home.net:1080 %h %p

It sets a default proxy for domains containing dots. I want to change it to connect directly to hosts matching *.home.net . Is it possible?

basin
  • 514

1 Answers1

0

Negated local domains with exlamation mark:

Host !*.home.net *.*
    ProxyCommand /usr/bin/connect-proxy    -S proxy.home.net:1080 %h %p

This works with version 6.3p1, but not 5.3p1.

Upd: Ultimate solution for old and new ssh

# for old ssh where negations don't work
Host !*.home.net *.home.net
    ProxyCommand ~/.ssh/netcat.sh %h %p

Host !*.home.net *.*
    ProxyCommand /usr/bin/connect-proxy    -S proxy.home.net:1080 %h %p

I don't have nc.exe in my msysgit.

~/.ssh/netcat.sh :

#!/bin/bash
trap '' HUP # because ssh HUPs us after closing our stdin
exec 4<>"/dev/tcp/$1/$2" || exit 1
/bin/cat <&4 &
exec 1>&-
/bin/cat >&4 <&0
exec 0<&-
/bin/sleep 10
# sometime EOF never comes so kill the other cat
kill $!
basin
  • 514