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