1# 2# Copyright (c) 1983 Eric P. Allman 3# Copyright (c) 1988, 1993 4# The Regents of the University of California. All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 3. All advertising materials mentioning features or use of this software 15# must display the following acknowledgement: 16# This product includes software developed by the University of 17# California, Berkeley and its contributors. 18# 4. Neither the name of the University nor the names of its contributors 19# may be used to endorse or promote products derived from this software 20# without specific prior written permission. 21# 22# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32# SUCH DAMAGE. 33# 34 35 36###################################################################### 37###################################################################### 38##### 39##### SENDMAIL CONFIGURATION FILE 40##### 41##### built by eric@vangogh.CS.Berkeley.EDU on Mon Apr 18 22:20:48 PDT 1994 42##### in /usr/src/usr.sbin/sendmail/cf/cf 43##### 44###################################################################### 45###################################################################### 46 47##### @(#)cf.m4 8.4 (Berkeley) 12/24/93 ##### 48 49##### @(#)sunos4.1-cs-exposed.mc 8.1 (Berkeley) 6/7/93 ##### 50 51##### @(#)sunos4.1.m4 8.1 (Berkeley) 6/7/93 ##### 52 53##### @(#)cs.exposed.m4 8.1 (Berkeley) 6/7/93 ##### 54 55##### @(#)Berkeley.m4 8.5 (Berkeley) 2/18/94 ##### 56 57##### @(#)redirect.m4 8.2 (Berkeley) 12/27/93 ##### 58 59 60 61 62##### @(#)use_cw_file.m4 8.1 (Berkeley) 6/7/93 ##### 63 64 65##### @(#)cssubdomain.m4 8.1 (Berkeley) 6/7/93 ##### 66 67 68 69 70##### @(#)proto.m4 8.45 (Berkeley) 3/4/94 ##### 71 72 73# level 5 config file format 74V5 75 76################## 77# local info # 78################## 79 80Cwlocalhost 81# file containing names of hosts for which we receive email 82Fw-o /etc/sendmail.cw 83 84 85CP. 86 87# UUCP relay host 88DYucbvax.Berkeley.EDU 89CPUUCP 90 91# BITNET relay host 92DBCMSA.Berkeley.EDU 93CPBITNET 94 95# "Smart" relay host (may be null) 96DS 97 98# who I send unqualified names to (null means deliver locally) 99DR 100 101# who gets all local email traffic ($R has precedence for unqualified names) 102DH 103 104# who I masquerade as (null for no masquerading) 105DM 106 107# class L: names that should be delivered locally, even if we have a relay 108# class E: names that should be exposed as from this host, even if we masquerade 109#CLroot 110CEroot 111 112# operators that cannot be in local usernames (i.e., network indicators) 113CO @ % ! 114 115# a class with just dot (for identifying canonical names) 116C.. 117 118# dequoting map 119Kdequote dequote 120 121 122CPREDIRECT 123 124###################### 125# Special macros # 126###################### 127 128# SMTP initial login message 129De$j Sendmail $v/$Z ready at $b 130 131# UNIX initial From header format 132DlFrom $g $d 133 134# my name for error messages 135DnMAILER-DAEMON 136 137# delimiter (operator) characters 138Do.:%@!^/[] 139 140# format of a total name 141Dq$?x$x <$g>$|$g$. 142 143# Configuration version number 144DZ8.6.9 145 146 147############### 148# Options # 149############### 150 151# strip message body to 7 bits on input? 152O7False 153 154# wait (in minutes) for alias file rebuild 155Oa10 156 157# location of alias file 158OA/etc/aliases 159 160# minimum number of free blocks on filesystem 161Ob4 162 163# substitution for space (blank) characters 164OB. 165 166# avoid connecting to "expensive" mailers on initial submission? 167OcFalse 168 169# checkpoint queue runs after every N successful deliveries 170OC10 171 172# default delivery mode 173Odbackground 174 175# automatically rebuild the alias database? 176ODFalse 177 178# error message header/file 179#OE/etc/sendmail.oE 180 181# error mode 182#Oep 183 184# save Unix-style "From_" lines at top of header? 185OfFalse 186 187# temporary file mode 188OF0600 189 190# match recipients against GECOS field? 191OGFalse 192 193# default GID 194Og1 195 196# maximum hop count 197Oh17 198 199# location of help file 200OH/usr/lib/sendmail.hf 201 202# ignore dots as terminators in incoming messages? 203OiFalse 204 205# Insist that the BIND name server be running to resolve names 206OI 207 208# deliver MIME-encapsulated error messages? 209OjTrue 210 211# Forward file search path 212OJ$z/.forward.$w:$z/.forward 213 214# open connection cache size 215Ok2 216 217# open connection cache timeout 218OK5m 219 220# use Errors-To: header? 221OlFalse 222 223# log level 224OL9 225 226# send to me too, even in an alias expansion? 227OmFalse 228 229# verify RHS in newaliases? 230OnTrue 231 232# default messages to old style headers if no special punctuation? 233OoTrue 234 235# SMTP daemon options 236#OOPort=esmtp 237 238# privacy flags 239Opauthwarnings 240 241# who (if anyone) should get extra copies of error messages 242#OPPostmaster 243 244# slope of queue-only function 245#Oq600000 246 247# queue directory 248OQ/var/spool/mqueue 249 250# read timeout -- now OK per RFC 1123 section 5.3.2 251#Ordatablock=10m 252 253# queue up everything before forking? 254OsTrue 255 256# status file 257OS/etc/sendmail.st 258 259# default message timeout interval 260OT5d/4h 261 262# time zone handling: 263# if undefined, use system default 264# if defined but null, use TZ envariable passed in 265# if defined and non-null, use that info 266#Ot 267 268# default UID 269Ou1 270 271# list of locations of user database file (null means no lookup) 272OU/usr/sww/share/lib/users.cs.db,/usr/sww/share/lib/users.eecs.db 273 274# fallback MX host 275#OVfall.back.host.net 276 277# if we are the best MX host for a site, try it directly instead of config err 278OwFalse 279 280# load average at which we just queue messages 281Ox8 282 283# load average at which we refuse connections 284OX12 285 286# work recipient factor 287#Oy30000 288 289# deliver each queued job in a separate process? 290OYFalse 291 292# work class factor 293#Oz1800 294 295# work time factor 296#OZ90000 297 298########################### 299# Message precedences # 300########################### 301 302Pfirst-class=0 303Pspecial-delivery=100 304Plist=-30 305Pbulk=-60 306Pjunk=-100 307 308##################### 309# Trusted users # 310##################### 311 312Troot 313Tdaemon 314Tuucp 315 316######################### 317# Format of headers # 318######################### 319 320H?P?Return-Path: $g 321HReceived: $?sfrom $s $.$?_($?s$|from $.$_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b 322H?D?Resent-Date: $a 323H?D?Date: $a 324H?F?Resent-From: $q 325H?F?From: $q 326H?x?Full-Name: $x 327HSubject: 328# HPosted-Date: $a 329# H?l?Received-Date: $b 330H?M?Resent-Message-Id: <$t.$i@$j> 331H?M?Message-Id: <$t.$i@$j> 332# 333###################################################################### 334###################################################################### 335##### 336##### REWRITING RULES 337##### 338###################################################################### 339###################################################################### 340 341 342########################################### 343### Rulset 3 -- Name Canonicalization ### 344########################################### 345S3 346 347# handle null input (translate to <@> special case) 348R$@ $@ <@> 349 350# basic textual canonicalization -- note RFC733 heuristic here 351R$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> 352R$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 353R$*<>$* $@ <@> MAIL FROM:<> case 354R$*<$+>$* $2 basic RFC821/822 parsing 355 356# handle list:; syntax as special case 357R$*:;$* $@ $1 :; <@> 358 359# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 360R@ $+ , $+ @ $1 : $2 change all "," to ":" 361 362# localize and dispose of route-based addresses 363R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr> 364 365# find focus for list syntax 366R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax 367R $+ : $* ; $@ $1 : $2; list syntax 368 369# find focus for @ syntax addresses 370R$+ @ $+ $: $1 < @ $2 > focus on domain 371R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 372R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical 373 374# do some sanity checking 375R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 376 377# convert old-style addresses to a domain-based address 378R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names 379R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps 380R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains 381 382# if we have % signs, take the rightmost one 383R$* % $* $1 @ $2 First make them all @s. 384R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 385R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish 386 387# else we must be a local name 388 389 390################################################ 391### Ruleset 96 -- bottom half of ruleset 3 ### 392################################################ 393 394# At this point, everything should be in a "local_part<@domain>extra" format. 395S96 396 397# handle special cases for local names 398R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 399R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 400R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain 401R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d] 402R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal 403R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr 404 405# find possible (old & new) versions of our name via short circuit hack 406# (this code should exist ONLY during the transition from .Berkeley.EDU 407# names to .CS.Berkeley.EDU names -- probably not more than a few months) 408R$* < @ $=w .CS.Berkeley.EDU > $* $: $1 < @ $j > $3 409R$* < @ $=w .Berkeley.EDU> $* $: $1 < @ $j > $3 410 411# pass UUCP addresses straight through 412R$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3 413 414# pass to name server to make hostname canonical 415R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4 416 417# local host aliases and pseudo-domains are always canonical 418R$* < @ $=w > $* $: $1 < @ $2 . > $3 419R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 420R$* < @ $* . . > $* $1 < @ $2 . > $3 421 422# if this is the local hostname, make sure we treat is as canonical 423R$* < @ $j > $* $: $1 < @ $j . > $2 424 425 426################################################## 427### Ruleset 4 -- Final Output Post-rewriting ### 428################################################## 429S4 430 431R$*<@> $@ $1 handle <> and list:; 432 433# strip trailing dot off possibly canonical name 434R$* < @ $+ . > $* $1 < @ $2 > $3 435 436# externalize local domain info 437R$* < $+ > $* $1 $2 $3 defocus 438R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 439R@ $* $@ @ $1 ... and exit 440 441# UUCP must always be presented in old form 442R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u 443 444# delete duplicate local names 445R$+ % $=w @ $=w $1 @ $j u%host@host => u@host 446 447 448 449############################################################## 450### Ruleset 97 -- recanonicalize and call ruleset zero ### 451### (used for recursive calls) ### 452############################################################## 453 454S97 455R$* $: $>3 $1 456R$* $@ $>0 $1 457 458 459###################################### 460### Ruleset 0 -- Parse Address ### 461###################################### 462 463S0 464 465R<@> $#local $: <> special case error msgs 466R$* : $* ; $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" 467R<@ $+> $#error $@ USAGE $: "user address required" 468R<$* : $* > $#error $@ USAGE $: "colon illegal in host name part" 469 470# handle numeric address spec 471R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec 472R$* < @ [ $+ ] > $* $#smtp $@ [$2] $: $1 < @ [$2] > $3 still numeric: send 473 474# now delete the local info -- note $=O to find characters that cause forwarding 475R$* < @ > $* $@ $>97 $1 user@ => user 476R< @ $=w . > : $* $@ $>97 $2 @here:... -> ... 477R$* $=O $* < @ $=w . > $@ $>97 $1 $2 $3 ...@here -> ... 478 479# handle local hacks 480R$* $: $>98 $1 481 482# short circuit local delivery so forwarded email works 483R$+ < @ $=w . > $: $1 < @ $2 . @ $H > first try hub 484R$+ < $+ @ $+ > $#local $: $1 yep .... 485R$+ < $+ @ > $#local $: @ $1 nope, local address 486 487# resolve remotely connected UUCP links (if any) 488 489# resolve fake top level domains by forwarding to other hosts 490R$*<@$+.BITNET.>$* $: $>95 < $B > $1 <@$2.BITNET.> $3 user@host.BITNET 491 492# forward non-local UUCP traffic to our UUCP relay 493R$*<@$*.UUCP.>$* $: $>95 < $Y > $1 <@$2.UUCP.> $3 uucp mail 494 495 496# pass names that still have a host to a smarthost (if defined) 497R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name 498 499# deal with other remote names 500R$* < @$* > $* $#smtp $@ $2 $: $1 < @ $2 > $3 user@host.domain 501 502# if this is quoted, strip the quotes and try again 503R$+ $: $(dequote $1 $) strip quotes 504R$+ $=O $+ $@ $>97 $1 $2 $3 try again 505 506# handle locally delivered names 507R$=L $#local $: @ $1 special local names 508R$+ $#local $: $1 regular local names 509 510########################################################################### 511### Ruleset 5 -- special rewriting after aliases have been expanded ### 512### (new sendmail only) ### 513########################################################################### 514 515S5 516 517# see if we have a relay or a hub 518R$+ $: < $R > $1 try relay 519R< > $+ $: < $H > $1 try hub 520R< > $+ $@ $1 nope, give up 521R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 > 522R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 > 523 524################################################################### 525### Ruleset 95 -- canonify mailer:host syntax to triple ### 526################################################################### 527 528S95 529R< > $* $@ $1 strip off null relay 530R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 531R< $=w > $* $@ $2 delete local host 532R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer 533 534################################################################### 535### Ruleset 98 -- local part of ruleset zero (can be null) ### 536################################################################### 537 538S98 539 540# addresses sent to foo@host.REDIRECT will give a 551 error code 541R$* < @ $+ .REDIRECT. > $# error $@ NOUSER $: "551 User not local; please try " <$1@$2> 542# 543###################################################################### 544###################################################################### 545##### 546##### MAILER DEFINITIONS 547##### 548###################################################################### 549###################################################################### 550 551 552################################################## 553### Local and Program Mailer specification ### 554################################################## 555 556##### @(#)local.m4 8.6 (Berkeley) 10/24/93 ##### 557 558Mlocal, P=/bin/mail, F=lsDFMrmn, S=10, R=20/40, 559 A=mail -d $u 560Mprog, P=/bin/sh, F=lsDFMeu, S=10, R=20/40, D=$z:/, 561 A=sh -c $u 562 563S10 564R<@> $n errors to mailer-daemon 565R$+ $: $>40 $1 566 567S20 568R$+ < @ $* > $: $1 strip host part 569 570S40 571 572##################################### 573### SMTP Mailer specification ### 574##################################### 575 576##### @(#)smtp.m4 8.15 (Berkeley) 2/14/94 ##### 577 578Msmtp, P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, 579 L=990, A=IPC $h 580Mesmtp, P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, 581 L=990, A=IPC $h 582Mrelay, P=[IPC], F=mDFMuXa, S=11/31, R=61, E=\r\n, 583 L=2040, A=IPC $h 584 585# 586# envelope sender and masquerading recipient rewriting 587# 588S11 589R$+ $: $>51 $1 sender/recipient common 590R$* :; <@> $@ $1 :; list:; special case 591R$* $@ $>61 $1 qualify unqual'ed names 592 593 594# 595# header recipient rewriting if not masquerading recipients 596# 597S21 598 599# do sender/recipient common rewriting 600R$+ $: $>51 $1 601 602# unqualified names (e.g., "eric") are qualified by local host 603R$* < @ $* > $* $@ $1 < @ $2 > $3 already qualified 604R$+ $: $1 < @ $j > add local domain 605 606 607# 608# header sender and masquerading recipient rewriting 609# 610S31 611R$+ $: $>51 $1 sender/recipient common 612R$* :; <@> $@ $1 :; list:; special case 613 614# do special header rewriting 615R$* <@> $* $@ $1 <@> $2 pass null host through 616R< @ $* > $* $@ < @ $1 > $2 pass route-addr through 617R$=E < @ $=w . > $@ $1 < @ $2 > exposed user as is 618R$* < @ $=w . > $: $1 < @ $2 @ $M > masquerade as domain 619R$* < @ $+ @ > $@ $1 < @ $2 > in case $M undefined 620R$* < @ $+ @ $+ > $@ $1 < @ $3 > $M is defined -- use it 621R$* $@ $>61 $1 qualify unqual'ed names 622 623 624# 625# convert pseudo-domain addresses to real domain addresses 626# 627S51 628 629# pass <route-addr>s through 630R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr> 631 632# output fake domains as user%fake@relay 633R$+ <@ $+ .BITNET. > $: $1 % $2 .BITNET < @ $B > user@host.BITNET 634R$+.BITNET <@ $+:$+ > $: $1 .BITNET < @ $3 > strip mailer: part 635 636# do UUCP heuristics; note that these are shared with UUCP mailers 637R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form 638R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form 639 640# leave these in .UUCP form to avoid further tampering 641R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. > 642R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 > 643R< $&h ! > $+ $@ $1 < @ $&h .UUCP. > 644R< $+ ! > $+ $: $1 ! $2 < @ $Y > 645R$+ < @ > $: $1 < @ $j > in case $Y undefined 646R$+ < @ $+ : $+ > $: $1 < @ $3 > strip mailer: part 647 648 649# 650# common sender and masquerading recipient rewriting 651# 652S61 653 654R$* < @ $* > $* $@ $1 < @ $2 > $3 already qualified 655R$=E $@ $1 < @ $j> show exposed names 656R$+ $: $1 < @ $M > user w/o host 657R$+ <@> $: $1 < @ $j > in case $M undefined 658