ispCP - Board - Support
[SOLVED]Cannot connect to SMTP remotely - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: Usage (/forum-34.html)
+--- Thread: [SOLVED]Cannot connect to SMTP remotely (/thread-7302.html)



[SOLVED]Cannot connect to SMTP remotely - brianhill1980 - 07-26-2009 12:56 AM

Hi there,

I'm having a bit of a time getting my SMTP server running. I'm using Postfix.

The problem I'm having is remote clients cannot send mail through the server even though they have a valid email address on the server.

Things I can do:
- ping server's ip
- ping server's domain
- Receive IMAP messages using webmail and software
- Send mail through webmail
- Use ssh to connect to server then telnet into SMTP server

Things I CAN'T do:
- telnet into SMTP server for testing from remote pc
- Send mail using software on remote pc (Mail.app, Thunderbird, Outlook, iPhone)

Problems encountered:
- When I try to telnet into the server from a remote computer (telnet brianhillphotography.ca 25) it times out. When I try to telnet from an ssh terminal connected to the server it works.
- Trying to send mail from anywhere but the webmail results in an error saying the server could not be contacted.

Things I've tried:
- Checked configuration of main.cf and master.cf. Settings look to be correct.
- Ran 'dpkg-reconfigure postfix'. Same issue's occuring.


I have a firewall running on the server, but TCP port 25 is open. I've also tried disabling the firewall and I get the same result. Not able to connect. It's like Postfix is rejecting any connections from remote addresses, but I can't figure out why.

Any help would be appreciated. Thanks!


RE: Cannot connect to SMTP remotely - kilburn - 07-26-2009 01:11 AM

First of all, check that postfix is listening in your public address (or all of them-0.0.0.0) using netstat:
Code:
netstat -tlnp

If it's running, try to connect and check the logs for further info:
Code:
tail /var/log/mail.log

The error should show up there. In the case that no connection is shown, something happens with the network. Check if the port is really open using netcat:
Code:
intheserver: /etc/init.d/postfix/stop
intheserver: nc -lp 25   (the command doesn't return)
inyourmachine: echo 'hi' | nc ip.of.the.server 25
"hi" should show up in the server's shell, otherwise it's a network/firewall issue.

Post the results from these tests and let's see if we can identify what's happening Smile

PS: It's great when someone takes it's time to create correct problem descriptions, kudos to you for that! On another occasion tough, try to include some basic info that always helps diagnosing problems: OS/Distro/Version, Ispcp version, and relevant log files (mail.log in this case).


RE: Cannot connect to SMTP remotely - brianhill1980 - 07-26-2009 04:02 AM

Results of netstat:

Quote: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:60000 0.0.0.0:* LISTEN 2031/postgrey.pid -
tcp 0 0 127.0.0.1:10025 0.0.0.0:* LISTEN 8375/master
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1926/mysqld
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 8375/master
tcp 0 0 127.0.0.1:12525 0.0.0.0:* LISTEN 1990/policyd-weight
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1562/portmap
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 8375/master
tcp 0 0 127.0.0.1:690 0.0.0.0:* LISTEN 2210/famd
tcp 0 0 127.0.0.1:9876 0.0.0.0:* LISTEN 2282/ispcp_daemon
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 2222/proftpd: (acce
tcp 0 0 216.19.176.36:53 0.0.0.0:* LISTEN 1830/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1830/named
tcp 0 0 0.0.0.0:24 0.0.0.0:* LISTEN 1844/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 8375/master
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1830/named
tcp 0 0 0.0.0.0:40926 0.0.0.0:* LISTEN 1573/rpc.statd
tcp6 0 0 :::110 :::* LISTEN 2106/couriertcpd
tcp6 0 0 :::143 :::* LISTEN 2088/couriertcpd
tcp6 0 0 :::80 :::* LISTEN 2266/apache2
tcp6 0 0 :::53 :::* LISTEN 1830/named
tcp6 0 0 :::24 :::* LISTEN 1844/sshd
tcp6 0 0 ::1:953 :::* LISTEN 1830/named

I'm guessing it's called 'master'. Seems to be the only service running on port 25.

Trying to send a message this is all that shows up in the logs. It's in both 'mail.log' and 'mail.info'.

Quote:Jul 25 10:15:50 brianhillphotography imapd: Connection, ip=[::ffff:96.48.209.112]
Jul 25 10:15:51 brianhillphotography imapd: LOGIN, user=brian@brianhillphotography.ca, ip=[::ffff:96.48.209.112], port=[56979], protocol=IMAP

I tried that nc thing you told me. Nothing showed up, it eventually timed out.

System Info:
Debian Lenny
APF firewall
IspCP ver. 1.0.0

APF Firewall Rules:
Quote:# Common inbound (ingress) TCP ports
IG_TCP_CPORTS="21,24,25,53,80,110,143,443,993,995,60000"

If there is any other info you need please let me know. Thanks for the help so far.


RE: Cannot connect to SMTP remotely - nuke3d - 07-26-2009 06:17 PM

Is your computer connected via WLAN?
I've had issues with port 25 as well, but only from computers using WLAN... No idea why, maybe the accesspoint filters something on its own.


RE: Cannot connect to SMTP remotely - brianhill1980 - 07-27-2009 01:34 AM

No. My computer at home is connected via ethernet cable to my netgear router. I have, for the sake of testing purposes, connected my computer directly to my modem. So there is nothing that could be blocking the connection. And as I mentioned, it's also happening on my iPhone using the cellular data service.


RE: Cannot connect to SMTP remotely - nuke3d - 07-27-2009 05:46 PM

I'd guess it's your server provider blocking this port. If it's a home server this might be rather normal. Best contact your ISP about this.


RE: Cannot connect to SMTP remotely - brianhill1980 - 07-27-2009 10:54 PM

I highly doubt that it's my provider. I work for a small ISP, which is where I'm hosting my server, and they don't filter or block any ports. I'll double check, but I'm pretty sure I asked this once already.


RE: Cannot connect to SMTP remotely - brianhill1980 - 07-28-2009 12:54 AM

Update:

I brought my laptop into the office and tried to telnet into the SMTP server again. It worked!

So it looks as though the SMTP server is not allowing connections from outside networks. I'll ask the IT guys about it. Is there anything in the Postfix config that would prevent connections from outside networks?

Thanks!


RE: Cannot connect to SMTP remotely - kilburn - 07-28-2009 10:52 AM

No, postfix it's not blocking outside connections in your case because netstat shows that it is listening on all interfaces. Even if it was refusing connections, these tries should show up in your mail.log, and according to your previous post there are no connection attemps shown there (you pasted imap-related log lines, not postfix related ones).

Moreover, as the "nc" test you made didn't show anything on the server terminal, I can assure you that there's something blocking the incoming network connections through port 25. It may be a local firewall or the ISP, but surely something is blocking these connections...


[SOLVED] RE: Cannot connect to SMTP remotely - brianhill1980 - 07-28-2009 12:23 PM

Problem Solved.

My ISP, not the ISP the server runs on, blocks port 25 for me. I guess to help prevent spam.

What I was not aware of is that I'm able to connect through port 587 instead of 25 for SMTP authentication.

I changed my port settings in my applications from the default 25 to 587 and presto!

Thanks for all the help guys. I appreciate it. I absolutely love ispCP.