sendmail

sendmailSearch this book
Previous: 14.7 Things to TryChapter 15Next: 15.2 The Real Queue Directory
 

15. Install and Test the client.cf File

Contents:
Test the Configuration File
The Real Queue Directory
MX Records
Hub Accepts Mail for Client
Prevent the Daemon from Running
Install the client.cf File
Things to Try

In this chapter and the next, we tie up a few loose ends to install a client.cf file as the system configuration file.

15.1 Test the Configuration File

Clearly, you won't want to install the client.cf file as the real sendmail.cf file until you've made sure it works properly. One of the better ways to test a new configuration file is to create a file of addresses for which you already know the correct outcome, then feed the contents of that file to sendmail in rule-testing mode:

/tryflags es
/parse user@here
/parse [email protected]
/parse user@foo
/parse foo!user
/parse user

Each line begins with a special V8.7 rule-testing command. [1] The first line causes the tests that follow to parse the address as an envelope sender (instead of the default envelope recipient). The /parse command causes each address to be rewritten by rule sets 3 and 0 to select a delivery agent and then by rule set 4 to clean up afterward. The addresses listed that are humbly few but will suffice for the needs of the client.cf file. No matter the form of the address, each should be forwarded to the hub as is. (The /parse command is described in Section 38.5.5, "Parse an Address with /parse".)

[1] The same thing can be done in earlier versions, but with some difficulty. See a sample script in Section 38.8, "Batch Rule-Set Testing".

The way to test the client.cf file using this list looks like this:

% ./sendmail -Cclient.cf -bt < list | grep ^mailer

Here, list is the name of the file containing the above list of rule tests and addresses. The output shows that each will be passed as is to the hub:

mailer hub, host mailhost, user user@here
mailer hub, host mailhost, user [email protected]
mailer hub, host mailhost, user user@foo
mailer hub, host mailhost, user here!user
mailer hub, host mailhost, user user

Notice that mail to these addresses will be delivered by using the hub delivery agent (mailer). Also notice that each will be forwarded to the hub machine (mailhost) for delivery. Finally, note that the user part will be the original address. [2]

[2] This is the triple that we described in Section 9.2, "The RHS Triple", in which the RHS of rule set 0 returned the mailer with $#, the host with $@, and the user with $:.

But why was the lone username in the last line not rewritten to appear as though it was coming from the hub? Recall that sender rewriting is done in the Hubset rule set. That rule set is called only by the S= of the delivery agent. To see Hubset rewriting, you need to run sendmail again, but this time use /try instead of /parse: [3]

[3] Under old versions of sendmail you must specify the rule sets by hand, for example, 3,Hubset.

% ./sendmail -Cclient.cf -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> /tryflags es
> /try hub user
rewrite: ruleset  3   input: user
rewrite: ruleset  3 returns: user
rewrite: ruleset  1   input: user
rewrite: ruleset  1 returns: user
rewrite: ruleset 199   input: user
rewrite: ruleset 199 returns: user @ mail . us . edu
rewrite: ruleset  4   input: user @ mail . us . edu
rewrite: ruleset  4 returns: user @ mail . us . edu
Rcode = 0, addr = [email protected]

Here, sendmail rewrites the lone username first with rule set 3 (all addresses start with rule set 3), and then with rule set 1 (all sender addresses pass through rule set 1). The address is then rewritten by rule set Hubset (which prints as 199 because it is a symbolic rule-set name). As intended, a lone sender name has the address of the hub machine appended to it. (The rest of this /try output is described in Section 38.5.6, "Try a Delivery Agent with /try".)

Further testing would be suggested if the output varied in unexpected ways. It might be necessary to run sendmail in rule-testing mode by hand, testing each rule and sequence of rules individually to find any mistakes in the client.cf file. If the client.cf file tests okay, you are now almost ready to install it as the official sendmail.cf file.


Previous: 14.7 Things to TrysendmailNext: 15.2 The Real Queue Directory
14.7 Things to TryBook Index15.2 The Real Queue Directory