Can send mail but can't receive SMTP failure - email

I've got dedicated server to run all my sites from.
I created domain and updated all DNS records to this server, everything is fine and propagated however when i try and receive mail nothing happens but it can send.
I went to dnsstuff.com and this is the error i got...
All connections to Mailservers port 25 have failed. The standard port
for SMTP transactions is 25, so your servers should be operating on
that port. It is recommended that it be fixed in order for your mail
service to operate properly. The Mail Servers that failed are:
xx.xxx.xxx.xxx | failed message send with: failed cx open with: failed socket connect with: Operation now in progress
/*****************
UPDATE
*****************/
Running a linux box using centOS.
The mailserver being used is, I believe, Postfix.
How do i fix this problem?

Check your firewall configuration on your server. If you can send from localhost (that is, direclty from your server), but mail can't be delivered from remote servers to your box, your firewall is the best bet to look at. Basically port 25 should be open to any IP. It's hard to give you specific details on how to configure your firewall, as you do not specify your OS and dikstribution. Most Linux distro's run some flavour of iptables. If iptables is what you have, you could try this command from the command line:
iptables -A INPUT -p tcp --dport 25 -j ACCEPT
Before you open up your firewall, you might want to dive into configuring postfix. It would not be nice to the rest of the world if you started running an open relay. That will get your server blacklisted in no time. This artice on the postfix website will give you a decent start.

Related

Server Connection with public IP

I have setup a simple HTTP java server running locally on port 8000. It simply prints a message "Hello world" when a request comes. When I try to ping it from the browser by running http://localhost:8000/test I get my message printed.
I want to get the same results from another computer that is not local. When I try to use my public IP lets say http:/43.xxx.xxx.xxx:8000/test (even from the same machine) I get an ERR_CONNECTION_REFUSED .
I probably suspect that has something to do with the firewall. Can anyone guide me a little more because I lack the experience?
Thanks in advance
You don't specify what host OS your server/firewall is running so I'll keep this generic...
Without knowing your application, it seems like the server is sending a reset (RST packet) when the first SYN packet shows up indicating that the port (on that interface [your external]) is closed. You can do a quick port scan from here (https://mxtoolbox.com/PortScan.aspx) if you don't have access to a remote machine to test with. Odds are, TCP/8000 will not be open.
If it is, in fact, closed, you'll have to look at the firewall that your host OS is running and find out how to allow TCP/8000 to your host. In a major firewall vendor, your rule would look similar to this:
Source: Any
Destination: Your Public IP Address
Service: TCP/8000
Action: Allow
Logging: Full
That being said, you mentioned this was a PC so look into "iptables" (if you're running *nix) or the Windows Firewall (if you're running Windows) on adding firewall rules (Unfortunately I just joined and can't ask questions/comments, yet).
If you really want to find out what packet is being sent, run a tcpdump on your external interface (let's say eth1) (assuming your remote IP is 1.2.3.4 and your home public IP is 4.5.6.7):
tcpdump -nn -vvv -e -s 0 -X -c 100 -i eth1 host 1.2.3.4 and host
4.5.6.7 and port 8000
Here you're looking for the SYN/SYN-ACK/ACK for a successful TCP negotiation or SYN/RST if there is a firewall rejecting (not dropping) the TCP stream to the port.
Once the port is open on the host OS firewall, take a look at the application to make sure it's configured properly. If this were a standard webserver, you could take a look at the configuration files for the "Allow from" directives to make sure that everyone can access the site. If this is a custom application that you've created, you'll have to check this yourself.
I finally solved my problem. I needed to open a forwarding port in my router that maps my local ip address to the public. My router is TP Link so this what I did:
http://www.tp-link.com/us/faq-72.html
Also in order for this to work every time and not to have to reconfigure this every time I reconected to the router (because I get a new local IP), I have created a static local ip for my server following this guide:
http://www.tp-link.com/us/faq-182.html
Thanks for all the replies.

CentOS iptables and port configuration for using external SMTP server

I have a web server running CentOS and a separate mail server running Microsoft Exchange. I have the web server connecting to the mail server via SMTP on port 587 to send emails.
Sometimes the connection to the mail server refuses, but it's rare. Could an intermittent failure be related to port settings? I would have thought it's all or nothing.
For the CentOS web server, what rules should I be looking to configure in the iptables if any? Do I need to add an entry for port 587 on this server? Or do I just need to allow incoming connections on the mail server for 587?
Thanks in advance.
You don't need to set up any iptables rules on your webserver, since outgoing connections are allowed by default. Your occasional drops won't have anything to do with the webserver's firewall, so you'll want to look at tuning your Exchange server, if the error is impactful enough to worry about it.

Connection failed in QuteCom SIP client

I have chosen QuteCom SIP client for windows to chat.I have installed and configured the account with my public server. My SIP server is kamailio.The connection to the server is not established. The application is connecting to the server for a long time.
Any help is appreciated.
If looks like keep connecting, then I guess the SIP messages don't get to the server.
You can install Wireshark to monitor traffic on windows host on port 5060 (the SIP port) in order to see if SIP messages are sent to the server.
On server, you can install ngrep for the purpose of seeing if traffic from the phone comes there. The command would be like:
ngrep -d any -qt -W byline port 5060
If you don't see traffic coming to the SIP server, then might be a firewall or an ALG between the client and the server, or, a firewall even on client host or server itself.
If it is something in between (not on client host or server), then you should try to use TCP or better TLS.
Note that if you have the firewall on the server, you will see the SIP packets coming on the network, but they will be dropped by the kernel before getting to application layer. Typically on Linux you can see the firewall rules with:
iptables -L
If the SIP packets come to the server, then set debug=3 in kamailio.cfg, restart kamailio and watch the syslog file (e.g., /var/log/syslog or /var/log/messgaes) for kamailio-specific debug messages -- you should get hints of what happens during processing.

Sendmail is unable to send letters to the internet (only local mail is being sent)

I'm using centos 5 and sendmail on intranet server. Local mail is being delivered perfectly, but when i try to deliver email to gmail, for example (or any other service outside intranet) i find following errors in my logs:
Jan 16 16:50:32 testlink sendmail[27713]: r0GCoVi5027711: to=<example#gmail.com>,
ctladdr=<webdev#testlink.ru.corp.domain.com> (502/502), delay=00:00:01,
xdelay=00:00:01, mailer=esmtp, pri=120332, relay=alt4.gmail-smtp-in.l.google.com.
[173.194.68.27], dsn=4.0.0, stat=Deferred:
Connection refused by alt4.gmail-smtp-in.l.google.com.
one more important thing - server is not accessible from internet, but i can access internet from my server..
Please advice where should i search the problem.. i understand that i should setup sendmail somehow (currently i'm using default configuration that was set by yum), but what settings (or at least direction)... Thanks in advance!
run ifconfig in command line. perhaps something is wrong with your IP
also look into iptables -L
netstat -nap should have a string
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 5275/sendmail
check if provider blocks port 25:
telnet smtp.ukr.net 25

Receiving email with Amazon EC2?

I have no trouble sending out email with my EC2 server, but how can I check the email that is sent to me? I have an elastic IP setup and modified reverse DNS records. Do I need to install Postfix to receive email?
Ensure that port 25 is active and open on your server. Install an SMTP service on your instance ...postfix is mighty fine.
Ensure you have also set up some MX records if you want to receive email from the world...
I suppose the first thing to do is testing if you can open a telnet connection to port 25 on your server. Then you know if anything is listening for incoming mail.
If not, then you should probably install postfix as well as test your firewall settings (I seem to recall the EC2 having some sort of firewall setting for which ports to allow in the web interface)
edit: correct port number