Page 1 of 1

Closed connection in response to initial connection

Posted: Fri Jun 03, 2016 11:09 pm
by Syeef
Hello.

My mails are getting rejected while sending via exim and then sitting in queue for about 1-2 hours while attempting to resend. After multiple queue runs and rejects, the mails are finally being delivered. Tested with multiple email addresses on different servers, same result. Able to receive mails just fine, only sending issue.

Here is the error from VestaCP:

Code: Select all

Top 50 mail rejection reasons by message count
----------------------------------------------
  Messages   Mail rejection reason
        37   Closed connection in response to initial connection
And in /var/log/exim/main.log:

Code: Select all

2016-06-03 19:46:50 1b8v2Z-0005fP-To == [email protected] R=dnslookup T=remote_smtp defer (-18): Remote host xxxxx.com [69.73.182.77] closed connection in response to initial connection
Also If this helps:

Code: Select all

exim -bhc 69.73.182.77

**** SMTP testing session as if from host 69.73.182.77
**** but without any ident (RFC 1413) callback.
**** This is not for real!

>>> host in hosts_connection_nolog? no (option unset)
>>> host in host_lookup? yes (matched "*")
>>> looking up host name for 69.73.182.77
>>> IP address lookup yielded static-77-182-73-69.nocdirect.com
>>> gethostbyname2 looked up these IP addresses:
>>>   name=static-77-182-73-69.nocdirect.com address=69.73.182.77
>>> checking addresses for static-77-182-73-69.nocdirect.com
>>>   69.73.182.77 OK
>>> host in host_reject_connection? no (option unset)
>>> host in sender_unqualified_hosts? no (option unset)
>>> host in recipient_unqualified_hosts? no (option unset)
>>> host in helo_verify_hosts? no (option unset)
>>> host in helo_try_verify_hosts? no (option unset)
>>> host in helo_accept_junk_hosts? no (option unset)
>>> using ACL "acl_check_spammers"
>>> processing "accept"
>>> check hosts = +whitelist
>>> host in "net-iplsearch;/etc/exim/white-blocks.conf"? no (end of list)
>>> host in "+whitelist"? no (end of list)
>>> accept: condition test failed in ACL "acl_check_spammers"
>>> processing "drop"
>>>   message: Your host in blacklist on this server.
>>> l_message: Host in blacklist
>>> check hosts = +spammers
>>> host in "net-iplsearch;/etc/exim/spam-blocks.conf"? no (end of list)
>>> host in "+spammers"? no (end of list)
>>> drop: condition test failed in ACL "acl_check_spammers"
>>> processing "accept"
>>> accept: condition test succeeded in ACL "acl_check_spammers"
220 host.vengeance2d.com ESMTP Exim 4.84_2 Fri, 03 Jun 2016 22:34:16 +0000
LOG: SMTP command timeout on connection from static-77-182-73-69.nocdirect.com [69.73.182.77]
421 host.vengeance2d.com: SMTP command timeout - closing connection
What I did before discovering this:
- Uninstalled ClamAV from VestaCP using the guide here: viewtopic.php?f=12&t=11279

What could be the issue?

Re: Closed connection in response to initial connection

Posted: Sat Jun 04, 2016 9:50 am
by Syeef
Hello :)
XoXiLhJ0mn wrote:comments in the area acl_check_spammers in exim.conf
...
I wonder why the message "Your host in blacklist on this server." is appearing. Could this be a reason why the initial connection gets dropped?
I wondered that myself.

Anyway, by commenting acl_check_spammers still same result and here is the output:

Code: Select all

exim -bhc 69.73.182.77

**** SMTP testing session as if from host 69.73.182.77
**** but without any ident (RFC 1413) callback.
**** This is not for real!

>>> host in hosts_connection_nolog? no (option unset)
>>> host in host_lookup? yes (matched "*")
>>> looking up host name for 69.73.182.77
>>> IP address lookup yielded static-77-182-73-69.nocdirect.com
>>> gethostbyname2 looked up these IP addresses:
>>>   name=static-77-182-73-69.nocdirect.com address=69.73.182.77
>>> checking addresses for static-77-182-73-69.nocdirect.com
>>>   69.73.182.77 OK
>>> host in host_reject_connection? no (option unset)
>>> host in sender_unqualified_hosts? no (option unset)
>>> host in recipient_unqualified_hosts? no (option unset)
>>> host in helo_verify_hosts? no (option unset)
>>> host in helo_try_verify_hosts? no (option unset)
>>> host in helo_accept_junk_hosts? no (option unset)
220 host.vengeance2d.com ESMTP Exim 4.84_2 Sat, 04 Jun 2016 09:06:00 +0000
LOG: SMTP command timeout on connection from static-77-182-73-69.nocdirect.com [69.73.182.77]
421 host.vengeance2d.com: SMTP command timeout - closing connection
XoXiLhJ0mn wrote:Further, I checked with Mxtoolbox and found that the smtp connection takes too long time to negotiate with static-77-182-73-69.nocdirect.com. Why?
Yeah, that is my old cpanel server, it's a little slow but it works fine, been using that for years now. But as I said, I tried this with other servers also, including gmail, same result, "Closed connection in response to initial connection".

With aspmx.l.google.com:

Code: Select all

exim -bhc 173.194.67.27

**** SMTP testing session as if from host 173.194.67.27
**** but without any ident (RFC 1413) callback.
**** This is not for real!

>>> host in hosts_connection_nolog? no (option unset)
>>> host in host_lookup? yes (matched "*")
>>> looking up host name for 173.194.67.27
>>> IP address lookup yielded wi-in-f27.1e100.net
>>> gethostbyname2 looked up these IP addresses:
>>>   name=wi-in-f27.1e100.net address=173.194.67.27
>>>   name=wi-in-f27.1e100.net address=216.239.32.27
>>> checking addresses for wi-in-f27.1e100.net
>>>   173.194.67.27 OK
>>> host in host_reject_connection? no (option unset)
>>> host in sender_unqualified_hosts? no (option unset)
>>> host in recipient_unqualified_hosts? no (option unset)
>>> host in helo_verify_hosts? no (option unset)
>>> host in helo_try_verify_hosts? no (option unset)
>>> host in helo_accept_junk_hosts? no (option unset)
220 host.vengeance2d.com ESMTP Exim 4.84_2 Sat, 04 Jun 2016 09:11:15 +0000
LOG: SMTP command timeout on connection from wi-in-f27.1e100.net [173.194.67.27]
421 host.vengeance2d.com: SMTP command timeout - closing connection
With 127.0.0.1:

Code: Select all

exim -bhc 127.0.0.1

**** SMTP testing session as if from host 127.0.0.1
**** but without any ident (RFC 1413) callback.
**** This is not for real!

>>> host in hosts_connection_nolog? no (option unset)
>>> host in host_lookup? yes (matched "*")
>>> looking up host name for 127.0.0.1
>>> IP address lookup using gethostbyaddr()
>>> IP address lookup yielded localhost.localdomain
>>>   alias localhost
>>> gethostbyname2 looked up these IP addresses:
>>>   name=localhost.localdomain address=127.0.0.1
>>> checking addresses for localhost.localdomain
>>>   127.0.0.1 OK
>>> gethostbyname2 looked up these IP addresses:
>>>   name=localhost.localdomain address=127.0.0.1
>>> checking addresses for localhost
>>>   127.0.0.1 OK
>>> host in host_reject_connection? no (option unset)
>>> host in sender_unqualified_hosts? no (option unset)
>>> host in recipient_unqualified_hosts? no (option unset)
>>> host in helo_verify_hosts? no (option unset)
>>> host in helo_try_verify_hosts? no (option unset)
>>> host in helo_accept_junk_hosts? no (option unset)
220 host.vengeance2d.com ESMTP Exim 4.84_2 Sat, 04 Jun 2016 09:16:49 +0000
LOG: SMTP command timeout on connection from localhost.localdomain [127.0.0.1]
421 host.vengeance2d.com: SMTP command timeout - closing connection
Between 220 and 421, it takes several minutes to output.

It was working fine before but after making some changes to server like uninstalling ClamAV, I think I screwed up somewhere.

Re: Closed connection in response to initial connection

Posted: Sat Jun 04, 2016 2:59 pm
by Syeef
XoXiLhJ0mn wrote: Did you check in exim.conf that the following is uncommented after uninstalling it?

#SPAMASSASSIN = yes
#SPAM_SCORE = 50
#CLAMD = yes
Since I only uninstalled ClamAV, so I only commented the #CLAMD = yes part. But I also tried commenting all of it before posting here, just in case... no luck.

Don't know what to do, and don't wanna reinstall VestaCP at this time... too much work.

Re: Closed connection in response to initial connection

Posted: Sat Jun 04, 2016 3:33 pm
by Syeef
XoXiLhJ0mn wrote:SMTP TLS Warning - Does not support TLS.
Sorry... when you tested on Mxtoolbox, I think I was trying something and then did a reboot.

My Smtp is fine, here:
Image
XoXiLhJ0mn wrote:And why do you need to open 3306 and have 53 port closed?
Don't know about port 53 (you checked when I did the reboot maybe?), but I closed port 3306 a couple of days ago to stop brute-force attack on MySQL.
XoXiLhJ0mn wrote:Well, in that case you need to actually try to send an email from shell, not just testing with -bhc. See if this goes through and where it hangs. Do this with a verbose output.

Have you done that? Do you know how to do this?
No, I have not done that... and no, I don't know how to do it also. Please advise. Thanks.

Re: Closed connection in response to initial connection

Posted: Sat Jun 04, 2016 3:57 pm
by Syeef
Okay problem is fixed now! Delivers instantly.

What I did before reboot worked:
I removed SpamAssassin once again from exim.conf and in VestaCP, removed AntiVirus Support and AntiSpam Support under Mail, they were both marked yes before. So the problem is either that or SpamAssassin which was causing the delay.

Thanks buddy (XoXiLhJ0mn), for all your help...
in that case you need to actually try to send an email from shell, not just testing with -bhc. See if this goes through and where it hangs. Do this with a verbose output.
^ Still I would like to know how to do that.

Thanks :)

Re: Closed connection in response to initial connection

Posted: Sat Jun 04, 2016 5:24 pm
by Syeef
Well, I am no Linux expert by any means or know that many technical terms... I just know enough to get by, that's all :)

That said, I can confirm now that the issue was caused by SpamAssassin... the delay/connection issue went away as soon as I fully disabled SpamAssassin.