1

I have a client/server application that work over a telnet connection, and it does not support SSH. Basically the client opens a telnet connection to the server, which starts a specific shell, and the client sends commands over the telnet connection to that shell. The problem is that I need to make this work over a ssh connection, and the remote server does not have telnet services, so I cannot use a tunnel over the ssh connection. I need some kind of telnet emulator that will offer a telnet endpoint to the client, while connecting through ssh to the server. Is there any way to do this?

thanks

  • When can’t improve the client and it requires a telnet connection you will probably need to install a telnet server. You can then use port forwarding over SSH to ensure transport encryption (or preferably set up a VPN connection to do the same) and won’t even need to open up the telnet port to the public at large. – HBruijn May 19 '19 at 09:24
  • I know, but installing a telnet server is not an option. That’s why I’m looking for a way to emulate a telnet server that send all commands through ssh to the shell in the remote server. – Jose L Martinez-Avial May 19 '19 at 09:28
  • Why does it need to be ssh, to encrypt it? telnet over TLS (telnets) is a thing. Does the application implement its own telnet server and/or client, or does it just run whatever telnet client binary is available? – John Mahowald May 19 '19 at 17:25
  • The application inplements it’s own telnet client, and on the server side the only connection I’ve got available is SSH – Jose L Martinez-Avial May 19 '19 at 23:31

1 Answers1

2

That's a normal case for port forwarding over ssh.

A server <ip> has ssh endpoint opened and an application server listening on Telnet port 23.

A client has an application client which should connect to <ip>:23. Also client has nothing listening on port 23.

Let's establish port forwarding from server to client:

ssh -N -L 23:127.0.0.1:23 user@<ip> >/dev/null 2>&1 & 

Here we:

  • connect to the server <ip> as user user;
  • put ssh session into background;
  • redirect ssh session's output into /dev/null to avoid any messages on console;
  • forward port 23 from the server's localhost to the client (your application server should listen on all IP interfaces, including 127.0.0.1)

Now application client should connect to the address 127.0.0.1:23 to work with the application server.

Update

As per explanations, we have a telnet only capable client software and ssh only capable server. And client should be able to access the server.

As it happens, such solution does exist. From manual:

SSH/Telnet gateway

In the Telnet-DeleGate (DeleGate server for Telnet clients), a host name prefixed with "-ssh" and "." (as "-ssh.host") implies a SSH server on the host. In access to such a server, Telnet-DeleGate works as a gateway between the SSH server and a Telnet client. For example, using a Telnet-DeleGate configured like follows, Telnet clients can login to a SSH server on host as user as follows:

% delegated -P8023 SERVER=telnet://-ssh
% telnet -l user@host localhost 8023

Meet DeleGate

Sergey Nudnov
  • 833
  • 6
  • 12
  • That would be ok, except for the fact that telnet is no running on the server. That’s why I need to emulate a telnet and send the commands the client generate to the server’s she’ll using ssh – Jose L Martinez-Avial May 21 '19 at 00:04
  • @JoseLMartinez-Avial When your server application is started, which port is it listening on? Also what OS is on the server? – Sergey Nudnov May 21 '19 at 00:53
  • There is no server as such. The applications connects through telnet and runs shell commands and programs. So is no a server per se, just a command shell. The OS is Solaris – Jose L Martinez-Avial May 21 '19 at 09:44
  • @JoseLMartinez-Avial Posted an update. Exactly what you were looking for... – Sergey Nudnov May 21 '19 at 12:32