2

enter image description here

I am aware that it is possible to forward SSH from server A to server B by creating a tunnel.

What I am asking for is rather the red alternative on the schema above. Can this scenario be implemented:

  1. SSH to server A
  2. Server A tells client to go to server B instead
  3. Server B communicates directly with client over SSH

So basically a sort of proxy that after introducing the client-server to each other, he gets out of the communication.

I imagine using a firewall redirection doesn't offer much customization.

What I seek ultimately is a way to make access through SSH to git mirrors transparent for client depending on geolocation.

Advanced scenario scenario

  1. Client Pulling from server A and is closer to server B is redirected to B
  2. When pushing, client remains on server A
  • Like a redirection rule in a firewall on Server A? – Kusalananda Jun 21 '18 at 9:46
  • I don't think this is offered by the standard ssh tools. – Tomasz Jun 21 '18 at 11:52
  • I'd rather try to use HTTP instead of SSH. – Tomasz Jun 21 '18 at 11:54
  • @Tomasz it has to be over SSH – Ezwig Jun 21 '18 at 12:28
1

Unfortunately there is no flag to turn on in SSH to do this. You'd have to code something custom for GIT. (i.e. if serverA has lower ping time than server B use A or vice vera)

  • The target, is to achieve a setup that is transparent for clients. If i will be doing a customization, i would want it to be on server side – Ezwig Jun 21 '18 at 13:27
1

You can think of this kind of wrapping:

  • servers, or just the main server holds a git transfer initialisation script
  • in the clients, define Git aliases that will get the target server by executing that script on the main server (or any of the servers)

If you only need to redirect pull, then you need one alias. But probably you'll also want to redirect fetch (if not more commands, I'm not that good with Git).

  • I thought about that. The constraint is that client should be agnostic to the change. I was hoping for soething similar to http redirect. Like apache mod_rewrite for http but for ssh. – Ezwig Jun 21 '18 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.