in reply to ssh with IO::Socket::INET

Explanations:
I have a server SW that runs on Linux and listens to port 9000.
The server's aim is to direct TCP session that opens on port 9000 to rs-232 (serial port).
So one could open telnet to the server's IP port 9000 , and he will get the prompt of the serial device (the prompt that you get while connecting through Hyper Terminal).

Now, I would like to use the server, but, instead of opening telnet - opening ssh.
i.e. instead of directing telnet to serial, I would like to direct ssh to serial.
In another words, instead of writing on my Linux "telnet 127.0.0.1 9000", I would like to do "ssh -p 9000 127.0.0.1" or something like that.

I hope it is more clear.

Mosh.

Replies are listed 'Best First'.
Re^2: ssh with IO::Socket::INET
by tachyon (Chancellor) on Nov 01, 2004 at 13:05 UTC

    You want to do some port forwarding by the sound of it. See the appserver example here Another option is stunnel

    cheers

    tachyon

Re^2: ssh with IO::Socket::INET
by iburrell (Chaplain) on Nov 01, 2004 at 17:58 UTC
    If you want the server written in Perl, you will need to write it. Net::SSH::Perl is client only. AFAIK, there is no SSH server implementation in Perl.

    There are other solutions. One is to use SSH port forwarding. Your server listens for telnet or plain socket connections on localhost. SSH is used for the authentication and encryption. This forwards port 9000 on the localhost to 127.0.0.1 port 9000 on the remote host. I have used similar commands to foward rdesktop and VNC connections.

    ssh -f -N -L 9000:127.0.0.1:9000

    An alternative is to make your server into a program that runs on the command line. Then from a normal ssh shell prompt, run your command. You can even have the account automatically run your command.

    BTW, if you are really are on 127.0.0.1, there isn't much point in using SSH. The connection isn't going over the network so security isn't a problem.