151220Seric 251220Seric 357246Seric NEW SENDMAIL CONFIGURATION FILES 451220Seric 557246Seric Eric Allman <eric@CS.Berkeley.EDU> 651220Seric 7*57247Seric @(#)README 2.7 (Berkeley) 12/20/92 851220Seric 951220Seric 1057246SericThis document describes the sendmail configuration files being used 1157246Sericat Berkeley. These use features in the new (R6) sendmail, and although 1257246Sericthere is an ``OLDSENDMAIL'' mode, they haven't really been tested on 13*57247Sericold versions of sendmail and cannot be expected to work well. 1451220Seric 1557246SericThese configuration files are probably not as general as previous 1657246Sericversions, and don't handle as many of the wierd cases automagically. 1757246SericI was able to simplify by them for two reasons. First, the network 1857246Serichas become more consistent -- for example, at this point, everyone 1957246Sericon the internet is supposed to be running a name server, so hacks to 2057246Serichandle NIC-registered hosts can go away. Second, I assumed that a 2157246Sericsubdomain would be running SMTP internally -- UUCP is presumed to be 2257246Serica long-haul protocol. I realize that this is not universal, but it 2357246Sericdoes describe the vast majority of sites with which I am familiar, 2457246Sericincluding those outside the US. 2551220Seric 2657246SericOf course, the downside of this is that if you do live in a wierd 2757246Sericworld, things are going to get wierder for you. I'm sorry about that, 2857246Sericbut at the time we at Berkeley had a problem, and it seemed like the 2957246Sericright thing to do. 3051220Seric 31*57247SericThis package requires a post-V7 version of m4; if you are running the 32*57247Seric4.2bsd, SysV.2, or 7th Edition version, I suggest finding a friend with 33*57247Serica newer version. You can m4-expand on their system, then run locally. 34*57247SericSunOS's /usr/5bin/m4 or BSD-Net/2's m4 both work. GNU m4 (which is a 35*57247Sericlanguage unto itself) also works, but I don't intend to work so hard 36*57247Sericto keep this up in the future. [Note to GNU folks: the construct 3757246Seric"define(`FOO')" should work without my having to add a null value.] 3851220Seric 3957246SericI'm not pretending that this README describes everything that these 4057246Sericconfiguration files can do; clever people can probably tweak them 4157246Sericto great effect. But it should get you started. 4257246Seric 4357246Seric+--------------------------+ 4457246Seric| INTRODUCTION AND EXAMPLE | 4557246Seric+--------------------------+ 4657246Seric 4757246SericConfiguration files are contained in the subdirectory "cf", with a 4857246Sericsuffix ".mc". They must be run through "m4" to produce a ".cf" file. 4957246Seric 5051220SericLet's examine a typical .mc file (cf/cs-exposed.mc): 5151220Seric 5251220Seric divert(-1) 5351220Seric # 5451220Seric # Copyright (c) 1983 Eric P. Allman 5551220Seric # Copyright (c) 1988 The Regents of the University of California. 5651220Seric # All rights reserved. 5751220Seric # 5851220Seric # Redistribution and use in source and binary forms are permitted 5951220Seric # provided that the above copyright notice and this paragraph are 6051220Seric # duplicated in all such forms and that any documentation, 6151220Seric # advertising materials, and other materials related to such 6251220Seric # distribution and use acknowledge that the software was developed 6351220Seric # by the University of California, Berkeley. The name of the 6451220Seric # University may not be used to endorse or promote products derived 6551220Seric # from this software without specific prior written permission. 6651220Seric # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 6751220Seric # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 6851220Seric # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 6951220Seric # 7051220Seric 7157246SericThe divert(-1) will delete the crud in the resulting output file. 72*57247SericThe copyright notice is what your lawyers require. Our lawyers require 7357246Sericthe one that I've included in my files. A copyleft is a copyright by 7457246Sericanother name. 7551220Seric 7657246SericThe next line MUST be 7757246Seric 7851220Seric include(`../m4/cf.m4') 7951220Seric 8057246SericThis will pull in the M4 macros you will need to make sense of 8157246Sericeverything else. As the saying goes, don't think about it, just 8257246Sericdo it. If you don't do it, don't bother reading the rest of this 8357246Sericfile. 8451220Seric 8556778Seric VERSIONID(`<SCCS or RCS version id>') 8651220Seric 8751220SericVERSIONID is a macro that stuffs the version information into the 8851220Sericresulting file. We use SCCS; you could use RCS, something else, or 8957246Sericomit it completely. This is not the same as the version id included 9057246Sericin SMTP greeting messages -- this is defined in m4/version.m4. 9151220Seric 9251268Seric DOMAIN(cs.exposed) 9351220Seric 9451220SericThis example exposes the host inside of the CS subdomain -- that is, 9551220Sericit doesn't try to hide the name of the workstation to the outside 9651220Sericworld. Changing this to DOMAIN(cs.hidden) would have made outgoing 9751220Sericmessages refer to "<username>@CS.Berkeley.EDU" instead of using the 9857246Sericlocal hostname. Internaly this is effected by using 9957246Seric"MASQUERADE_AS(CS.Berkeley.EDU)". 10051220Seric 10151268Seric MAILER(smtp) 10251220Seric 10351309SericThese describe the mailers used at the default CS site site. The 10451309Sericlocal mailer is always included automatically. 10551220Seric 10657246Seric+--------+ 10757246Seric| OSTYPE | 10857246Seric+--------+ 10957246Seric 11051220SericNote that cf/cs-exposed.mc omits an OSTYPE macro -- this assumes 11151220Sericdefault Computer Science Division environment. There are several 112*57247Sericexplicit environments available: bsd4.3, bsd4.4, hpux, irix, osf1, 113*57247Sericriscos4.5, sunos3.5, sunos4.1, and ultrix4.1. These change things 114*57247Sericlike the location of the alias file and queue directory. Some of 115*57247Sericthese files are identical to one another. 11651220Seric 11757246SericOperating system definitions are easy to write. They may define 11857246Sericthe following variables (everything defaults, so an ostype file 11957246Sericmay be empty). 12051220Seric 12157246SericALIAS_FILE [/etc/aliases] The location of the text version 12257246Seric of the alias file. 12357246SericHELP_FILE [/usr/lib/sendmail.hf] The name of the file 12457246Seric containing information printed in response to 12557246Seric the SMTP HELP command. 12657246SericLOCAL_MAILER [/bin/mail] The program used to deliver local mail. 12757246SericLOCAL_SHELL [/bin/sh] The shell used to deliver piped email. 12857246SericQUEUE_DIR [/var/spool/mqueue] The directory containing 12957246Seric queue files. 13057246SericSTATUS_FILE [/etc/sendmail.st] The file containing status 13157246Seric information. 13257246SericLOCAL_MAILER_FLAGS [rn] The flags used by the local mailer. The 13357246Seric flags lsDFMm are always included. 13457246SericHOSTMAP_SPEC [dbm -o /etc/hostmap] The value for the builtin 13557246Seric hostmap key definition. You can redefine this 13657246Seric to change the class, flags, and filename of 13757246Seric the hostmap. The default flag (-o) makes this 13857246Seric map optional. 13957246Seric 14057246SericIn addition, the following boolean flags may be defined -- the value 14157246Sericis ignored. 14257246Seric 14357246SericNEED_DOMAIN If set, the $j macro is defined as $w.$D. 14457246Seric If not set, $j is defined as $w. If this is 14557246Seric set, the domain must be defined using the line 14657246Seric DD<domainname> (probably in the domain file, 14757246Seric but possibly in the .mc file). You will only 14857246Seric need this if you define your system hostname 14957246Seric without a domain (type "hostname" -- if it 15057246Seric has no dots in the output, you qualify) or if 15157246Seric you are running Ultrix or OSF/1 sendmail. 15257246Seric Either of these is probably a mistake. 15357246Seric 15457246Seric+---------+ 15557246Seric| DOMAINS | 15657246Seric+---------+ 15757246Seric 15857246SericYou will probably want to collect domain-dependent defines into one 15957246Sericfile, referenced by the DOMAIN macro. For example, our Berkeley 16057246Sericdomain file includes definitions for several internal distinguished 16157246Serichosts: 16257246Seric 16357246SericUUCP_RELAY The host that will forward UUCP-addressed email. 16457246Seric If not defined, all UUCP sites must be directly 16557246Seric connected. 16657246SericBITNET_RELAY The host that will forward BITNET-addressed email. 16757246Seric If not defined, the .BITNET pseudo-domain won't work. 16857246SericCSNET_RELAY The host that will forward CSNET-addressed email. 16957246Seric If not defined, the .CSNET pseudo-domain won't work. 17057246SericLOCAL_RELAY The site that will handle unqualified names -- that 17157246Seric is, names with out an @domain extension. If not set, 17257246Seric they are assumed to belong on this machine. This 17357246Seric allows you to have a central site to store a 17457246Seric company- or department-wide alias database. This 17557246Seric only works at small sites, and there are better 17657246Seric methods. 17757246Seric 17857246SericThe domain file can also be used to define a domain name, if needed 179*57247Seric(using "DD<domain>") and set certain site-wide features, such as 180*57247Sericno_wildcard_MX. If all hosts at your site masquerade behind one 181*57247Sericemail name, you could also use MASQUERADE_AS here. 18257246Seric 18357246Seric+---------+ 18457246Seric| MAILERS | 18557246Seric+---------+ 18657246Seric 18751220SericThere are fewer mailers supported in this version than the previous 18851220Sericversion, owing mostly to a simpler world. 18951220Seric 19051220Sericlocal The local and prog mailers. You will almost always 19151220Seric need these; the only exception is if you relay ALL 192*57247Seric your mail to another site. This mailer is included 193*57247Seric automatically. 19451220Seric 19551220Sericsmtp The Simple Mail Transport Protocol mailer. This does 19651220Seric not hide hosts behind a gateway or another other 19751220Seric such hack; it assumes a world where everyone is 19851220Seric running the name server. 19951220Seric 20051220Sericuucp The Unix-to-Unix Copy Program mailer. Actually, this 20151220Seric defines two mailers, "uucp" and "suucp". The latter 20251220Seric is for when you know that the UUCP mailer at the other 20351220Seric end can handle multiple recipients in one transfer. 20457246Seric When you invoke this, sendmail looks for all names in 20557246Seric the $=U class and sends them to the uucp mailer; all 20657246Seric names in the $=Y class are sent to suucp. Note that 20757246Seric this is a function of what version of rmail runs on 20857246Seric the receiving end, and hence may be out of your control. 20951220Seric 21057246Seric+----------+ 21157246Seric| FEATURES | 21257246Seric+----------+ 21351268Seric 21457246SericSpecial features can be requested using the "FEATURE" macro. For 21557246Sericexample, the .mc line: 21657246Seric 21757246Seric FEATURE(use_cw_file) 21857246Seric 21957246Serictells sendmail that you want to have it read an /etc/sendmail.cw 22057246Sericfile to get values for class $=w. Available features are: 22157246Seric 22257246Sericuse_cw_file Read the file /etc/sendmail.cw file to get alternate 22357246Seric names for this host. This might be used if you were 22457246Seric on a host that MXed for a dynamic set of other 22557246Seric hosts. If the set is static, just including the line 22657246Seric "Cw<name1> <name2> ..." is probably superior. 22757246Seric 22857246Sericno_wildcard_MX This domain does not have a wildcard MX record that 22957246Seric matches it. For example, I am in domain 23057246Seric CS.Berkeley.EDU, and there is no MX record that 23157246Seric matches *.CS.Berkeley.EDU or *.Berkeley.EDU, so I 23257246Seric can safely use this feature. If you set this, you 23357246Seric get better name server performance. 23457246Seric 23557246SericOther FEATUREs should be defined, but I was trying to keep these 23657246Sericconfig files fairly lean and mean. 23757246Seric 23857246Seric+-------+ 23957246Seric| HACKS | 24057246Seric+-------+ 24157246Seric 24257246SericSome things just can't be called features. To make this clear, 243*57247Sericthey go in the hack subdirectory and are referenced using the HACK 24457246Sericmacro. These will tend to be site-dependent. The release 24557246Sericincludes the Berkeley-dependent "cssubdomain" hack (that makes 24657246Sericsendmail accept local names in either Berkeley.EDU or CS.Berkeley.EDU; 24757246Sericthis is intended as a short-term aid while we move hosts into 24857246Sericsubdomains. 24957246Seric 25057246Seric+--------------------+ 25157246Seric| SITE CONFIGURATION | 25257246Seric+--------------------+ 25357246Seric 25457246SericComplex sites will need more local configuration information, such as 25557246Sericlists of UUCP hosts they speak with directly. This can get a bit more 25657246Serictricky. For an example of a "complex" site, see cf/ucbvax.mc. 25757246Seric 25857246SericThe SITECONFIG macro allows you to indirectly reference site-dependent 25957246Sericconfiguration information stored in the siteconfig subdirectory. For 26057246Sericexample, the line 26157246Seric 26257246Seric SITECONFIG(uucp.ucbvax, ucbvax, U) 26357246Seric 26457246Sericreads the file uucp.ucbvax for local connection information. The 26557246Sericsecond parameter is the local name (in this case just "ucbvax" since 26657246Sericit is locally connected, and hence a UUCP hostname) and the name of 26757246Sericthe class in which to store the host information. Another SITECONFIG 26857246Sericline reads 26957246Seric 27057246Seric SITECONFIG(uucp.ucbarpa, ucbarpa.Berkeley.EDU, W) 27157246Seric 27257246SericThis says that the file uucp.ucbarpa contains the list of UUCP sites 27357246Sericconnected to ucbarpa.Berkeley.EDU. The $=W class will be used to 27457246Sericstore this list. [The machine ucbarpa is gone now, but I've left 27557246Sericthis out-of-date configuration file around to demonstrate how you 27657246Sericmight do this.] 27757246Seric 27857246SericThe siteconfig file (e.g., siteconfig/uucp.ucbvax.m4) contains nothing 27957246Sericmore than a sequence of SITE macros describing connectivity. For 28057246Sericexample: 28157246Seric 28257246Seric SITE(cnmat) 28357246Seric SITE(sgi olympus) 28457246Seric 28557246SericThe second example demonstrates that you can use two names on the 28657246Sericsame line; these are usually aliases for the same host (or are at 28757246Sericleast in the same company). 28857246Seric 28957246Seric+-------------------+ 29057246Seric| TWEAKING RULESETS | 29157246Seric+-------------------+ 29257246Seric 29351268SericFor more complex configurations, you can define special rules. 29451268SericThe macro LOCAL_RULE_3 introduces rules that are used in canonicalizing 29551268Sericthe names. Any modifications made here are reflected in the header. 29651268Seric 29751268SericA common use is to convert old UUCP addreses to SMTP addresses using 29851268Sericthe UUCPSMTP macro. For example: 29951268Seric 30051268Seric LOCAL_RULE_3 30151268Seric UUCPSMTP(decvax, decvax.dec.com) 30251268Seric UUCPSMTP(research, research.att.com) 30351268Seric 30451268Sericwill cause addresses of the form "decvax!user" and "research!user" 30551268Sericto be converted to "user@decvax.dec.com" and "user@research.att.com" 30651268Sericrespectively. 30751268Seric 30857246SericThis could also be used to look hosts in a database map: 30957246Seric 31057246Seric LOCAL_RULE_3 31157246Seric R$* < @ $+ > $* $: $1 < @ $(hostmap $2 $) > $3 31257246Seric 31357246SericThis map would be defined in the LOCAL_CONFIG portion, as shown below. 31457246Seric 31551268SericSimilarly, LOCAL_RULE_0 can be used to introduce new parsing rules. 31651268SericFor example, new rules are needed to parse hostnames that you accept 31751309Sericvia MX records. For example, you might have: 31851268Seric 31951309Seric LOCAL_RULE_0 32051309Seric R$+ < @ cnmat.Berkeley.EDU > $#uucp $@ cnmat $: $1 32151309Seric 32251309SericYou would use this if you had installed an MX record for cnmat.Berkeley.EDU 32351309Sericpointing at this host; this rule catches the message and forwards it on 32451309Sericusing UUCP. 32551309Seric 32657246SericA similar macro is LOCAL_CONFIG. This introduces lines added after the 32757246Sericboilerplate option setting but before rulesets, and can be used to 32857246Sericoverride default options, declare local database maps, or whatever. 32957246SericFor example: 33051268Seric 33157246Seric LOCAL_CONFIG 33257246Seric Khostmap hash /etc/hostmap.db 33357246Seric Kyplocal nis -m hosts.byname 33457246Seric OJ/var/forward/$u:$z/.forward 33557246Seric OL3 33651220Seric 33757246Seric+---------------------------+ 33857246Seric| MASQUERADING AND RELAYING | 33957246Seric+---------------------------+ 34057246Seric 34157246SericYou can have your host masquerade as another using 34257246Seric 34357246Seric MASQUERADE_AS(host.domain) 34457246Seric 34557246SericThis causes outgoing SMTP mail to be labelled as coming from the 34657246Sericindicated domain, rather than $j. One normally masquerades as one 34757246Sericof your own subdomains (for example, it's unlikely that I would 34857246Sericchoose to masquerade as an MIT site). 34957246Seric 35057246Sericthere are always users that need to be "exposed" -- that is, their 35157246Sericinternal site name should be displayed instead of the masquerade name. 35257246SericRoot is an example. You can add users to this list using 35357246Seric 35457246Seric EXPOSED_USER(usernames) 35557246Seric 35657246SericThis adds users to class E; you could also use something like 35757246Seric 35857246Seric FE/etc/sendmail.cE 35957246Seric 36057246SericYou can also arrange to relay all unqualified names (that is, names 36157246Sericwithout @host) to a relay host. For example, if you have a central 36257246Sericemail server, you might relay to that host so that users don't have 36357246Sericto have .forward files or aliases. You can do this using 36457246Seric 36557246Seric define(`LOCAL_RELAY', hostname) 36657246Seric 36757246SericThere are some user names that you don't want relayed, perhaps because 36857246Sericof local aliases. A common example is root, which may be locally 36957246Sericaliased. You can add entries to this list using 37057246Seric 37157246Seric LOCAL_USER(usernames) 37257246Seric 37357246SericThis adds users to class L; you could also use something like 37457246Seric 37557246Seric FL/etc/sendmail.cL 37657246Seric 37757246Seric+-----------+ 37857246Seric| HIERARCHY | 37957246Seric+-----------+ 38057246Seric 38151220SericWithin this directory are several subdirectories, to wit: 38251220Seric 38351220Sericm4 General support routines. These are typically 38451220Seric very important and should not be changed without 385*57247Seric very careful consideration. 38651220Seric 38751220Sericcf The configuration files themselves. They have 38851220Seric ".mc" suffixes, and must be run through m4 to 38951220Seric become complete. The resulting output should 39051220Seric have a ".cf" suffix. 39151220Seric 39251220Sericostype Definitions describing a particular operating 39351220Seric system type. These should always be referenced 39451220Seric using the OSTYPE macro in the .mc file. Examples 39551220Seric include "bsd4.3", "bsd4.4", "sunos3.5", and 39651220Seric "sunos4.1". 39751220Seric 39851220Sericdomain Definitions describing a particular domain, referenced 39951220Seric using the DOMAIN macro in the .mc file. These are 40051220Seric site dependent; for example, we contribute "cs.exposed.m4" 40151220Seric and "cs.hidden.m4" which both describe hosts in the 40251220Seric CS.Berkeley.EDU subdomain; the former displays the local 40351220Seric hostname (e.g., mammoth.CS.Berkeley.EDU), whereas the 40451220Seric latter does its best to hide the identity of the local 40551220Seric workstation inside the CS subdomain. 40651220Seric 40751220Sericmailer Descriptions of mailers. These are referenced using 40851220Seric the MAILER macro in the .mc file. 40951220Seric 41051220Sericsh Shell files used when building the .cf file from the 41151220Seric .mc file in the cf subdirectory. 41251220Seric 41351220Sericfeature These hold special orthogonal features that you might 41451220Seric want to include. They should be referenced using 41551220Seric the FEATURE macro. 41651220Seric 41751220Serichack Local hacks. These can be referenced using the HACK 41851220Seric macro. They shouldn't be of more than voyeuristic 41951220Seric interest outside the .Berkeley.EDU domain, but who knows? 42051220Seric We've all got our own peccadilloes. 42151220Seric 42251268Sericsiteconfig Site configuration -- e.g., tables of locally connected 42351268Seric UUCP sites. 42451220Seric 42551268Seric 42657246Seric+------------------------+ 42757246Seric| ADMINISTRATIVE DETAILS | 42857246Seric+------------------------+ 42951220Seric 43051220SericThe following sections detail usage of certain internal parts of the 43151220Sericsendmail.cf file. Read them carefully if you are trying to modify 43251220Sericthe current model. If you find the above descriptions adequate, these 43351220Sericshould be {boring, confusing, tedious, ridiculous} (pick one or more). 43451220Seric 43551220SericRULESETS (* means built in to sendmail) 43651220Seric 43751220Seric 0 * Parsing 43851220Seric 1 * Sender rewriting 43951220Seric 2 * Recipient rewriting 44051220Seric 3 * Canonicalization 44151220Seric 4 * Post cleanup 44254839Seric 5 * Local address rewrite (after aliasing) 44351220Seric 6 Bottom half of Ruleset 3 444*57247Seric 7 Hook for recursive ruleset 0 call 445*57247Seric 8 446*57247Seric 9 44751220Seric 44851220Seric 44951220SericMAILERS 45051220Seric 45151220Seric 0 local, prog local and program mailers 45251220Seric 1 smtp SMTP channel 45351220Seric 2 uucp 45451220Seric 45551220Seric 45651220SericMACROS 45751220Seric 45851220Seric A 45951220Seric B Bitnet Relay 46051220Seric C CSNET Relay 46154839Seric D The local domain -- usually not needed 46251220Seric E 46351220Seric F 46451220Seric G 46551220Seric H 46651220Seric I 46751220Seric J 46851220Seric K 46951220Seric L 47051220Seric M Masquerade (who I claim to be) 47151220Seric N 47251220Seric O 47351220Seric P 47451220Seric Q 47551220Seric R Relay (for unqualified names) 47651220Seric S 47751220Seric T 47851309Seric U my UUCP name (if I have a UUCP connection) 47951309Seric V UUCP Relay (class V hosts) 48051220Seric W UUCP Relay (class W hosts) 48151220Seric X UUCP Relay (class X hosts) 48251309Seric Y UUCP Relay (all other hosts) 48351220Seric Z Version number 48451220Seric 48551220Seric 48651220SericCLASSES 48751220Seric 48851220Seric A 48951220Seric B 49051220Seric C 49151220Seric D 49257246Seric E addresses that should not seem to come from $M 49354839Seric F hosts we forward for 49451220Seric G 49551220Seric H 49651220Seric I 49751220Seric J 49851220Seric K 49951220Seric L addresses that should not be forwarded to $R 50051220Seric M 50151220Seric N 50251220Seric O operators that indicate network operations (cannot be in local names) 50351220Seric P 50451220Seric Q 50551220Seric R 50651220Seric S 50751220Seric T 50851220Seric U locally connected UUCP hosts 50951309Seric V UUCP hosts connected to relay $V 51051309Seric W UUCP hosts connected to relay $W 51151309Seric X UUCP hosts connected to relay $X 51251309Seric Y locally connected smart UUCP hosts 51351220Seric Z 51454839Seric . the class containing only a dot 51551220Seric 51651220Seric 51751220SericM4 DIVERSIONS 51851220Seric 51957246Seric 1 52051220Seric 2 Local Ruleset 0 additions 52151220Seric 3 Local Ruleset 3 additions 52251268Seric 4 UUCP Ruleset 0 additions 52351309Seric 5 locally interpreted names (overrides $R) 52454839Seric 6 local configuration (at top of file) 52551220Seric 7 mailer definitions 52654839Seric 8 special local name recognition (late in ruleset 3) 52751220Seric 9 528