Networking Forums

Networking Forums > Computer Networking > Linux Networking > (Experiment)Forwarding client data..

Reply
Thread Tools Display Modes

(Experiment)Forwarding client data..

 
 
Martin Holm Pedersen
Guest
Posts: n/a

 
      10-12-2005, 06:24 PM
I have a technical question.
Suppose i make a small program in user-space that does the following:

It makes a listening socket on port 2000(or whatever > 1024) and also
connects to localhost port 22. So it has an inbound and outbound
connection. Theres also a buffer in the program that stores all data
recieved on port 2000 and quickly sends out on port 22.

Will it then be possible to connect with my ssh client on port 2000 and
reach localhost port 22 where my ssh-server listens?

The question goes to if the ssh-host needs the data(be it connection
request or whatever) with a specific timing or sequence for it to
understand the data?

I know it doesn't make that much sense to do it. But it's part of a
grander scheme:-)

Is it possible. What do i need to consider?

Regards
Martin Holm Pedersen
 
Reply With Quote
 
 
 
 
Tauno Voipio
Guest
Posts: n/a

 
      10-12-2005, 06:39 PM
Martin Holm Pedersen wrote:
> I have a technical question.
> Suppose i make a small program in user-space that does the following:
>
> It makes a listening socket on port 2000(or whatever > 1024) and also
> connects to localhost port 22. So it has an inbound and outbound
> connection. Theres also a buffer in the program that stores all data
> recieved on port 2000 and quickly sends out on port 22.
>
> Will it then be possible to connect with my ssh client on port 2000 and
> reach localhost port 22 where my ssh-server listens?
>
> The question goes to if the ssh-host needs the data(be it connection
> request or whatever) with a specific timing or sequence for it to
> understand the data?
>
> I know it doesn't make that much sense to do it. But it's part of a
> grander scheme:-)
>
> Is it possible. What do i need to consider?


You could use the iptables port forwarding to do the trick.

Maybe the simplest is to add your port (be it 54322 or something)
to the SSH port list in the configuration.

If you insist on an userspace daemon, remember to handle
return traffic also.

--

Tauno Voipio
tauno voipio (at) iki fi

 
Reply With Quote
 
Martin Holm Pedersen
Guest
Posts: n/a

 
      10-12-2005, 08:03 PM
I need to do it more or less as i described. The question is if it is
possible without knowing anything about the the data sent by fx. the
ssh-client.

The applikation of the idea is to take det data from the buffer and send
it out via a custom protocol that lies above TCP/IP. The reason for
doing this is to make a robust way of communicating via two ethernet
devices. That is, if one of the devices break down the custom protocol
will send the data via the other device without having to establish the
connection once again ie. in a running ssh-connection.

But it is possible if I also handle th return traffic?

Regards
- Martin

Tauno Voipio wrote:
> Martin Holm Pedersen wrote:
>
>> I have a technical question.
>> Suppose i make a small program in user-space that does the following:
>>
>> It makes a listening socket on port 2000(or whatever > 1024) and also
>> connects to localhost port 22. So it has an inbound and outbound
>> connection. Theres also a buffer in the program that stores all data
>> recieved on port 2000 and quickly sends out on port 22.
>>
>> Will it then be possible to connect with my ssh client on port 2000
>> and reach localhost port 22 where my ssh-server listens?
>>
>> The question goes to if the ssh-host needs the data(be it connection
>> request or whatever) with a specific timing or sequence for it to
>> understand the data?
>>
>> I know it doesn't make that much sense to do it. But it's part of a
>> grander scheme:-)
>>
>> Is it possible. What do i need to consider?

>
>
> You could use the iptables port forwarding to do the trick.
>
> Maybe the simplest is to add your port (be it 54322 or something)
> to the SSH port list in the configuration.
>
> If you insist on an userspace daemon, remember to handle
> return traffic also.
>

 
Reply With Quote
 
Tauno Voipio
Guest
Posts: n/a

 
      10-13-2005, 06:05 AM
Martin Holm Pedersen wrote:
> I need to do it more or less as i described. The question is if it is
> possible without knowing anything about the the data sent by fx. the
> ssh-client.
>
> The applikation of the idea is to take det data from the buffer and send
> it out via a custom protocol that lies above TCP/IP. The reason for
> doing this is to make a robust way of communicating via two ethernet
> devices. That is, if one of the devices break down the custom protocol
> will send the data via the other device without having to establish the
> connection once again ie. in a running ssh-connection.


OK.

Before you get into designing something involved, have a look
at Linux Ethernet bridging <http://bridge.sourceforge.net/>.

It has an automatic mechanism to provide a redundant Ethernet
connection with the STP (Spanning Tree Protocol). The
redundancy is provided on Ethernet layer, so the TCP and
IP layers (and above) do not need to know about it.

> But it is possible if I also handle th return traffic?


Yes. You need two handlers: one in the forward direction
and another in reverse direction.

-

IMHO, you're solving a sergeant's problem with a pair of captains.

The only reason I see for a custom protocol is some kind
of 'security by obscurity'. Even for privacy, the preferred
method is to use a well-tested VPN system, e.g. OpenVPN.

--

Tauno Voipio
tauno voipio (at) iki fi

 
Reply With Quote
 
Martin Holm Pedersen
Guest
Posts: n/a

 
      10-13-2005, 09:50 PM
Ahh.. Sound like just the the thing. Hmm.. Takeovertime of 12 sec..
Well.. Guess thats okay.. Can you force a new path on some event?

Regards
Martin

Tauno Voipio wrote:
> Martin Holm Pedersen wrote:
>
>> I need to do it more or less as i described. The question is if it is
>> possible without knowing anything about the the data sent by fx. the
>> ssh-client.
>>
>> The applikation of the idea is to take det data from the buffer and
>> send it out via a custom protocol that lies above TCP/IP. The reason
>> for doing this is to make a robust way of communicating via two
>> ethernet devices. That is, if one of the devices break down the custom
>> protocol will send the data via the other device without having to
>> establish the connection once again ie. in a running ssh-connection.

>
>
> OK.
>
> Before you get into designing something involved, have a look
> at Linux Ethernet bridging <http://bridge.sourceforge.net/>.
>
> It has an automatic mechanism to provide a redundant Ethernet
> connection with the STP (Spanning Tree Protocol). The
> redundancy is provided on Ethernet layer, so the TCP and
> IP layers (and above) do not need to know about it.
>
>> But it is possible if I also handle th return traffic?

>
>
> Yes. You need two handlers: one in the forward direction
> and another in reverse direction.
>
> -
>
> IMHO, you're solving a sergeant's problem with a pair of captains.
>
> The only reason I see for a custom protocol is some kind
> of 'security by obscurity'. Even for privacy, the preferred
> method is to use a well-tested VPN system, e.g. OpenVPN.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
An interesting little experiment anyone could try Lenny Broadband 5 07-22-2007 07:27 PM
Validating client data newsposter@cox.net Linux Networking 3 01-10-2007 08:31 PM
Setup a wireless network experiment environment Paulour Linux Networking 4 09-08-2005 09:18 AM
Client isolation and software forwarding through linux - Please help! Coenraad Loubser Linux Networking 6 03-01-2005 07:26 PM
My external-antenna experiment on a Linksys wap/router failed! David Cook Wireless Internet 7 11-01-2003 01:53 AM



1 2 3 4 5 6 7 8 9 10 11