Tuesday, January 25, 2011

How to configure a Linux Mail Server -6


Common Errors Due To Incomplete RPM Installation

Both the newaliases and m4 commands require the sendmail-cf and m4 RPM packages. These must be installed. If they are not, you'll get errors when running various sendmail related commands.

• Sample Errors when running newaliases

[root@bigboy mail]# newaliases

Warning: .cf file is out of date: sendmail 8.12.5 supports version 10, .cf file is version 0

No local mailer defined

QueueDirectory (Q) option must be set

[root@bigboy mail]#

• Sample errors when processing the sendmail.mc file

[root@bigboy mail]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

/etc/mail/sendmail.mc:8: m4: Cannot open /usr/share/sendmail-cf/m4/cf.m4: No such file or directory

[root@bigboy mail]#

• Sample errors when restarting sendmail

[root@bigboy mail]# service sendmail restart

Shutting down sendmail: [ OK ]

Shutting down sm-client: [FAILED]

Starting sendmail: 554 5.0.0 No local mailer defined

554 5.0.0 QueueDirectory (Q) option must be set

[FAILED]

Starting sm-client: [ OK ]

[root@bigboy mail]#

If these errors occur, make sure your m4, sendmail and senmail-cf RPM packages are installed correctly.



Incorrectly Configured /etc/hosts Files

By default, Fedora inserts the hostname of the server between the 127.0.0.1 and the localhost entries in /etc/hosts like this:

127.0.0.1 bigboy localhost.localdomain localhost

Unfortunately in this configuration, sendmail will think that the server's FQDN is bigboy, which it will identify as being invalid because there is no extension at the end, such as .com or .net. It will then default to sending e-mails in which the domain is localhost.localdomain.

The /etc/hosts file is also important for configuring mail relay. You can create problems if you fail to place the server name in the FDQN for 127.0.0.1 entry. Here sendmail thinks that the server's FDQN was my-site and that the domain was all of .com.

127.0.0.1 my-site.com localhost.localdomain localhost (Wrong!!!)

The server would therefore be open to relay all mail from any .com domain and would ignore the security features of the access and relay-domains files I'll describe later.

As mentioned, a poorly configured /etc/hosts file can make mail sent from your server to the outside world appear as if it came from users at localhost.localdomain and not bigboy.my-site.com.

Use the sendmail program to send a sample e-mail to someone in verbose mode. Enter some text after issuing the command and end your message with a single period all by itself on the last line, for example:

[root@bigboy tmp]# sendmail -v example@another-site.com

test text

test text

.

example@another-site.com... Connecting to mail.another-site.com. via esmtp...

220 ltmail.another-site.com LiteMail v3.02(BFLITEMAIL4A); Sat, 05 Oct 2002 06:48:44 -0400

>>> EHLO localhost.localdomain

250-mx.another-site.com Hello [67.120.221.106], pleased to meet you

250 HELP

>>> MAIL From:

250 ... Sender Ok

>>> RCPT To:

250 ... Recipient Ok

>>> DATA

354 Enter mail, end with "." on a line by itself

>>> .

250 Message accepted for delivery

example@another-site.com... Sent (Message accepted for delivery)

Closing connection to mail.another-site.com.

>>> QUIT

[root@bigboy tmp]#

localhost.localdomain is the domain that all computers use to refer to themselves, it is therefore an illegal Internet domain. Consider an example: Mail sent from computer PC1 to PC2 appears to come from a user at localhost.localdomain on PC1 and is rejected. The rejected e-mail is returned to localhost.localdomain. PC2 sees that the mail originated from localhost.localdomain and thinks that the rejected e-mail should be sent to a user on PC2 that may not exist. You end up with an error in /var/log/maillog:

Oct 16 10:20:04 bigboy sendmail[2500]: g9GHK3iQ002500: SYSERR(root): savemail: cannot save rejected email anywhere

Oct 16 10:20:04 bigboy sendmail[2500]: g9GHK3iQ002500: Losing ./qfg9GHK3iQ002500: savemail panic

You may also get this error if you are using a spam prevention program, such as a script based on the PERL module Mail::Audit. An error in the script could cause this type of message too.

Another set of tell tale errors caused by the same problem can be generated when trying to send mail to a user (the example uses root) or creating a new alias database file. (I'll explain the newaliases command later.)

[root@bigboy tmp]# sendmail -v root

WARNING: local host name (bigboy) is not qualified; fix $j in config file

[root@bigboy tmp]# newaliases

WARNING: local host name (bigboy) is not qualified; fix $j in config file

[root@bigboy tmp]#

An accompanying error in /var/log/maillog log file looks like this:

Oct 16 10:23:58 bigboy sendmail[2582]: My unqualified host name (bigboy) unknown; sleeping for retry



No comments:

Post a Comment