Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenSSL: socket: Connection refused connect:errno=111

Tags:

I am trying to connect to one Linux server from a client,

openssl s_client -connect <IP of Server>:443

I am getting the following error:

socket: Connection refused
connect:errno=111

like image 866
user3345390 Avatar asked Dec 05 '14 08:12

user3345390


2 Answers

Check the ports of the server by any tool. For Example,

 nmap <IP>

Starting Nmap 5.21 ( http://nmap.org ) at 2015-05-05 09:33 IST
Nmap scan report for <IP>
Host is up (0.00036s latency).
Not shown: 996 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
111/tcp open  *****
139/tcp open  *****
443/tcp open  openssl
MAC Address: 18:03:73:DF:DC:62 (Unknown)

Check the port number is in openstate.

like image 102
kayle Avatar answered Sep 22 '22 12:09

kayle


As I mentioned in the comment that the host name is missing. You would mention is right before the port number.

 $ openssl s_client -connect myHost.com:443

Edit: now that you mention that there is a hostname in the command so we are fine there. Now check to see if host/port is blocked. To check you can use nmap or telnet or any other port scanner.

If you can ping / connect to the host but not to the server process available on a particular port then there is a firewall blocking access.

The firewall could be on the host and if iptables is the firewall(assuming Linux) then you need to add a rule to allow the connection. For a quick test, you could disable the firwall (NOT RECOMMENDED). Or you could run the server process on a port that is open.

like image 40
Khanna111 Avatar answered Sep 21 '22 12:09

Khanna111