Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!evax!texas!ylee From: ylee@csl.dl.nec.com (Ying-Da Lee) Newsgroups: comp.unix.admin Subject: Re: sendmail shock. Bibliography? Message-ID: <1991Apr11.193455.27104@csl.dl.nec.com> Date: 11 Apr 91 19:34:55 GMT References: Organization: NEC America, C & C Software Development Lab Lines: 245 In a field that has given the world all sorts of oddball tools and designs, it always amazes me how sendmail(.cf) has come to being shrouded in this mystique of unique incomprehension. In the tutorial on sys.admin. at the Dallas Usenix earlier this year, people were warned not to roll their own sendmail.cf. Even more saddly, though it was noted that an unconditional invocation of ruleset 3 at the beginning of rulest 0 as done in the sample sendmail.cf was probably unnecessary (it was), there wasn't even a suggestion that maybe it should be gotten rid of. If your sendmail accepts d option, try doing /usr/lib/sendmail -bt -d21.30 0 a@b.c.edu (or pick any of your favorite mail addresses) and watch pages of output flying by, then you may begin to suspect that perhaps there are quite a lot of obsolete garbage buried in your sendmail.cf. I got sick of all the messy sendmail.cf's soon after I had to deal with them. So, after careful readings of a good sample from Mr. Keith Moore of U. of Tennessee (thanks, Keith!), I sat down with 'Customizing sendmail Configuration Files' from Sun's manual and started to throw out Sun's rulesets and put in my own. We now have my version running on SunOS, BSD, Ultrix, and even Microsoft's 386 Unix, and I know what each and every rule in every single ruleset is doing! Do I know all about sendmail? Hardly. I never read a single line of code in the sendmail program. But that's just the point! Read the available documentation carefully, get a good sample sendmail.cf to give you some idea how it's done, and spend a little time experimenting with it (you don't have to dismantle the exiting mail system to do that), and I am sure many people will find the mystique of sendmail.cf is just that, mystique. In article dsurber@nasamail.nasa.gov writes: ... most convincingly of the need to document sendmail.cf. This is one of my primary concerns since I would hope sys.admins using my stuff can understand enough to take care of their own needs. Would the two excerpts (macro definitions and ruleset 3) shown below be considered sufficiently documented? Comments are welcome, and I'll be happy to discuss my own experience. Ying-Da Lee ylee@csl.dl.nec.com uunet!necbsd!ylee =================================================== # ============================================================== # Macros used: (defined using D) # Z Version of this sendmail.cf # B Mail gateway for BITNET # U Mail gateway for UUCP # D Local domain # F Defined if and only if file /etc/LDHOSTS exists # and contains names of all hosts in local domain. # G Next level mail gateway. See explanantion below. # If G is undefined, then this machine is a direct # mail contact point with the entire Internet. # P If not using DNS, should be undefined. If using # DNS, pick whichever works with your mailer. (In # other words, try and see.) # I My UUCP name. Defined only if we have UUCP connections. # # ============================================================== # Classes used: (defined using C or F) # A (C) For "steam-powered" test # I (C) All acceptable names for this host # S (C) Pseudo domains # U (C) My UUCP neighbors # F (F) list of hosts in local domain # (File name /etc/LDHOSTS) # # ============================================================== # Examine the line or lines immediately preceding a line of #^^^^^^^^^^^^^^^ # and modify it/them to suit the individual site. # # ============================================================== # # Things to beware of: # - Some mailers doesn't recognize ruleset that is numbered > 29. # - Some mailers requires that the very last ruleset is ruleset 0. # - Some mailers demands that each string in a class be a single # token, e.g., abc.def will be rejected. These are refered to # as steam-powered sendmail herein. # #=============================================================== # # For ver. 1.5: # # - Added simple detection of "steam-powered" sendmail. (Class # A and ruleset 28) # - Append unqualified names in To: and Cc: fields with # @localdomain as defined by macro D. # - Change the definition and use of macro j. # - Turn off automatic rebuild of alias file. # #=============================================================== # Version number of configuration file -- Change this after each mod DZYDL1.5-910409.10 #^^^^^^^^^^^^^^^ # number before - is base version, number after is yymmdd.hh of last # modification. # All admissible names for this machine, including IP address(es) in [] # Also include the local domain name if we are its mail gatway. CIflorida CIflorida.csl.dl.nec.com CI[143.101.64.3] #^^^^^^^^^^^^^^^ # NOTE: Some steam-powered mailers, e.g., the Ultrix mailer, # demands that each string in a class be a single token, thus # rejecting things like host.domain. For these pesky ones, we # just have to spell out the nicknames one per rule in # ruleset 0 near the beginning where we are stripping off # our own name. CAsteam.powered # To see if your sendmail is of the steam-powered variety (see # note above), get into address testing mode (option -bt) of sendmail # using (option -C) this sendmail.cf, and try # 28 steam.powered # If the final answer is yes, you have a steam-powered sendmail # and the beginning section of ruleset 0 has to be expanded. # (See S0 below.) #^^^^^^^^^^^^^^^ # Local domain # Mail for machines within local domain is always sent directly. # The sender field will conntain both the host name and the domain name. # The mailer used for such mail is 'lybin'. DDcsl.dl.nec.com #^^^^^^^^^^^^^^^ # My UUCP name. Defined only if we have UUCP connections. # Must be undefined otherwise. #DItexas #^^^^^^^^^^^^^^^ # File containing unqualified hostnames in local domain. # If undefined, all unqualified hostnames will be assume to be # in local domain. # Comment out next two lines if no such file exists. #DF #FF/etc/LDHOSTS #^^^^^^^^^^^^^^^ # Next level mail gateway. # The Mailer used for such mail is 'guabin'. # For mail clients in a division, define this as the divisional mail gateway. # For divisional mail gateway that can direct SMTP to all Internet # sites, make this undefined. # For divisional mail gateway that cannot SMTP to all Internet sites, # define this as the locational mail gateway. # For locational mail gateway, which must be able to SMTP to all Internet # sites, make this undefined. DGtexas.csl.dl.nec.com #^^^^^^^^^^^^^^^ # pseudo domains CSUUCP BITNET # UUCP gateway on Internet DUUUNET.UU.NET #^^^^^^^^^^^^^^^ # Our UUCP neighbors # Defined if and only if I is defined. #CUuufake #^^^^^^^^^^^^^^^ # BITNET gateway on Internet DBCUNYVM.CUNY.EDU #^^^^^^^^^^^^^^^ # Other candidates are: #DBCORNELLC.CIT.CORNELL.EDU #DBMITVMA.MIT.EDU #DBPSUVM.PSU.EDU # P should be undefined if not using Domain Name Service. # If using DNS, you may or may not have to use this definition # depneding on the mailer you use. DP. #^^^^^^^^^^^^^^^ # my official hostname # Should be fully qualified, including local domain. Dj$w # For system that does not include domain part in macro w, # use the following instead. #Dj$w.$D #^^^^^^^^^^^^^^ =============================================== S3 # find the next host and enclose it in <> # output will be in the form of # <@host>something ( from @host:... or @host,...:... # something<@host>anything ( from ...@host or ...%host # anything<@host.UUCP>something ( from host!... or ...@host.uucp... # something (this is for local derlivery) # @ (this is error condition) # handle "from:<>" special case R<> $@@ # basic textual canonicalization # if already containg <>, discard all except part inside the innermost <> R$*<$+>$* $2 # block in everything R$* $:<$1> # Look for leftmost @host in source route <@host,...,@host:user@host> # This also happens to work if : is used in place of , in the format. # We are assuming that there is no complication in the host part. R<@$+,$+:$+> $@<@$1>$2:$3 R<@$+:$+> $@<@$1>$2 # Look for rightmost @host within focused portion R$*<$+@$+>$* $1$2@<$3>$4 # above rule allows user@host@host...@host. Is this absolutely necessary? # Look for leftmost host! within focused portion R$*<$+!$+>$* $:$1<$2>!$3$4 # now look for rightmost %host within focused portion R$*<$+%$+>$* $1$2%<$3>$4 focus on rightmost %host # now tuck in the operative % or ! or @ # NOTE: the order of the next 3 rules is significant! R$+%<$+>$* $@$1<@$2>$3 R$*<$+>!$+ $@$1<@$2.UUCP>$3 R$+@<$+>$* $@$1<@$2>$3 R$*<$*>$* $@$1$2$3 local delivery or error