postal icon indicating copy to clipboard operation
postal copied to clipboard

Can't connect to SMTP

Open Razva opened this issue 9 years ago • 7 comments

Hey,

I cannot connect to Postal using SMTP, the error is "connection refused". Tried both 25 and 2525. This is a fresh Postal install. No other firewall "in front" of this VM.

Here's some debug info:

root@server:~# ufw disable
Firewall stopped and disabled on system startup
root@server:~# iptables -L -n -v
Chain INPUT (policy ACCEPT 38 packets, 7028 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 37 packets, 7128 bytes)
 pkts bytes target     prot opt in     out     source               destination
root@server:~# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:5000          0.0.0.0:*               LISTEN      1173/[postal] web.1
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      198/beam.smp
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      459/mysqld
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      491/nginx -g daemon
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN      312/epmd
tcp        0      0 0.0.0.0:65432           0.0.0.0:*               LISTEN      199/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      799/master
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      491/nginx -g daemon
tcp6       0      0 :::5672                 :::*                    LISTEN      198/beam.smp
tcp6       0      0 :::80                   :::*                    LISTEN      491/nginx -g daemon
tcp6       0      0 :::4369                 :::*                    LISTEN      312/epmd
tcp6       0      0 :::65432                :::*                    LISTEN      199/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      799/master
tcp6       0      0 :::443                  :::*                    LISTEN      491/nginx -g daemon
udp        0      0 137.74.100.55:123       0.0.0.0:*                           303/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           303/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           303/ntpd
udp6       0      0 fe80::5ce3:abff:fe2:123 :::*                                303/ntpd
udp6       0      0 ::1:123                 :::*                                303/ntpd
udp6       0      0 :::123                  :::*                                303/ntpd
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING     183385004 981/systemd         /run/user/0/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     183367966 1/init              /run/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     183367969 1/init              /run/systemd/journal/stdout
unix  2      [ ACC ]     STREAM     LISTENING     183368578 1/init              /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     183368579 1/init              /run/uuidd/request
unix  2      [ ACC ]     STREAM     LISTENING     183378410 459/mysqld          /var/run/mysqld/mysqld.sock
unix  2      [ ACC ]     STREAM     LISTENING     183378831 799/master          public/pickup
unix  2      [ ACC ]     STREAM     LISTENING     183378835 799/master          public/cleanup
unix  2      [ ACC ]     STREAM     LISTENING     183378838 799/master          public/qmgr
unix  2      [ ACC ]     STREAM     LISTENING     183378842 799/master          private/tlsmgr
unix  2      [ ACC ]     STREAM     LISTENING     183378845 799/master          private/rewrite
unix  2      [ ACC ]     STREAM     LISTENING     183378848 799/master          private/bounce
unix  2      [ ACC ]     STREAM     LISTENING     183378851 799/master          private/defer
unix  2      [ ACC ]     STREAM     LISTENING     183378854 799/master          private/trace
unix  2      [ ACC ]     STREAM     LISTENING     183378857 799/master          private/verify
unix  2      [ ACC ]     STREAM     LISTENING     183378860 799/master          public/flush
unix  2      [ ACC ]     STREAM     LISTENING     183378863 799/master          private/proxymap
unix  2      [ ACC ]     STREAM     LISTENING     183378866 799/master          private/proxywrite
unix  2      [ ACC ]     STREAM     LISTENING     183378869 799/master          private/smtp
unix  2      [ ACC ]     STREAM     LISTENING     183378872 799/master          private/relay
unix  2      [ ACC ]     STREAM     LISTENING     183378875 799/master          public/showq
unix  2      [ ACC ]     STREAM     LISTENING     183378878 799/master          private/error
unix  2      [ ACC ]     STREAM     LISTENING     183378881 799/master          private/retry
unix  2      [ ACC ]     STREAM     LISTENING     183378884 799/master          private/discard
unix  2      [ ACC ]     STREAM     LISTENING     183378887 799/master          private/local
unix  2      [ ACC ]     STREAM     LISTENING     183378890 799/master          private/virtual
unix  2      [ ACC ]     STREAM     LISTENING     183378893 799/master          private/lmtp
unix  2      [ ACC ]     STREAM     LISTENING     183378896 799/master          private/anvil
unix  2      [ ACC ]     STREAM     LISTENING     183378899 799/master          private/scache
unix  2      [ ACC ]     STREAM     LISTENING     183378902 799/master          private/maildrop
unix  2      [ ACC ]     STREAM     LISTENING     183378905 799/master          private/uucp
unix  2      [ ACC ]     STREAM     LISTENING     183378908 799/master          private/ifmail
unix  2      [ ACC ]     STREAM     LISTENING     183378911 799/master          private/bsmtp
unix  2      [ ACC ]     STREAM     LISTENING     183378914 799/master          private/scalemail-backend
unix  2      [ ACC ]     STREAM     LISTENING     183378917 799/master          private/mailman
unix  2      [ ACC ]     STREAM     LISTENING     183404933 1167/app)           /tmp/postal/pids/procodile.sock
root@server:~# systemctl status postal
* postal.service - Postal Mail Platform
   Loaded: loaded (/etc/systemd/system/postal.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2017-08-10 15:39:07 EEST; 52min ago
  Process: 1152 ExecStop=/usr/bin/postal stop (code=exited, status=0/SUCCESS)
  Process: 1158 ExecStart=/usr/bin/postal start (code=exited, status=0/SUCCESS)
 Main PID: 1167 (procodile)
   CGroup: /system.slice/postal.service
           |-1167 [procodile] Postal (/opt/postal/app)
           |-1173 [postal] web.1
           |-1175 [postal] worker.1 (i
           |-1178 [postal] cron.1
           `-1184 [postal] requeuer.1

Aug 10 15:39:07 server systemd[1]: Stopped Postal Mail Platform.
Aug 10 15:39:07 server systemd[1]: Starting Postal Mail Platform...
Aug 10 15:39:07 server postal[1158]: Started Procodile supervisor with PID 1167
Aug 10 15:39:07 server systemd[1]: Started Postal Mail Platform.
root@server:~#

Any hints?

Thank you, Razvan

Razva avatar Aug 10 '17 13:08 Razva

Help

Me to!!

What are we missing??

On Aug 10, 2017 9:33 AM, "Razvan Rosca" [email protected] wrote:

Hey,

I cannot connect to Postal using SMTP, the error is "connection refused". Tried both 25 and 2525. This is a fresh Postal install. No other firewall "in front" of this VM.

Here's some debug info:

root@server:~# ufw disable Firewall stopped and disabled on system startup root@server:~# iptables -L -n -v Chain INPUT (policy ACCEPT 38 packets, 7028 bytes) pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 37 packets, 7128 bytes) pkts bytes target prot opt in out source destination root@server:~# netstat -lnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 1173/[postal] web.1 tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 198/beam.smp tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 459/mysqld tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 491/nginx -g daemon tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 312/epmd tcp 0 0 0.0.0.0:65432 0.0.0.0:* LISTEN 199/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 799/master tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 491/nginx -g daemon tcp6 0 0 :::5672 :::* LISTEN 198/beam.smp tcp6 0 0 :::80 :::* LISTEN 491/nginx -g daemon tcp6 0 0 :::4369 :::* LISTEN 312/epmd tcp6 0 0 :::65432 :::* LISTEN 199/sshd tcp6 0 0 ::1:25 :::* LISTEN 799/master tcp6 0 0 :::443 :::* LISTEN 491/nginx -g daemon udp 0 0 137.74.100.55:123 0.0.0.0:* 303/ntpd udp 0 0 127.0.0.1:123 0.0.0.0:* 303/ntpd udp 0 0 0.0.0.0:123 0.0.0.0:* 303/ntpd udp6 0 0 fe80::5ce3:abff:fe2:123 :::* 303/ntpd udp6 0 0 ::1:123 :::* 303/ntpd udp6 0 0 :::123 :::* 303/ntpd Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path unix 2 [ ACC ] STREAM LISTENING 183385004 981/systemd /run/user/0/systemd/private unix 2 [ ACC ] STREAM LISTENING 183367966 1/init /run/systemd/private unix 2 [ ACC ] STREAM LISTENING 183367969 1/init /run/systemd/journal/stdout unix 2 [ ACC ] STREAM LISTENING 183368578 1/init /var/run/dbus/system_bus_socket unix 2 [ ACC ] STREAM LISTENING 183368579 1/init /run/uuidd/request unix 2 [ ACC ] STREAM LISTENING 183378410 459/mysqld /var/run/mysqld/mysqld.sock unix 2 [ ACC ] STREAM LISTENING 183378831 799/master public/pickup unix 2 [ ACC ] STREAM LISTENING 183378835 799/master public/cleanup unix 2 [ ACC ] STREAM LISTENING 183378838 799/master public/qmgr unix 2 [ ACC ] STREAM LISTENING 183378842 799/master private/tlsmgr unix 2 [ ACC ] STREAM LISTENING 183378845 799/master private/rewrite unix 2 [ ACC ] STREAM LISTENING 183378848 799/master private/bounce unix 2 [ ACC ] STREAM LISTENING 183378851 799/master private/defer unix 2 [ ACC ] STREAM LISTENING 183378854 799/master private/trace unix 2 [ ACC ] STREAM LISTENING 183378857 799/master private/verify unix 2 [ ACC ] STREAM LISTENING 183378860 799/master public/flush unix 2 [ ACC ] STREAM LISTENING 183378863 799/master private/proxymap unix 2 [ ACC ] STREAM LISTENING 183378866 799/master private/proxywrite unix 2 [ ACC ] STREAM LISTENING 183378869 799/master private/smtp unix 2 [ ACC ] STREAM LISTENING 183378872 799/master private/relay unix 2 [ ACC ] STREAM LISTENING 183378875 799/master public/showq unix 2 [ ACC ] STREAM LISTENING 183378878 799/master private/error unix 2 [ ACC ] STREAM LISTENING 183378881 799/master private/retry unix 2 [ ACC ] STREAM LISTENING 183378884 799/master private/discard unix 2 [ ACC ] STREAM LISTENING 183378887 799/master private/local unix 2 [ ACC ] STREAM LISTENING 183378890 799/master private/virtual unix 2 [ ACC ] STREAM LISTENING 183378893 799/master private/lmtp unix 2 [ ACC ] STREAM LISTENING 183378896 799/master private/anvil unix 2 [ ACC ] STREAM LISTENING 183378899 799/master private/scache unix 2 [ ACC ] STREAM LISTENING 183378902 799/master private/maildrop unix 2 [ ACC ] STREAM LISTENING 183378905 799/master private/uucp unix 2 [ ACC ] STREAM LISTENING 183378908 799/master private/ifmail unix 2 [ ACC ] STREAM LISTENING 183378911 799/master private/bsmtp unix 2 [ ACC ] STREAM LISTENING 183378914 799/master private/scalemail-backend unix 2 [ ACC ] STREAM LISTENING 183378917 799/master private/mailman unix 2 [ ACC ] STREAM LISTENING 183404933 1167/app) /tmp/postal/pids/procodile.sock root@server:~# systemctl status postal

  • postal.service - Postal Mail Platform Loaded: loaded (/etc/systemd/system/postal.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2017-08-10 15:39:07 EEST; 52min ago Process: 1152 ExecStop=/usr/bin/postal stop (code=exited, status=0/SUCCESS) Process: 1158 ExecStart=/usr/bin/postal start (code=exited, status=0/SUCCESS) Main PID: 1167 (procodile) CGroup: /system.slice/postal.service |-1167 [procodile] Postal (/opt/postal/app) |-1173 [postal] web.1 |-1175 [postal] worker.1 (i |-1178 [postal] cron.1 `-1184 [postal] requeuer.1

Aug 10 15:39:07 server systemd[1]: Stopped Postal Mail Platform. Aug 10 15:39:07 server systemd[1]: Starting Postal Mail Platform... Aug 10 15:39:07 server postal[1158]: Started Procodile supervisor with PID 1167 Aug 10 15:39:07 server systemd[1]: Started Postal Mail Platform. root@server:~#

Any hints?

Thank you, Razvan

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/atech/postal/issues/306, or mute the thread https://github.com/notifications/unsubscribe-auth/AMMA53v7QDXnls10US8hX4YCe4G9LB7kks5sWwacgaJpZM4Ozbkn .

shopglobal avatar Aug 10 '17 13:08 shopglobal

Locally I can connect to localhost:

root@server:~# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 server.localdomain ESMTP Postfix (Debian/GNU)
root@server:~# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 server.localdomain ESMTP Postfix (Debian/GNU)

But not by using the public IP:

root@server:~# telnet 137.74.100.55 25
Trying 137.74.100.55...
telnet: Unable to connect to remote host: Connection refused

Razva avatar Aug 10 '17 13:08 Razva

@Razva Your netstat suggests that you have something that isn't postal listening on port 25. Your telnet suggests that that something is postfix.

Try disabling postfix with something like systemctl stop postfix; systemctl disable postfix

@shopglobal I suggest you try telnet and post screenshots of what happens in your issue https://github.com/atech/postal/issues/293

willpower232 avatar Aug 10 '17 14:08 willpower232

@willpower232 understood, I was thinking that Postal is using Postfix in order to relay messages. Any hint on how to enable 2525 as well? Iptables redirect or can I set Postal to listen on that as well? Thank you so much!

Razva avatar Aug 10 '17 14:08 Razva

Our postal runs on port 25 as standard but we use iptables to forward 2525 to it

/sbin/iptables -t nat -I PREROUTING -d 172.31.30.15 -p tcp -m tcp --dport 2525 -j DNAT --to-destination 172.31.30.15:25
/sbin/iptables -t nat -I OUTPUT     -d 172.31.30.15 -p tcp -m tcp --dport 2525 -j DNAT --to-destination 172.31.30.15:25

Replace 172.31.30.15 with your own internal IP address.

We have this in a bash script running at boot. You can verify the rules are in place with iptables -nvL -t nat.

willpower232 avatar Aug 10 '17 14:08 willpower232

Our postal runs on port 25 as standard but we use iptables to forward 2525 to it

/sbin/iptables -t nat -I PREROUTING -d 172.31.30.15 -p tcp -m tcp --dport 2525 -j DNAT --to-destination 172.31.30.15:25
/sbin/iptables -t nat -I OUTPUT     -d 172.31.30.15 -p tcp -m tcp --dport 2525 -j DNAT --to-destination 172.31.30.15:25

Replace 172.31.30.15 with your own internal IP address.

We have this in a bash script running at boot. You can verify the rules are in place with iptables -nvL -t nat.

Just curious:

Wil port 25 stop working if I do this?

navinp avatar Sep 06 '20 13:09 navinp

@willpower232 I tried it, and now BOTH 25 and 2525 are open and working. Cool.

navinp avatar Sep 06 '20 14:09 navinp