novnc / websockify

Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service.
GNU Lesser General Public License v3.0
3.88k stars 768 forks source link

Websockify successfully telnets to a device but no output is shown #216

Open beeelze opened 8 years ago

beeelze commented 8 years ago

I have a couple of switches and routers that have their serial console port connected to a console server. To get console access of those devices I make a websockify connection from my server to the console server + port like this:

websockify 2115 --wrap-mode=respawn < console server ip >:2115 --ssl-only --cert=/etc/ssl/ca-certificates.crt --key=/etc/ssl/private/some.key

The fact that I see a 'Disconnect' button on my webpage tells me that a connection to the device was made. On my ubuntu server a $ netstat -antp shows me the following:

tcp        0      0 < public server ip >:2115      < public client ip >:32163   ESTABLISHED 3504/python 
tcp        0      0 < private server ip >:41522       < console server ip >:2115      ESTABLISHED 3504/python

This tells me the connection from the place I am to the console server + port has been successfully established. Everything seems to be working fine except for the fact that I 'do not always' get a console output. What am I missing here?

beeelze commented 8 years ago

Update:

A lot of devices do give me console output, but some of them don't. What could I check why some devices do work and why some don't?

Doing a regular telnet to the console server + port works for all devices, so it's probably not telnet related.

beeelze commented 8 years ago

bump?

DirectXMan12 commented 8 years ago

Sorry for the delay, your issue caught me right before holiday break ;-). Are you using the sample websockify telnet client? It's possible that there's a bug in that. One thing that you could try would be to use a different websocket client (e.g. https://github.com/progrium/wssh), and see if that still has the issue where you don't get output occasionally.

beeelze commented 8 years ago

Hi @DirectXMan12 , yes I'm using the websockify telnet client: wstelnet.html file. The problem usually occurs when connecting to Ipoman PDU's and several routers and switches. The < span > elements that make up the telnet window stay black even when the button says 'Disconnect'. If I was not clear enough, this is the problem I'm having.

I took a quick look at wssh. With websockify I'm proxying from a port on my Ubuntu server (2115 in my OP) to my console server (< console server ip >:2115 in my OP). How would wssh do the proxying? In the README I only see that it listens on a port:

wssh -l localhost:8000/websocket

Oh, and what could that bug you're talking about be?

Thanks for responding. I hope you had a nice holiday!

beeelze commented 8 years ago

Any news?

kanaka commented 8 years ago

@beeelze telnet is almost but not quite a raw character stream and wstelnet is a very simple demonstration program so it may be the case that some of your systems are using/requiring parts of the telnet protocol that wstelnet has not implemented yet. It would be interesting to enable debugging before you connect and comparing between the systems that work and those that don't.

To enable debugging, load wstelnet.html, open the javascript console, then run this:

WebUtil.init_logging("debug"); 

and then connect and you should get verbose debug information to the javascript console about everything that is sent and received.

beeelze commented 8 years ago

@kanaka The following debug information is what I get when I successfully connect to a PDU for example and then press enter a couple of times, but get no output on screen. It's like the other end doesn't receive any keys or something.

screen shot 2016-01-28 at 11 10 02

And debug information on successful connection with response:

screen shot 2016-01-28 at 11 12 01

What does this tell you?

beeelze commented 8 years ago

I notice a clear difference between the unsuccessful and successful logs, but what actions can I take next according to them? Does getch mean that it is waiting for user input, but that it never receives any and decides to refresh? Or is there perhaps a compatibility issue with the terminal type VT100?

beeelze commented 8 years ago

Has there been any updates on this one?

beeelze commented 8 years ago

It has been quite some time since I've seen replies on my issue. It would be nice if someone would look at the debug output I posted and tell me what the problem could be. So here's another bump :-)