1

I'm unable to establish a connection to my server's SMTP server, it gets closed immediately.

telnet x.x.x.x 25
Trying x.x.x.x...
Connected to xxxxxx.xxx.
Escape character is '^]'.
Connection closed by foreign host.

Postfix's main.cf configuration:

smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtp_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_use_tls = yes
smtpd_tls_loglevel = 1
smtpd_tls_cert_file = /etc/ssl/certs/postfix.pem
smtpd_tls_key_file = /etc/ssl/private/postfix.pem
smtpd_tls_auth_only = yes
smtp_tls_security_level = may

Maillog (verbose smtpd enabled):

Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: connection established
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: master_notify: status 0
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: name_mask: resource
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: name_mask: software
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: connect from \[xx.xxx.xx.x]
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_list_match: myisphostname: no match
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_list_match: xx.xxx.xx.x: no match
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_list_match: myisphostname: no match
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_list_match: xx.xxx.xx.x: no match
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_hostname: myisphostname ~? 127.0.0.0/8
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_hostaddr: xx.xxx.xx.x ~? 127.0.0.0/8
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_hostname: myisphostname ~? yy.yy.yyy.y/24
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_hostaddr: xx.xxx.xx.x ~? yy.yy.yyy.y/24
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_list_match: myisphostname: no match
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_list_match: xx.xxx.xx.x: no match
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: send attr request = connect
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: send attr ident = smtp:xx.xxx.xx.x
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: private/anvil: wanted attribute: status
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute name: status
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute value: 0
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: private/anvil: wanted attribute: count
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute name: count
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute value: 1
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: private/anvil: wanted attribute: rate
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute name: rate
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute value: 1
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: private/anvil: wanted attribute: (list terminator)
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute name: (end)
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: > myisphostname[xx.xxx.xx.x]: 220 mydomain.com ESMTP Postfix
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: smtp_get: EOF
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_hostname: myisphostname ~? 127.0.0.0/8
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_hostaddr: xx.xxx.xx.x ~? 127.0.0.0/8
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_hostname: myisphostname ~? yy.yy.yyy.y/24
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_hostaddr: xx.xxx.xx.x ~? yy.yy.yyy.y/24
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_list_match: myisphostname: no match
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: match_list_match: xx.xxx.xx.x: no match
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: send attr request = disconnect
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: send attr ident = smtp:xx.xxx.xx.x
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: private/anvil: wanted attribute: status
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute name: status
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute value: 0
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: private/anvil: wanted attribute: (list terminator)
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: input attribute name: (end)
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: lost connection after CONNECT from myisphostname[xx.xxx.xx.x]
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: disconnect from myisphostname[xx.xxx.xx.x]
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: master_notify: status 1
Nov 28 11:08:32 serverhostname postfix/smtpd[2609]: connection closed

closed as off-topic by Jeff Schaller, Stephen Kitt, Stephen Rauch, peterh, GAD3R Dec 3 '17 at 18:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Stephen Kitt, Stephen Rauch
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    How long is 'immediately'? <1 second, >2 seconds? Have you tried type ehlo hostname and hitting enter before it gets closed (assuming it's not literally instantly). – EightBitTony Nov 28 '17 at 13:07
  • The remote host doesn't want SMTP connections from you. The only thing you can do about it is talk to the admin of the remote server to grant you access. – Satō Katsura Nov 28 '17 at 13:32
  • What's the output of cat /etc/postfix/main.cf |grep "mynetworks\|myhostname" ... and netstat -ln |grep ":25\|sasl" – RubberStamp Nov 28 '17 at 14:05
  • Immediately, <1 second, I'm not able to enter any command. The server is my own, I can connect from other locations. This is the output of the netstat command: unix 2 [ ACC ] STREAM LISTENING 523201107 /var/run/saslauthd/mux – Gotenks Nov 28 '17 at 14:23
  • From the lack of seeing port 25 as listening port... it would seem that port 25 is not active on your server. ... just to be sure run it again without the grep ... just ... netstat -ln ... and look for a line that looks like this: tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN ... what other locations have you connected from? – RubberStamp Nov 28 '17 at 14:34
0

Found what the issue was: Little Snitch firewall was blocking connection to the SMTP server.

(facepalm)

Not the answer you're looking for? Browse other questions tagged or ask your own question.