Is it possible to redirect ssh traffic (not forward), How?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












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






share|improve this question





















  • Like a redirection rule in a firewall on Server A?
    – Kusalananda
    Jun 21 at 9:46










  • I don't think this is offered by the standard ssh tools.
    – Tomasz
    Jun 21 at 11:52










  • I'd rather try to use HTTP instead of SSH.
    – Tomasz
    Jun 21 at 11:54











  • @Tomasz it has to be over SSH
    – Ezwig
    Jun 21 at 12:28














up vote
2
down vote

favorite












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






share|improve this question





















  • Like a redirection rule in a firewall on Server A?
    – Kusalananda
    Jun 21 at 9:46










  • I don't think this is offered by the standard ssh tools.
    – Tomasz
    Jun 21 at 11:52










  • I'd rather try to use HTTP instead of SSH.
    – Tomasz
    Jun 21 at 11:54











  • @Tomasz it has to be over SSH
    – Ezwig
    Jun 21 at 12:28












up vote
2
down vote

favorite









up vote
2
down vote

favorite











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






share|improve this question













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








share|improve this question












share|improve this question




share|improve this question








edited Jun 21 at 10:54









Jeff Schaller

30.8k846104




30.8k846104









asked Jun 21 at 9:41









Ezwig

320212




320212











  • Like a redirection rule in a firewall on Server A?
    – Kusalananda
    Jun 21 at 9:46










  • I don't think this is offered by the standard ssh tools.
    – Tomasz
    Jun 21 at 11:52










  • I'd rather try to use HTTP instead of SSH.
    – Tomasz
    Jun 21 at 11:54











  • @Tomasz it has to be over SSH
    – Ezwig
    Jun 21 at 12:28
















  • Like a redirection rule in a firewall on Server A?
    – Kusalananda
    Jun 21 at 9:46










  • I don't think this is offered by the standard ssh tools.
    – Tomasz
    Jun 21 at 11:52










  • I'd rather try to use HTTP instead of SSH.
    – Tomasz
    Jun 21 at 11:54











  • @Tomasz it has to be over SSH
    – Ezwig
    Jun 21 at 12:28















Like a redirection rule in a firewall on Server A?
– Kusalananda
Jun 21 at 9:46




Like a redirection rule in a firewall on Server A?
– Kusalananda
Jun 21 at 9:46












I don't think this is offered by the standard ssh tools.
– Tomasz
Jun 21 at 11:52




I don't think this is offered by the standard ssh tools.
– Tomasz
Jun 21 at 11:52












I'd rather try to use HTTP instead of SSH.
– Tomasz
Jun 21 at 11:54





I'd rather try to use HTTP instead of SSH.
– Tomasz
Jun 21 at 11:54













@Tomasz it has to be over SSH
– Ezwig
Jun 21 at 12:28




@Tomasz it has to be over SSH
– Ezwig
Jun 21 at 12:28










2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










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)






share|improve this answer





















  • 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 at 13:27

















up vote
1
down vote













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).






share|improve this answer























  • 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 at 13:22











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f451056%2fis-it-possible-to-redirect-ssh-traffic-not-forward-how%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










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)






share|improve this answer





















  • 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 at 13:27














up vote
1
down vote



accepted










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)






share|improve this answer





















  • 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 at 13:27












up vote
1
down vote



accepted







up vote
1
down vote



accepted






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)






share|improve this answer













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)







share|improve this answer













share|improve this answer



share|improve this answer











answered Jun 21 at 13:11









Joe M

5964




5964











  • 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 at 13:27
















  • 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 at 13:27















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 at 13:27




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 at 13:27












up vote
1
down vote













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).






share|improve this answer























  • 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 at 13:22















up vote
1
down vote













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).






share|improve this answer























  • 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 at 13:22













up vote
1
down vote










up vote
1
down vote









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).






share|improve this answer















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).







share|improve this answer















share|improve this answer



share|improve this answer








edited Jun 21 at 12:41


























answered Jun 21 at 12:36









Tomasz

8,01552560




8,01552560











  • 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 at 13:22

















  • 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 at 13:22
















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 at 13:22





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 at 13:22













 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f451056%2fis-it-possible-to-redirect-ssh-traffic-not-forward-how%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay