Score:0

forward all traffic to another machine using reverse ssh

zm flag

I have the following scenario

                                                                                                                  
               Local Network                     |                          Global Network                        
                                                 |                                                                
                                                 |                                                                
                                                 |                                                                
                                                 |                                                                
                                                 |                                                                
                                                 |                                                                
                                                 |                                                                
+------------+              +-----------+        |               +----------+                   +----------------+
|   client A | -----------> |  server A | <--------------------> | server B | --------------->  | Global Network |
+------------+              +-----------+        |               +----------+                   +----------------+
                                                 |                                                                
                                                 |                                                                

The challenge ahead:

Transfer all traffic from server A to server B. Since all tunnel protocols are closed in server A, I thought reverse ssh is a good option.

I use the following command for making reverse ssh: ssh -fNT -R 4000:localhost:22 [email protected] -i <private-key>

Now on server A I can see that port 4000 is opened. but I don't know how to transfer the traffic as a whole to server B

diya avatar
la flag
*"Since all tunnel protocols are closed in server A, I thought reverse ssh is a good option."* - Generally there is a policy/reason for such things and (regardless of your opinions and your inconvenience) circumventing your corporate policy is usually *not* the *good* option. Whatever good intentions you have, what you're actually attempting is often considered [data exfiltration](https://en.wikipedia.org/wiki/Data_exfiltration) ... - And practically speaking, forwarding specific protocol and targeted traffic may be easier.
Arash Sadeghizadeh avatar
zm flag
Yes, or in a situation where everything has been filtered for you I am not referring to a specific country
Score:0
br flag

My immediate thought is to create a tun interface and setup routing appropriately. As you see below from ssh man the following commandline argument is available.

-w local_tun[:remote_tun] Requests tunnel device forwarding with the specified tun(4) devices between >the client (local_tun) and the server (remote_tun). The devices may be specified by numerical ID or the keyword “any”, which >uses the next available tunnel device. If remote_tun is not specified, it >defaults to “any”. See also the Tunnel and TunnelDevice directives in >ssh_config(5).

If the Tunnel directive is unset, it will be set to the default tunnel >mode, which is “point-to-point”. If a different Tunnel forwarding mode it >desired, then it should be specified before -w.

This answer provides more details.

https://unix.stackexchange.com/questions/525217/create-network-interface-from-ssh-tunnel

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.