1

Topic: Am I locked out?.. Client SMTP and telnet gets "Connection Refused"

==== Required information ====
- iRedMail version: 0.9.2
- Linux/BSD distribution name and version: CentOS 6.5 (Final)
- Store mail accounts in which backend: MySQL
- Web server: Nginx
- Manage mail accounts with iRedAdmin-Pro? Not yet.
- Related log if you're reporting an issue: Unknown.
====

I have two VPS setups:

  1. CentOS 6.5 (Final) = Fresh iRedMail setup (Server A below.)

  2. CentOS 6.6 (Final) = Nginx proxy with Node.js services (Server B below.)

My personal computer (with Outlook 2013) connects via IMAP+TLS/SMTP+TLS to Server A and can send/receive mail without any problems... so I don't think my problem is anything with iRedMail.

My Node.js application on Server B uses nodemailer-smtp-transport to connect to the SMTP service on Server A. I think I tried too many attempts against Server A and I think I may have locked Server B out... is this possible? Below is my Node.js application with its output, telnet output from both servers and the /var/log/maillog from Server A.

My Node.js Application

var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');
var emailerTransporter = nodemailer.createTransport(smtpTransport({
    'host':'[Server A hostname]',
    'port':587,
    'auth':{
        'user':'[email]',
        'pass':'[password]'
    },
    'secure':false
}));

emailerTransporter.sendMail({
    "from":'[name] <[email]>',
    "to":'[email]',
    "subject":'[subject]',
    "html":'<h1>test</h1>'
},function(){
    
    console.log(arguments);
    
});

The above Node.js (with some data omitted) results in this:

[dev@nodes ~]# node test.js
{ '0':
   { [Error: connect ECONNREFUSED]
     code: 'ECONNREFUSED',
     errno: 'ECONNREFUSED',
     syscall: 'connect' } }
[dev@nodes ~]#

telnet from Server A

[dev@mail /]# telnet 127.0.0.1 587
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 [Server A hostname] ESMTP Postfix
quit
221 2.0.0 Bye
Connection closed by foreign host.
[dev@mail /]#

telnet from Server B

[dev@nodes ~]# telnet [Server B hostname] 587
Trying [Server B address]...
telnet: connect to address [Server B address]: Connection refused
[dev@nodes ~]#

/var/log/maillog from Server A

[dev@mail /]# cat /var/log/maillog
Aug 24 14:59:57 mail postfix/smtpd[8105]: connect from [Server B hostname][Server B IP address]
Aug 24 14:59:57 mail postfix/smtpd[8105]: lost connection after UNKNOWN from [Server B hostname][Server B IP address]
Aug 24 14:59:57 mail postfix/smtpd[8105]: disconnect from from [Server B hostname][Server B IP address]
Aug 24 14:59:57 mail postfix/smtpd[8103]: connect from from [Server B hostname][Server B IP address]
Aug 24 14:59:57 mail postfix/smtpd[8103]: lost connection after UNKNOWN from [Server B hostname][Server B IP address]
Aug 24 14:59:57 mail postfix/smtpd[8103]: disconnect from from [Server B hostname][Server B IP address]
Aug 24 15:03:12 mail postfix/smtpd[8118]: connect from from [Server B hostname][Server B IP address]
Aug 24 15:03:12 mail postfix/smtpd[8118]: lost connection after UNKNOWN from [Server B hostname][Server B IP address]
Aug 24 15:03:12 mail postfix/smtpd[8118]: disconnect from from [Server B hostname][Server B IP address]
Aug 24 15:05:36 mail postfix/smtpd[8152]: connect from from [Server B hostname][Server B IP address]
Aug 24 15:05:36 mail postfix/smtpd[8152]: lost connection after UNKNOWN from [Server B hostname][Server B IP address]
Aug 24 15:05:36 mail postfix/smtpd[8152]: disconnect from from [Server B hostname][Server B IP address]
Aug 24 18:43:50 mail postfix/smtpd[8524]: connect from localhost[127.0.0.1]
Aug 24 18:43:54 mail postfix/smtpd[8524]: disconnect from localhost[127.0.0.1]
[dev@mail /]#

While I have used the same Node.js code for other SMTP services without any problems, I think while I was adjusting my Node.js configuration I may have tripped a limit with iRedMail?.. is there a log I am missing?.. or could my server with my Node.js applications be blacklisted all together? Sorry ahead if I am missing any important logs or any other helpful information. So far I've really been enjoying iRedMail, such great service!

P.S. When creating a new topic, if I click "Preview topic" then the "Required information" header is prepended into my message box before the original.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Am I locked out?.. Client SMTP and telnet gets "Connection Refused"

4jamesallen wrote:
var emailerTransporter = nodemailer.createTransport(smtpTransport({
    'host':'[Server A hostname]',
    'port':587,

telnet from Server B

[dev@nodes ~]# telnet [Server B hostname] 587
Trying [Server B address]...
telnet: connect to address [Server B address]: Connection refused
[dev@nodes ~]#

According to your nodejs code, you should telnet server A hostname on sever b, why you tried with server b hostname?

please check whether IP of server B is blocked on A. You can check with command "iptables -L -n". If it's blocked, please append IP of B in /etc/fail2ban/jail.local, then restart fail2ban service.

3

Re: Am I locked out?.. Client SMTP and telnet gets "Connection Refused"

ZhangHuangbin wrote:

According to your nodejs code, you should telnet server A hostname on sever b, why you tried with server b hostname?

please check whether IP of server B is blocked on A. You can check with command "iptables -L -n". If it's blocked, please append IP of B in /etc/fail2ban/jail.local, then restart fail2ban service.

Sorry, Server B was telnet-ing to Server A, I made a mistake in my post when I was omitting the hostname and IP addresses.

To update, I tried the same Node.js code this morning and it connected and sent with no problem! I made no changes to any configurations since my original post and I did not find any IP addresses of any of my machines in iptables. Any idea as to what could of refused my machine?

Thank you for your assistance!

4

Re: Am I locked out?.. Client SMTP and telnet gets "Connection Refused"

I guess it's caused by several password failures or other errors caused by nodejs application, and it triggers Fail2ban to block your IP address. After several hours, Fail2ban unban this IP and it works again.

Again, i suggest you whitelist IP of server B in /etc/fail2ban/jail.local ('ignore =') on A.