Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to SMTP #306

Closed
Razva opened this issue Aug 10, 2017 · 7 comments
Closed

Can't connect to SMTP #306

Razva opened this issue Aug 10, 2017 · 7 comments

Comments

@Razva
Copy link

Razva commented Aug 10, 2017

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

@shopglobal
Copy link

shopglobal commented Aug 10, 2017 via email

@Razva
Copy link
Author

Razva commented Aug 10, 2017

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

@willpower232
Copy link
Collaborator

@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 #293

@Razva
Copy link
Author

Razva commented Aug 10, 2017

@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!

@willpower232
Copy link
Collaborator

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.

@navinp
Copy link

navinp commented Sep 6, 2020

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
Copy link

navinp commented Sep 6, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants