Sending and Receiving Email in a Cluster Environment


In this case study, we want to use an application on each of the cluster nodes that sends outbound email to customers. Each cluster node will therefore need to masquerade outbound email so it appears to come from a single domain using the following entry in the /etc/mail/sendmail.mc file on each cluster node:

 MASQUERADE_AS(`yourdomain.com')dnl FEATURE(`always_add_domain')dnl FEATURE(`masquerade_envelope')dnl FEATURE(`allmasquerade')dnl 

We'll also send outbound email to a central (relay) email server, to make it easier to troubleshoot problems when email is not delivered properly, by adding the following line to the /etc/mail/sendmail.mc file on each cluster node:

 define(`SMART_HOST',`mailserver.yourdomain.com')dnl 

where mailserver.yourdomain.com is, of course, the host name of your SMTP server.

This SMART_HOST rule, however, will not send email to the central mail server when the mail is destined for a user with a passwd entry on the local cluster node (either in the local /etc/passwd file, LDAP, or NIS, and so on), and nothing is specified after the @ sign in the email address. An example would be email sent to joseph or sam when Joseph and Sam have accounts on the cluster node. To force these email messages to the central mail server, you will also need to add:

    define(`LOCAL_RELAY',``mailserver.yourdomain.com'')dnl 

If you need to make an exception and force some mail to be delivered locally (for example, email sent to orderprocessing that is really an email alias that sends email on to a program for automated processing) on the cluster nodes, you can use an entry like this:

                LOCAL_USER(`orderprocessing')dnl 

Note 

The user root is always on the LOCAL_USER exception list.

Once the changes have been made to the sendmail.mc file on each cluster node, you need to create a new sendmail.cf file with the command:

 #m4 /etc/mail/sendmail.mc > /etc/sendmail.cf 

Then, stop and restart the sendmail daemon on all cluster nodes.

image from book
TESTING EMAIL FROM THE COMMAND LINE

You can use the command mail -v testuser@whereever.com to test if this change makes any difference to the From address of an outbound email. This command will prompt you for a Subject line and then give you the opportunity to enter email message body text. Enter . on a line by itself to indicate the end of the message and press ENTER when asked for the Cc: email address. You'll see the transcript of the email session as sendmail running on the cluster node attempts to contact the remote mail server (or central relay email server, if you have used the SMART_HOST option just described) and the From address the cluster node is using.

image from book



The Linux Enterprise Cluster. Build a Highly Available Cluster with Commodity Hardware and Free Software
Linux Enterprise Cluster: Build a Highly Available Cluster with Commodity Hardware and Free Software
ISBN: 1593270364
EAN: 2147483647
Year: 2003
Pages: 219
Authors: Karl Kopper

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net