8.8 Batch Rule-Set Testing

The output that is produced by sendmail can become huge, especially when many addresses need testing. To simplify the process (and to help bulletproof your configuration file), consider using a shell script such as the following:

 #!/bin/sh /usr/sbin/sendmail -bt <  \          egrep "canonify.*input:canonify.*returns^>" 

Here, the output is piped through egrep (1), which selects only the lines of interest. If this script were to be called testcf.sh , it could be invoked with the following command line:

 %  testcf.sh address.list  

Here, the address.list is a file consisting of pairs of rule set names and addresses such as the following:

 canonify,parse nobody@ourhost canonify,parse nobody@ourhost.domain canonify,parse nobody@distant.domain  ...   and so on  

The output that is produced shows the input to the canonify rule set 3 and the result of each pass through that rule set:

 > canonify           input: nobody @ ourhost canonify         returns: nobody < @ ourhost . domain . > > canonify           input: nobody @ ourhost . domain canonify         returns: nobody < @ ourhost . domain . > > canonify           input: nobody @ distant . domain canonify         returns: nobody < @ distant . domain . > 

Note that the address.list file should contain every conceivable kind of address. The output from the shell script should be saved. At a later time, after the configuration file is changed, diff (1) can be used to see if the saved output differs from the new output (to see whether anything unexpected changed as a result of your modifications).

Also note that directly calling the canonify and parse rule sets 0 produces less useful information than does the /parse rule-testing command (Section 8.5.5). If you use that command, a diff (1) against prior output can provide more interesting and complete information.



Sendmail
sendmail, 4th Edition
ISBN: 0596510292
EAN: 2147483647
Year: 2002
Pages: 1174

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