Configuring the sendmailcf File

It's important to realize how rarely the file needs to be modified on a typical Linux system. The configuration file that comes with your Linux system will work. Generally, you modify the sendmail configuration not because you need to, but because you want to. You modify it to improve the way things operate, not to get them to operate. To illustrate this, let's look at the default Red Hat configuration on the system

Using the default configuration, the From address on outbound e-mail is [email protected]. This is a valid address, but assume that it's not exactly what you want. In the last chapter, you defined MX records for the domain. To use them, you want people to use addresses in the form [email protected], so you don't want the hostname in outbound e-mail addresses. To create the new configuration, you need to understand the purpose of class M and macro M, both of which are found in the Local Info section of the file.

sendmail calls hiding the real hostname masquerading. Thus, the name of the macro used to rewrite the sender host address is M. Set M to the domain name to replace the name of the local host in outbound mail with the name of the domain. Class M defines other hostnames, not just the local hostname, that also should be rewritten to the value of macro M. Class M is used on mail servers that need to rewrite sender addresses for their clients.

Checking the Red Hat file on parrot, you find that no value is assigned to macro M, which means that masquerading is not being used. Further, you find that there is no class M declaration in the file. To masquerade the local host as and to masquerade the outbound mail from the clients robin and puffin, copy the file to and then edit, changing the macro M declaration and adding a class M declaration:

# who I masquerade as (null for no masquerading)

# class M: host names that should be converted to $M

Given these macro M and class M definitions, parrot rewrites its own outbound mail to [email protected], as well as rewriting mail from [email protected] or [email protected] to [email protected]. parrot is a mail server. Although you might use macro M on any system, you won't use class M on any type of system except a mail server.

A problem with using class M is that [email protected], [email protected], and [email protected] are all rewritten as [email protected]. That's great if there really is only one kathy in the entire domain; otherwise, this may not be what you want. Coordinate usernames carefully across all systems. It simplifies the configuration of several different applications.

After setting a value for the M macro in the file, run a test to see if it works. Running sendmail with the test configuration does not affect the sendmail daemon that was started by the boot script. A separate instantiation of sendmail is used for the test.

Was this article helpful?

0 0

Post a comment