On 22/09/14 14:05, Chris Green wrote:
On Mon, Sep 22, 2014 at 01:58:00PM +0100, Laurie Brown wrote:
On 22/09/14 13:49, Chris Green wrote:
[SNIP]
As I have pointed out in a previous reply this doesn't work because of the ProxyAddress stuff I have in my ~/.ssh/config file. I need some way to switch the ProxyCommand off when I'm on the LAN.
Why not have two such files, each specific to a particular location, and write a bash script with a parameter to copy over your ~/.ssh/config file whichever version you need? I really don't understand the problem here.
Fine, it's just the sort of thing I was thinking of doing. My question was really how to automate the switch over by (somehow) detecting whether I'm connected to the LAN or not.
1) Scan you network & look at the results. 2) Lookup your IP address via ifconfig or similar, or whatismyip.com or whatever one of the miriad of servers is called that do that for you, and see which address range it falls into and deduce you location from that. 3) Ping your server by it's local network IP address - if it fails, you're not at home, and deduce your location from that. 4) use dnsmasq, interrogate your dns name and deduce your location from that 5) traceroute to your server - if it gets there in one hop, you're on your lan. if not, deduce your location from that. 6) have a bash script called athome which sets environmental variables, or creates a file, both of wihc can be easily checked for in other scripts like you're proposing. Also have a script called onboat which sets different values. They you only have to run this once, then your other scripts will work properly.
One of those ideas might work perhaps. Steve