Telnet inner-workings: Is telnet server necessary if client connects to an HTTP server? - telnet

One way to quickly test the first-order functionality of a web server is to use the application layer tool Telnet, e.g. How to send an HTTP request using Telnet.
This is the usage I am most familiar with, but today I learned there is such a thing as a Telnet server: https://askubuntu.com/questions/668725/how-can-the-telnet-service-on-ubuntu-server-14-04-lts-be-enabled, which listens on the well-known port 23 and can be used (though not usually, due to its lack of security) as a remote shell.
I am trying to understand if a Telnet server is necessary if I use it to connect to an HTTP server on port 80, e.g.,
telnet 192.168.0.5 80
Does the Telnet client first connect to the telnet server on port 23, then somehow the server's Telnet process then establish a connection to port 80 on localhost? Or does the client directly connect to the HTTP server (or some other TCP/IP server, for that matter) on 80, without need the Telnet server to be present at all?
I could not immediately find a piece of Telnet documentation that explains how Telnet works in this regard; their scarcity might be attributed to Telnet's lack of security...

Related

Telnet to a port that is already in use

I'm trying to use telnet to check if the port of an application is open.
But i'm receiving the following error:
Connecting To 192.168.1.10...Could not open connection to the host, on port 3001: Connect failed
I assume the port is closed, but is it also possible the port is being in use by another program? Hence why i'm not able to test using telnet?
Now if this is the case, how come some ports allow simultaneous connections from clients and some don't?
All ports allow simultaneous connections from clients when some program is listing on that port. Connect failed means that the port is not listening or a firewall interfered.
You can find out if that port is open by using netstat or on Windows tcpview.

FreeSWITCH: Unable to connect from browser(WebRTC) behind enterprise firewall

I am running a FreeSWITCH server on a public domain. I am able to make call from my browser(WebRTC with sipjs) to the FreeSWITCH server from a direct Internet connection.
I am testing it on a Firewall that allows only TCP on port 443. I am running a separate TURN server. I am trying to connect from my browser by specifying TURN server with credentials. I am unable to make it work. PeerConnection is getting closed.
FreeSWTICH server is NOT behind Firewall
Client(browser) is behind Firewall
TURN server is available
Is there any configuration I have to do either in FreeSWITCH server or in the client end(javascript) to make it work?
You need to open UDP ports, cause signalling will go via WSS and media via UDP ports:
mod_sofia to serve SIP signaling via WSS and media via SRTP/DTLS.
https://www.packtpub.com/books/content/configuring-freeswitch-webrtc
Yes, you can use a TURN server. You will have to configure it to listen on port 443 with TCP, because by default a TURN server listens on port 3478.
However, if the Firewall checks for a TLS connection (i.e. for HTTPS), you will have to configure the TURN server as a TURNS (TURN over TLS).

Checking if a port is open through the firewall, that has no listener service actually listening

I have a Windows 2008 R2 server that will need to listen on a particular port (e.g. 1234) in order for an application upgrade to work, but currently the application doesn't have a listener service configured for port 1234.
Our firewall is managed by a third party, but I would like to check in advance that the port 1234 has been opened before I install the update. Is this possible?
I know I can telnet to the server on other listening ports, but as this server has no application listening to 1234 I can't be certain that it is in fact, open. Telnet results are inconsistent when connecting to ports that are apparently listening in netstat.
Is there anything I can do in Powershell or VB for instance, to set up a listener for port 1234 in advance of the upgrade to ensure it will go smoothly?
Many thanks in advance.
Anything that accepts traffic would work.
Run some other service on port 1234 and see if you can connect to that.
Use a network sniffer like WireShark on the server and see if you're getting connection attempts to port 1234.
Install netcat on the server and tell it to listen to port 1234 then connect to that port on the firewall. If it connects, the port is open. (This is really the same as #1 but without an actual service.)

Telnet - why I can connect despite shortage telnet server

On Linux, when I connect from telnet from one server (client telnet) to another (there isn't telnet server) I can connect on port, which I specify (not default for telnet 23 port). I get:
Connected to myserver (ip adress).
Escape character is '^]'.
Why, despite I haven't telnet server, I can connect with telnet client?
You can telnet to any opening TCP port, because that only means a normal TCP connection initiation work has done.
And your input will be treated as raw data, what happens to the data depends on the program which opened that TCP port, normally as soon as it determined the client side is not sending correct data it will disconnect.

netstat says 443 is open, but I cannot connect to it with telnet .. why?

I've built a self hosted wcf server, using wsHttpBinding. I'm running Win 2003 server R2 SP2.
If I configure it to listen on http://localhost:443/MyService, everything works fine. I can connect to http://localhost:443/MyService with Internet Explorer, and I get the standard "Bad Request" message
Now, if I try to switch to HTTPS, I'm witnessing a strange phenomenon.
Here's what I've done :
I've changed my wcf config file from http://localhost to https://localhost and from Security=None to Security=Transport (as explained in numerous wcf tutorials)
I've registered my HTTP port like this :
httpcfg delete ssl -i 0.0.0.0:443
httpcfg set ssl -i 0.0.0.0:443 -h ea2e450ef9d4...
Note that the certificate I've used is a "real certificate" (i.e. issued by a trusted CA, namely Comodo). The server responds to ping on the NS mentioned in the certificate.
Now, the following will timeout :
Microsoft Telnet> open localhost 443
Here's the output from netstat (The Pid '4' is the 'System' process):
netstat -nao
Proto Local Adress Remote Adress State Pid
TCP 0.0.0.0:443 0.0.0.0:0 Listening 4
And here's a screenshot from TCPView captured when I issued the open command in telnet :
alt text http://img26.imageshack.us/img26/3376/tcpview2si6.jpg
I'm a bit puzzled. To me, if netstat says the server is listening on 443, the telnet connection to 443 shouldn't timeout, and I should have at least a blank prompt, expecting me to type some encrypted stuff :)
So far I've tried to :
Redo all the steps from scratch following exactly the MSDN tutorial
Used port 10443 instead of 443
Disable the firewall
Use a self signed certificate
I don't know what to try next .. any ideas?
The telnet client is not going to know to send a properly constructed request to initiate an https handshake, so I imagine the ssl secured server is just waiting for more data.
The telnet client is certainly not going to know what to do with the response from a ssl secured server (it's certainly not going to prompt you for data to send along). Communication can only happen once the https handshake has completed.
You need to use a client that knows how to do a handshake. The openssl binary can do this out of the box.
Telnet cannot be used to comunicate with encrited webs.
Checkout this microsfot note. It says "NOTE: This example assumes that the Web server is configured to use the default HTTP port (TCP 80). If the Web server is listening on a different port, substitute that port number in the first line of the example. Also, this example does not work properly over an HTTPS/SSL connection (TCP 443, by default), because the telnet client cannot negotiate the necessary encryption commands to establish the SSL session. Although an initial connection is possible over the HTTPS/SSL port, no data is returned when you issue a GET request."
Update: Checkout this other note HOW TO: Determine If SSL Connectivity Is Not Working on the Web Server or on an Intermediate Device
As FerrariB said, telnet does not perform the negotiations necessary to open an SSL connection. Telnet knows nothing about certificates, nor encryption. Thus, you are guaranteed to not be able to communicate with HTTPS port 443 via telnet. You will have to find another way to do whatever you are trying to do.
Check out the Wikipedia page on TLS for example, where it says directly:
If any one of the above steps fails, the TLS handshake
fails, and the connection is not created.
This is precisely what you are seeing by trying to use telnet to communicate with an SSL endpoint.
in command prompt: netstat -nao |find "443"
the last columns show a number:
pic no.1
Now open task manager.find result number in 1st section in pid column (if pid wasn't enabled, choose it from view tab) program name show the program which uses the port.
disable the program that uses the port /in my case I stopped it from services