Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Chapter 4. Masquerading > Rewriting Sender Addresses for an Entire Domain - Pg. 137

should be loaded into class $=G . If this is a small number of hostnames, it can be done by placing multiple GENERICS_DOMAIN macros in the configuration. If there are more than a few hostnames, it is simpler to create a file that lists all of the hosts and then to reference that file inside the configuration with a GENERICS_DOMAIN_FILE macro. For example, the following macro used in this recipe, in place of the GENERICS_DOMAIN macro, would load $=G with all of the hostnames listed in a file called /etc/mail/generics-domains: GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains') The GENERICS_DOMAIN_FILE macro makes it possible to coordinate genericstable pro- cessing with other sendmail functions simply by extracting hostnames from the files that control those other functions and storing those names in the file loaded by the GENERICS_DOMAIN_FILE macro. For example, copying the hostnames from /etc/mail/ local-host-names to the file loaded by the GENERICS_DOMAIN_FILE macro enables genericstable processing for all systems that use a mail exchanger. See Also Recipe 4.12 shows another genericstable example. Recipe 4.14 shows how the genericstable can be read from an LDAP server. The sendmail book covers the genericstable in 4.8.16, the GENERICS_DOMAIN macro in 4.8.16.1, and the GENERICS_ DOMAIN_FILE macro in 4.8.16.2. Chapter 9 of Linux Sendmail Administration, by Craig Hunt (Sybex), contains the tutorial section "Masquerading Usernames" that pro- vides additional information. 4.12 Rewriting Sender Addresses for an Entire Domain Problem You have been asked to configure sendmail to rewrite the sender address into your organization's standard header sender address format on all mail originating from the local domain. Solution Build a genericstable database to map the input address to the format desired for the header sender address. Each entry in the genericstable contains two fields. The first field matches the input address and the second field rewrites the address. To create the genericstable, first create a text file that contains the database entries, then run that text file through the makemap command to build the genericstable database. Rewriting Sender Addresses for an Entire Domain | This is the Title of the Book, eMatter Edition Copyright © 2007 O'Reilly & Associates, Inc. All rights reserved. 137