Connection Refuesed while connectiong IMAP and POP3 Servers

8 posts / 0 new
Last post
#1 Wed, 12/12/2012 - 17:36
fobus

Connection Refuesed while connectiong IMAP and POP3 Servers

Hello, I have set up some domains on my server and I have enabled Mail for domain for all domains.

But when I try to connect to IMAP and POP3 server I'm getting this error : ConnectException: Connection refused

I can't find any error report in log files, also I'm not sure about whicg log file to check.

What must be the next step for me? Can you please help me on fixing this error.

Thanks

Operating system Ubuntu Linux 12.04.1 Webmin version 1.610
Virtualmin version 3.97.gpl GPL Theme version 8.5 Kernel and CPU Linux 3.2.0-34-generic on x86_64

Wed, 12/12/2012 - 22:13
andreychek

Howdy,

You'd want to check /var/log/mail.log for errors regarding email.

Also, you may want to verify that Dovecot is running -- you can do that with this command:

/etc/init.d/dovecot restart

Thu, 12/13/2012 - 05:13
fobus

Andrey Thanks for help,

After getting your response, I have restarted dovecot and tried to connect again. Result was the same, connection refused.

Also, There is no new record populated in to /var/log/mail.log the lastest record belongs to 1 hour ago.

Here is log file dump : http://pastebin.com/XrGkMpxm

Thu, 12/13/2012 - 07:08
Locutus

This can have any number of reasons.

From where exactly are you trying to connect to where? Regular or SSL port? Any routers or firewalls involved? Can you ping the server? Are you using IPs or hostnames? Does the hostname resolve?

You might want to check if Dovecot running on your server and listening on all IPs: netstat -tpln | grep 143 should turn up results for Dovecot.

Check if a local firewall is blocking ports: iptables -L -n

Otherwise check with your hoster if ports need to be opened.

Thu, 12/13/2012 - 11:52
fobus

Hello Locutus,

No routers involved, and firewall doesn't block any connection. I'm trying to connect from my local computer to mydomain.com

Dovecot serves mail protocols Pop3 and Imap, as SSL Enabled. I can ping the server. Ip resolves correct host name.

Here is output of netstat and iptables output.

root@mydomain ~ # netstat -tlpn | grep 143
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      7954/dovecot   
tcp6       0      0 :::143                  :::*                    LISTEN      7954/dovecot   
root@mydomain ~ # iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:20000
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:10000
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:443
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:993
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:143
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:995
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:110
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:20
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:21
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:53
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:587
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:25
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination        
Thu, 12/13/2012 - 12:14
fobus

Now, I have realized that I can connect to server on localhot, but It terminates remote connections. Here is http://pastebin.com/tw1WqKaz

It terminates connection after 8-10 secounds.

Thu, 12/13/2012 - 12:17
andreychek

Is this server on an internal LAN, with an internal IP address?

If so, can you try connecting using that internal IP address, rather than the domain name, and see if that makes a difference?

-Eric

Thu, 12/13/2012 - 14:03
Locutus

Uuhm, according to your pastebin, when connecting from the remote site, you connected to port 443? That's HTTPS, why do you connect to that when you want to test IMAP?

I guess it's expected behavior that the HTTPS daemon waits for a few seconds for the client to initiate the SSL setup, and closes the connection when nothing happens. :) HTTPS does not have any "greeting line" from the server.

Topic locked