LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Sendmail is nog longer able to forward/alias to external servers. connection timeout (http://www.linuxquestions.org/questions/linux-server-73/sendmail-is-nog-longer-able-to-forward-alias-to-external-servers-connection-timeout-730346/)

nims 06-03-2009 03:28 AM

Sendmail is nog longer able to forward/alias to external servers. connection timeout
 
Hello,

Since a couple of days I have an issue in which sendmail is no longer able to send e-mails to external adresses when they needed to be forwarded (.forward) or aliassed.

What happens in detail is the following:

E-mails that need to be delivered to local mailboxes are delivered as it should. The moment that they need to be sent to an external box (.forward or alias) they get stuck with the connection timeout error to localhost.localdomain.com and they are moved to the /home/virtual/***/var/spool/mqueue.site folder.

I am running on parallels control panel pro (formaly known as ensim) so I have virtual sites.

I can try to resending it by running
#chroot /home/virtual/domain.name sendmail -q -v -OQueueDirectory=/var/spool/mqueue.site

But I then get the same problem:
Running /var/spool/mqueue.site/n52KQxmX026507 (sequence 1 of 159)
xx@yy.zz... Connecting to localhost.localdomain.com. via relay...
xx@yy.zz... Deferred: Connection timed out with localhost.localdomain.com.

I am able to connect to the localhost smpt service:
# telnet localhost.localdomain.com 25
Trying 127.0.0.1...
Connected to localhost.localdomain.com (127.0.0.1).
Escape character is '^]'.
220 rm-302-02.serve.com ESMTP Sendmail 8.13.8/8.13.8; Wed, 3 Jun 2009 00:53:48 +0200
helo smtp.google.com
250 rm-302-02.serve.com Hello localhost.localdomain.com [127.0.0.1], pleased to meet you

Also localhost.localdomain.com is in my hosts file, and I am able to ping it as it should.

Now I am really out of ideas and suggestions so I was hoping one of you have any ideas.

Matir 06-03-2009 08:32 PM

If you are using it in a chroot, the hosts file entry for localhost.localdomain.com would need to be in each chroot's /etc/hosts.

nims 06-04-2009 03:02 AM

Quote:

Originally Posted by Matir (Post 3562354)
If you are using it in a chroot, the hosts file entry for localhost.localdomain.com would need to be in each chroot's /etc/hosts.

Thanks for the reply.

Indeed they are chrooted but the localhost.localdomain.com is present in each host.

[root@rm-302-02 etc]# more hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost.localdomain.com
65.23.157.20 rm-302-02.server.com rm-302-02
::1 localhost6.localdomain6 localhost6
65.23.157.20 server.com server


In the meanwhile I have created a workaround which seems to work. But I am not sure if this is a good solution.


I did the following:

Changed /home/virtual/FILESYSTEMTEMPLATE/siteinfo/etc/mail/sendmail.mc and added define(`SMART_HOST', `dedicated4.nims.nl')dnl
Changed all the sites:
for i in `sitelookup -a domain`;do EditVirtDomain $i;done;

Then restarted sendmail and processed the queues:
for i in `sitelookup -a domain`;do chroot /home/virtual/$i sendmail -q -v -OQueueDirectory=/var/spool/mqueue.site;done;

All the old e-mails where being sent. And now new messages are being correctly forwarded again.

I am not sure if this is the solution, but it kept me going.

chitambira 06-04-2009 03:11 AM

Thats the correct solution. Your problem was really with 'mail routing'. Whilist local mails were delivered fine, for forwarded mails, sendmail didnt know where to forward them, It tried to forward them to itselst (which is wrong), so you did good by adding the correct SMART_HOST, which is in actual fact, the 'default gateway' for external mail.

nims 06-04-2009 04:30 PM

Well I think this is not the right solution because the smarthost I've added is in fact the LOCAL server only by it's dedicated domain name known from outside.

The only thing I can think of at the moment is that there is some slight difference between 127.0.0.1 and the internet IP adress. But I am clueless of what this is. Because telnet to 127.0.0.1 port 25, works without any hassle.

Matir 06-04-2009 06:51 PM

I mainly run postfix and qmail, so I could be wrong, but I suspect that if sendmail sees an email bound for 127.0.0.1, it just handles it internally, assuming the email would come into the same server (which it normally would without chroots or other multiple-server situations).

chitambira 06-05-2009 06:37 AM

thats what I was saying. If you server is a public smtp server, then it surely can forward external mail, however, forwarding to localhost (127.0.0.1) is TOTALLY DIFFERENT. You need to understand the meaning of localhost (which is very different to local server as you assumed)
Simply put, localhost -->loopback


All times are GMT -5. The time now is 02:45 PM.