|
|
1.1 ! root 1: .if n .ls 2 ! 2: .he 'Sendmail Installation and Operation Guide''%' ! 3: .fo 'Version 4.2''Last Mod 7/28/83' ! 4: .nr si 3n ! 5: .de $0 ! 6: .(x ! 7: .in \\$3u*3n ! 8: .ti -3n ! 9: \\$2. \\$1 ! 10: .)x ! 11: .. ! 12: .de $C ! 13: .(x ! 14: .in 0 ! 15: \\$1 \\$2. \\$3 ! 16: .)x ! 17: .. ! 18: .+c ! 19: .(l C ! 20: .sz 16 ! 21: .b SENDMAIL ! 22: .sz 12 ! 23: .sp ! 24: .b "INSTALLATION AND OPERATION GUIDE" ! 25: .sz 10 ! 26: .sp ! 27: .r ! 28: Eric Allman ! 29: Britton-Lee, Inc. ! 30: .sp ! 31: Version 4.2 ! 32: .)l ! 33: .sp 2 ! 34: .pp ! 35: .i Sendmail ! 36: implements a general purpose internetwork mail routing facility ! 37: under the UNIX* ! 38: .(f ! 39: *UNIX is a trademark of Bell Laboratories. ! 40: .)f ! 41: operating system. ! 42: It is not tied to any one transport protocol \*- ! 43: its function may be likened to a crossbar switch, ! 44: relaying messages from one domain into another. ! 45: In the process, ! 46: it can do a limited amount of message header editing ! 47: to put the message into a format that is appropriate ! 48: for the receiving domain. ! 49: All of this is done under the control of a configuration file. ! 50: .pp ! 51: Due to the requirements of flexibility ! 52: for ! 53: .i sendmail , ! 54: the configuration file can seem somewhat unapproachable. ! 55: However, there are only a few basic configurations ! 56: for most sites, ! 57: for which standard configuration files have been supplied. ! 58: Most other configurations ! 59: can be built by adjusting an existing configuration files ! 60: incrementally. ! 61: .pp ! 62: Although ! 63: .i sendmail ! 64: is intended to run ! 65: without the need for monitoring, ! 66: it has a number of features ! 67: that may be used to monitor or adjust the operation ! 68: under unusual circumstances. ! 69: These features are described. ! 70: .pp ! 71: Section one describes how to do a basic ! 72: .i sendmail ! 73: installation. ! 74: Section two ! 75: explains the day-to-day information you should know ! 76: to maintain your mail system. ! 77: If you have a relatively normal site, ! 78: these two sections should contain sufficient information ! 79: for you to install ! 80: .i sendmail ! 81: and keep it happy. ! 82: Section three ! 83: describes some parameters that may be safely tweaked. ! 84: Section four ! 85: has information regarding the command line arguments. ! 86: Section five ! 87: contains the nitty-gritty information about the configuration ! 88: file. ! 89: This section is for masochists ! 90: and people who must write their own configuration file. ! 91: The appendixes give a brief ! 92: but detailed explanation of a number of features ! 93: not described in the rest of the paper. ! 94: .pp ! 95: The references in this paper are actually found ! 96: in the companion paper ! 97: .ul ! 98: Sendmail \- An Internetwork Mail Router. ! 99: This other paper should be read before this manual ! 100: to gain a basic understanding ! 101: of how the pieces fit together. ! 102: .sh 1 "BASIC INSTALLATION" ! 103: .pp ! 104: There are two basic steps to installing sendmail. ! 105: The hard part is to build the configuration table. ! 106: This is a file that sendmail reads when it starts up ! 107: that describes the mailers it knows about, ! 108: how to parse addresses, ! 109: how to rewrite the message header, ! 110: and the settings of various options. ! 111: Although the configuration table is quite complex, ! 112: a configuration can usually be built ! 113: by adjusting an existing off-the-shelf configuration. ! 114: The second part is actually doing the installation, ! 115: i.e., creating the necessary files, etc. ! 116: .pp ! 117: The remainder of this section will describe the installation of sendmail ! 118: assuming you can use one of the existing configurations ! 119: and that the standard installation parameters are acceptable. ! 120: All pathnames and examples ! 121: are given from the root of the ! 122: .i sendmail ! 123: subtree. ! 124: .sh 2 "Off-The-Shelf Configurations" ! 125: .pp ! 126: The configuration files ! 127: are all in the subdirectory ! 128: .i cf ! 129: of the sendmail directory. ! 130: The ones used at Berkeley are in ! 131: .i m4 \|(1) ! 132: format; ! 133: files with names ending ! 134: .q .m4 ! 135: are ! 136: .i m4 ! 137: include files, ! 138: while files with names ending ! 139: .q .mc ! 140: are the master files. ! 141: Files with names ending ! 142: .q .cf ! 143: are the ! 144: .i m4 ! 145: processed versions of the corresponding ! 146: .q .mc ! 147: file. ! 148: .pp ! 149: Two off the shelf configuration files are supplied ! 150: to handle the basic cases: ! 151: .i cf/arpaproto.cf ! 152: for Arpanet (TCP) sites ! 153: and ! 154: .i cf/uucpproto.cf ! 155: for UUCP sites. ! 156: These are ! 157: .i not ! 158: in ! 159: .i m4 ! 160: format. ! 161: The file you need should be copied to a file with the same name ! 162: as your system, ! 163: e.g., ! 164: .(b ! 165: cp uucpproto.cf ucsfcgl.cf ! 166: .)b ! 167: This file ! 168: is now ready for installation as ! 169: .i /usr/lib/sendmail.cf . ! 170: .sh 2 "Installation Using the Makefile" ! 171: .pp ! 172: A makefile exists in the root of the ! 173: .i sendmail ! 174: directory that will do all of these steps ! 175: for a 4.2bsd system. ! 176: It may have to be slightly tailored ! 177: for use on other systems. ! 178: .pp ! 179: Before using this makefile, ! 180: you should already have created your configuration file ! 181: and left it in the file ! 182: .q cf/\fIsystem\fP.cf ! 183: where ! 184: .i system ! 185: is the name of your system ! 186: (i.e., what is returned by ! 187: .i hostname \|(1)). ! 188: If you do not have ! 189: .i hostname ! 190: you can use the declaration ! 191: .q HOST=\fIsystem\fP ! 192: on the ! 193: .i make \|(1) ! 194: command line. ! 195: You should also examine the file ! 196: .i md/config.m4 ! 197: and change the ! 198: .i m4 ! 199: macros there to reflect any libraries and compilation flags ! 200: you may need. ! 201: .pp ! 202: The basic installation procedure is to type: ! 203: .(b ! 204: make ! 205: make install ! 206: .)b ! 207: in the root directory of the ! 208: .i sendmail ! 209: distribution. ! 210: This will make all binaries ! 211: and install them in the standard places. ! 212: The second ! 213: .i make ! 214: command must be executed as the superuser (root). ! 215: .sh 2 "Installation by Hand" ! 216: .pp ! 217: Along with building a configuration file, ! 218: you will have to install the ! 219: .i sendmail ! 220: startup into your UNIX system. ! 221: If you are doing this installation ! 222: in conjunction with a regular Berkeley UNIX install, ! 223: these steps will already be complete. ! 224: Many of these steps will have to be executed as the superuser (root). ! 225: .sh 3 "lib/libsys.a" ! 226: .pp ! 227: The library in lib/libsys.a ! 228: contains some routines that should in some sense ! 229: be part of the system library. ! 230: These are the system logging routines ! 231: and the new directory access routines ! 232: (if required). ! 233: If you are not running the new 4.2bsd directory code ! 234: and do not have the compatibility routines installed in your system library, ! 235: you should execute the commands: ! 236: .(b ! 237: cd lib ! 238: make ndir ! 239: .)b ! 240: This will compile and install the 4.2 compatibility routines ! 241: in the library. ! 242: You should then type: ! 243: .(b ! 244: cd lib # if required ! 245: make ! 246: .)b ! 247: This will recompile and fill the library. ! 248: .sh 3 "/usr/lib/sendmail" ! 249: .pp ! 250: The binary for sendmail is located in /usr/lib. ! 251: There is a version available in the source directory ! 252: that is probably inadequate for your system. ! 253: You should plan on recompiling and installing the entire system: ! 254: .(b ! 255: cd src ! 256: rm \-f *.o ! 257: make ! 258: cp sendmail /usr/lib ! 259: .)b ! 260: .sh 3 "/usr/lib/sendmail.cf" ! 261: .pp ! 262: The configuration file ! 263: that you created earlier ! 264: should be installed in /usr/lib/sendmail.cf: ! 265: .(b ! 266: cp cf/\fIsystem\fP.cf /usr/lib/sendmail.cf ! 267: .)b ! 268: .sh 3 "/usr/ucb/newaliases" ! 269: .pp ! 270: If you are running delivermail, ! 271: it is critical that the ! 272: .i newaliases ! 273: command be replaced. ! 274: This can just be a link to ! 275: .i sendmail : ! 276: .(b ! 277: rm \-f /usr/ucb/newaliases ! 278: ln /usr/lib/sendmail /usr/ucb/newaliases ! 279: .)b ! 280: .sh 3 "/usr/lib/sendmail.cf" ! 281: .pp ! 282: The configuration file must be installed in /usr/lib. ! 283: This is described above. ! 284: .sh 3 "/usr/spool/mqueue" ! 285: .pp ! 286: The directory ! 287: .i /usr/spool/mqueue ! 288: should be created to hold the mail queue. ! 289: This directory should be mode 777 ! 290: unless ! 291: .i sendmail ! 292: is run setuid, ! 293: when ! 294: .i mqueue ! 295: should be owned by the sendmail owner ! 296: and mode 755. ! 297: .sh 3 "/usr/lib/aliases*" ! 298: .pp ! 299: The system aliases are held in three files. ! 300: The file ! 301: .q /usr/lib/aliases ! 302: is the master copy. ! 303: A sample is given in ! 304: .q lib/aliases ! 305: which includes some aliases which ! 306: .i must ! 307: be defined: ! 308: .(b ! 309: cp lib/aliases /usr/lib/aliases ! 310: .)b ! 311: You should extend this file with any aliases that are apropos to your system. ! 312: .pp ! 313: Normally ! 314: .i sendmail ! 315: looks at a version of these files maintained by the ! 316: .i dbm \|(3) ! 317: routines. ! 318: These are stored in ! 319: .q /usr/lib/aliases.dir ! 320: and ! 321: .q /usr/lib/aliases.pag. ! 322: These can initially be created as empty files, ! 323: but they will have to be initialized promptly. ! 324: These should be mode 666 if you are running a reasonably relaxed system: ! 325: .(b ! 326: cp /dev/null /usr/lib/aliases.dir ! 327: cp /dev/null /usr/lib/aliases.pag ! 328: chmod 666 /usr/lib/aliases.* ! 329: newaliases ! 330: .)b ! 331: .sh 3 "/usr/lib/sendmail.fc" ! 332: .pp ! 333: If you intend to install the frozen version of the configuration file ! 334: (for quick startup) ! 335: you should create the file /usr/lib/sendmail.fc ! 336: and initialize it. ! 337: This step may be safely skipped. ! 338: .(b ! 339: cp /dev/null /usr/lib/sendmail.fc ! 340: /usr/lib/sendmail \-bz ! 341: .)b ! 342: .sh 3 "/etc/rc" ! 343: .pp ! 344: It will be necessary to start up the sendmail daemon when your system reboots. ! 345: This daemon performs two functions: ! 346: it listens on the SMTP socket for connections ! 347: (to receive mail from a remote system) ! 348: and it processes the queue periodically ! 349: to insure that mail gets delivered when hosts come up. ! 350: .pp ! 351: Add the following lines to ! 352: .q /etc/rc ! 353: (or ! 354: .q /etc/rc.local ! 355: as appropriate) ! 356: in the area where it is starting up the daemons: ! 357: .(b ! 358: if [ \-f /usr/lib/sendmail ]; then ! 359: (cd /usr/spool/mqueue; rm \-f [lnx]f*) ! 360: /usr/lib/sendmail \-bd \-q30m & ! 361: echo \-n ' sendmail' >/dev/console ! 362: fi ! 363: .)b ! 364: The ! 365: .q cd ! 366: and ! 367: .q rm ! 368: commands insure that all lock files have been removed; ! 369: extraneous lock files may be left around ! 370: if the system goes down in the middle of processing a message. ! 371: The line that actually invokes ! 372: .i sendmail ! 373: has two flags: ! 374: .q \-bd ! 375: causes it to listen on the SMTP port, ! 376: and ! 377: .q \-q30m ! 378: causes it to run the queue every half hour. ! 379: .pp ! 380: If you are not running a version of UNIX ! 381: that supports Berkeley TCP/IP, ! 382: do not include the ! 383: .b \-bd ! 384: flag. ! 385: .sh 3 "/usr/lib/sendmail.hf" ! 386: .pp ! 387: This is the help file used by the SMTP ! 388: .b HELP ! 389: command. ! 390: It should be copied from ! 391: .q lib/sendmail.hf : ! 392: .(b ! 393: cp lib/sendmail.hf /usr/lib ! 394: .)b ! 395: .sh 3 "/usr/lib/sendmail.st" ! 396: .pp ! 397: If you wish to collect statistics ! 398: about your mail traffic, ! 399: you should create the file ! 400: .q /usr/lib/sendmail.st : ! 401: .(b ! 402: cp /dev/null /usr/lib/sendmail.st ! 403: chmod 666 /usr/lib/sendmail.st ! 404: .)b ! 405: This file does not grow. ! 406: It is printed with the program ! 407: .q aux/mailstats. ! 408: .sh 3 "/etc/syslog" ! 409: .pp ! 410: You may want to run the ! 411: .i syslog ! 412: program ! 413: (to collect log information about sendmail). ! 414: This program normally resides in ! 415: .i /etc/syslog, ! 416: with support files ! 417: .i /etc/syslog.conf ! 418: and ! 419: .i /etc/syslog.pid . ! 420: The program is located in the ! 421: .i aux ! 422: subdirectory of the ! 423: .i sendmail ! 424: distribution. ! 425: The file ! 426: .i /etc/syslog.conf ! 427: describes the file(s) that sendmail will log in. ! 428: For a complete description of syslog, ! 429: see the manual page for ! 430: .i syslog \|(8) ! 431: (located in ! 432: .i sendmail/doc ! 433: on the distribution). ! 434: .sh 3 "/usr/ucb/newaliases" ! 435: .pp ! 436: If ! 437: .i sendmail ! 438: is invoked as ! 439: .q newaliases, ! 440: it will simulate the ! 441: .b \-bi ! 442: flag ! 443: (i.e., will rebuild the alias database; ! 444: see below). ! 445: This should be a link to /usr/lib/sendmail. ! 446: .sh 3 "/usr/ucb/mailq" ! 447: .pp ! 448: If ! 449: .i sendmail ! 450: is invoked as ! 451: .q mailq, ! 452: it will simulate the ! 453: .b \-bp ! 454: flag ! 455: (i.e., ! 456: .i sendmail ! 457: will print the contents of the mail queue; ! 458: see below). ! 459: This should be a link to /usr/lib/sendmail. ! 460: .sh 1 "NORMAL OPERATIONS" ! 461: .sh 2 "Quick Configuration Startup" ! 462: .pp ! 463: A fast version of the configuration file ! 464: may be set up by using the ! 465: .b \-bz ! 466: flag: ! 467: .(b ! 468: /usr/lib/sendmail \-bz ! 469: .)b ! 470: This creates the file ! 471: .i /usr/lib/sendmail.fc ! 472: (\c ! 473: .q "frozen configuration" ). ! 474: This file is an image of ! 475: .i sendmail 's ! 476: data space after reading in the configuration file. ! 477: If this file exists, ! 478: it is used instead of ! 479: .i /usr/lib/sendmail.cf ! 480: .i sendmail.fc ! 481: must be rebuilt manually every time ! 482: .i sendmail.cf ! 483: is changed. ! 484: .pp ! 485: The frozen configuration file will be ignored ! 486: if a ! 487: .b \-C ! 488: flag is specified ! 489: or if sendmail detects that it is out of date. ! 490: However, the heuristics are not strong ! 491: so this should not be trusted. ! 492: .sh 2 "The System Log" ! 493: .pp ! 494: The system log is supported by the ! 495: .i syslog \|(8) ! 496: program. ! 497: .sh 3 "Format" ! 498: .pp ! 499: Each line in the system log ! 500: consists of a timestamp, ! 501: the name of the machine that generated it ! 502: (for logging from several machines ! 503: over the ethernet), ! 504: the word ! 505: .q sendmail: , ! 506: and a message. ! 507: .sh 3 "Levels" ! 508: .pp ! 509: If you have ! 510: .i syslog \|(8) ! 511: or an equivalent installed, ! 512: you will be able to do logging. ! 513: There is a large amount of information that can be logged. ! 514: The log is arranged as a succession of levels. ! 515: At the lowest level ! 516: only extremely strange situations are logged. ! 517: At the highest level, ! 518: even the most mundane and uninteresting events ! 519: are recorded for posterity. ! 520: As a convention, ! 521: log levels under ten ! 522: are considered ! 523: .q useful; ! 524: log levels above ten ! 525: are usually for debugging purposes. ! 526: .pp ! 527: A complete description of the log levels ! 528: is given in section 4.3. ! 529: .sh 2 "The Mail Queue" ! 530: .pp ! 531: The mail queue should be processed transparently. ! 532: However, you may find that manual intervention is sometimes necessary. ! 533: For example, ! 534: if a major host is down for a period of time ! 535: the queue may become clogged. ! 536: Although sendmail ought to recover gracefully when the host comes up, ! 537: you may find performance unacceptably bad in the meantime. ! 538: .sh 3 "Printing the queue" ! 539: .pp ! 540: The contents of the queue can be printed ! 541: using the ! 542: .i mailq ! 543: command ! 544: (or by specifying the ! 545: .b \-bp ! 546: flag to sendmail): ! 547: .(b ! 548: mailq ! 549: .)b ! 550: This will produce a listing of the queue id's, ! 551: the size of the message, ! 552: the date the message entered the queue, ! 553: and the sender and recipients. ! 554: .sh 3 "Format of queue files" ! 555: .pp ! 556: All queue files have the form ! 557: \fIx\fP\|\fBf\fP\fIAA99999\fP ! 558: where ! 559: .i AA99999 ! 560: is the ! 561: .i id ! 562: for this file ! 563: and the ! 564: .i x ! 565: is a type. ! 566: The types are: ! 567: .ip d ! 568: The data file. ! 569: The message body (excluding the header) is kept in this file. ! 570: .ip l ! 571: The lock file. ! 572: If this file exists, ! 573: the job is currently being processed, ! 574: and a queue run will not process the file. ! 575: For that reason, ! 576: an extraneous ! 577: .b lf ! 578: file can cause a job to apparently disappear ! 579: (it will not even time out!). ! 580: .ip n ! 581: This file is created when an id is being created. ! 582: It is a separate file to insure that no mail can ever be destroyed ! 583: due to a race condition. ! 584: It should exist for no more than a few milliseconds ! 585: at any given time. ! 586: .ip q ! 587: The queue control file. ! 588: This file contains the information necessary to process the job. ! 589: .ip t ! 590: A temporary file. ! 591: These are an image of the ! 592: .b qf ! 593: file when it is being rebuilt. ! 594: It should be renamed to a ! 595: .b qf ! 596: file very quickly. ! 597: .ip x ! 598: A transcript file, ! 599: existing during the life of a session ! 600: showing everything that happens ! 601: during that session. ! 602: .pp ! 603: The ! 604: .b qf ! 605: file is structured as a series of lines ! 606: each beginning with a code letter. ! 607: The lines are as follows: ! 608: .ip D ! 609: The name of the data file. ! 610: There may only be one of these lines. ! 611: .ip H ! 612: A header definition. ! 613: There may be any number of these lines. ! 614: The order is important: ! 615: they represent the order in the final message. ! 616: These use the same syntax ! 617: as header definitions in the configuration file. ! 618: .ip R ! 619: A recipient address. ! 620: This will normally be completely aliased, ! 621: but is actually realiased when the job is processed. ! 622: There will be one line ! 623: for each recipient. ! 624: .ip S ! 625: The sender address. ! 626: There may only be one of these lines. ! 627: .ip T ! 628: The job creation time. ! 629: This is used to compute when to time out the job. ! 630: .ip P ! 631: The current message priority. ! 632: This is used to order the queue. ! 633: Higher numbers mean lower priorities. ! 634: The priority increases ! 635: as the message sits in the queue. ! 636: The initial priority depends on the message class ! 637: and the size of the message. ! 638: .ip M ! 639: A message. ! 640: This line is printed by the ! 641: .i mailq ! 642: command, ! 643: and is generally used to store status information. ! 644: It can contain any text. ! 645: .pp ! 646: As an example, ! 647: the following is a queue file sent to ! 648: .q mckusick@calder ! 649: and ! 650: .q wnj : ! 651: .(b ! 652: DdfA13557 ! 653: Seric ! 654: T404261372 ! 655: P132 ! 656: Rmckusick@calder ! 657: Rwnj ! 658: H?D?date: 23-Oct-82 15:49:32-PDT (Sat) ! 659: H?F?from: eric (Eric Allman) ! 660: H?x?full-name: Eric Allman ! 661: Hsubject: this is an example message ! 662: Hmessage-id: <[email protected]> ! 663: Hreceived: by UCBARPA.BERKELEY.ARPA (3.227 [10/22/82]) ! 664: id A13557; 23-Oct-82 15:49:32-PDT (Sat) ! 665: Hphone: (415) 548-3211 ! 666: HTo: mckusick@calder, wnj ! 667: .)b ! 668: This shows the name of the data file, ! 669: the person who sent the message, ! 670: the submission time ! 671: (in seconds since January 1, 1970), ! 672: the message priority, ! 673: the message class, ! 674: the recipients, ! 675: and the headers for the message. ! 676: .sh 3 "Forcing the queue" ! 677: .pp ! 678: .i Sendmail ! 679: should run the queue automatically ! 680: at intervals. ! 681: The algorithm is to read and sort the queue, ! 682: and then to attempt to process all jobs in order. ! 683: When it attempts to run the job, ! 684: .i sendmail ! 685: first checks to see if the job is locked. ! 686: If so, it ignores the job. ! 687: .pp ! 688: There is no attempt to insure that only one queue processor ! 689: exists at any time, ! 690: since there is no guarantee that a job cannot take forever ! 691: to process. ! 692: Due to the locking algorithm, ! 693: it is impossible for one job to freeze the queue. ! 694: However, ! 695: an uncooperative recipient host ! 696: or a program recipient ! 697: that never returns ! 698: can accumulate many processes in your system. ! 699: Unfortunately, ! 700: there is no way to resolve this ! 701: without violating the protocol. ! 702: .pp ! 703: In some cases, ! 704: you may find that a major host going down ! 705: for a couple of days ! 706: may create a prohibitively large queue. ! 707: This will result in ! 708: .i sendmail ! 709: spending an inordinate amount of time ! 710: sorting the queue. ! 711: This situation can be fixed by moving the queue to a temporary place ! 712: and creating a new queue. ! 713: The old queue can be run later when the offending host returns to service. ! 714: .pp ! 715: To do this, ! 716: it is acceptable to move the entire queue directory: ! 717: .(b ! 718: cd /usr/spool ! 719: mv mqueue omqueue; mkdir mqueue; chmod 777 mqueue ! 720: .)b ! 721: You should then kill the existing daemon ! 722: (since it will still be processing in the old queue directory) ! 723: and create a new daemon. ! 724: .pp ! 725: To run the old mail queue, ! 726: run the following command: ! 727: .(b ! 728: /usr/lib/sendmail \-oQ/usr/spool/omqueue \-q ! 729: .)b ! 730: The ! 731: .b \-oQ ! 732: flag specifies an alternate queue directory ! 733: and the ! 734: .b \-q ! 735: flag says to just run every job in the queue. ! 736: If you have a tendency toward voyeurism, ! 737: you can use the ! 738: .b \-v ! 739: flag to watch what is going on. ! 740: .pp ! 741: When the queue is finally emptied, ! 742: you can remove the directory: ! 743: .(b ! 744: rmdir /usr/spool/omqueue ! 745: .)b ! 746: .sh 2 "The Alias Database" ! 747: .pp ! 748: The alias database exists in two forms. ! 749: One is a text form, ! 750: maintained in the file ! 751: .i /usr/lib/aliases. ! 752: The aliases are of the form ! 753: .(b ! 754: name: name1, name2, ... ! 755: .)b ! 756: Only local names may be aliased; ! 757: e.g., ! 758: .(b ! 759: eric@mit-xx: eric@berkeley ! 760: .)b ! 761: will not have the desired effect. ! 762: Aliases may be continued by starting any continuation lines ! 763: with a space or a tab. ! 764: Blank lines and lines beginning with a sharp sign ! 765: (\c ! 766: .q # ) ! 767: are comments. ! 768: .pp ! 769: The second form is processed by the ! 770: .i dbm \|(3) ! 771: library. ! 772: This form is in the files ! 773: .i /usr/lib/aliases.dir ! 774: and ! 775: .i /usr/lib/aliases.pag. ! 776: This is the form that ! 777: .i sendmail ! 778: actually uses to resolve aliases. ! 779: This technique is used to improve performance. ! 780: .sh 3 "Rebuilding the alias database" ! 781: .pp ! 782: The DBM version of the database ! 783: may be rebuilt explicitly by executing the command ! 784: .(b ! 785: newaliases ! 786: .)b ! 787: This is equivalent to giving ! 788: .i sendmail ! 789: the ! 790: .b \-bi ! 791: flag: ! 792: .(b ! 793: /usr/lib/sendmail \-bi ! 794: .)b ! 795: .pp ! 796: If the ! 797: .q D ! 798: option is specified in the configuration, ! 799: .i sendmail ! 800: will rebuild the alias database automatically ! 801: if possible ! 802: when it is out of date. ! 803: The conditions under which it will do this are: ! 804: .np ! 805: The DBM version of the database is mode 666. -or- ! 806: .np ! 807: .i Sendmail ! 808: is running setuid to root. ! 809: .lp ! 810: Auto-rebuild can be dangerous ! 811: on heavily loaded machines ! 812: with large alias files; ! 813: if it might take more than five minutes ! 814: to rebuild the database, ! 815: there is a chance that several processes will start the rebuild process ! 816: simultaneously. ! 817: .sh 3 "Potential problems" ! 818: .pp ! 819: There are a number of problems that can occur ! 820: with the alias database. ! 821: They all result from a ! 822: .i sendmail ! 823: process accessing the DBM version ! 824: while it is only partially built. ! 825: This can happen under two circumstances: ! 826: One process accesses the database ! 827: while another process is rebuilding it, ! 828: or the process rebuilding the database dies ! 829: (due to being killed or a system crash) ! 830: before completing the rebuild. ! 831: .pp ! 832: Sendmail has two techniques to try to relieve these problems. ! 833: First, it ignores interrupts while rebuilding the database; ! 834: this avoids the problem of someone aborting the process ! 835: leaving a partially rebuilt database. ! 836: Second, ! 837: at the end of the rebuild ! 838: it adds an alias of the form ! 839: .(b ! 840: @: @ ! 841: .)b ! 842: (which is not normally legal). ! 843: Before sendmail will access the database, ! 844: it checks to insure that this entry exists\**. ! 845: .(f ! 846: \**The ! 847: .q a ! 848: option is required in the configuration ! 849: for this action to occur. ! 850: This should normally be specified ! 851: unless you are running ! 852: .i delivermail ! 853: in parallel with ! 854: .i sendmail. ! 855: .)f ! 856: It will wait up to five minutes ! 857: for this entry to appear, ! 858: at which point it will force a rebuild itself\**. ! 859: .(f ! 860: \**Note: ! 861: the ! 862: .q D ! 863: option must be specified in the configuration file ! 864: for this operation to occur. ! 865: .)f ! 866: .sh 3 "List owners" ! 867: .pp ! 868: If an error occurs on sending to a certain address, ! 869: say ! 870: .q \fIx\fP , ! 871: .i sendmail ! 872: will look for an alias ! 873: of the form ! 874: .q owner-\fIx\fP ! 875: to receive the errors. ! 876: This is typically useful ! 877: for a mailing list ! 878: where the submitter of the list ! 879: has no control over the maintanence of the list itself; ! 880: in this case the list maintainer would be the owner of the list. ! 881: For example: ! 882: .(b ! 883: unix-wizards: eric@ucbarpa, wnj@monet, nosuchuser, ! 884: sam@matisse ! 885: owner-unix-wizards: eric@ucbarpa ! 886: .)b ! 887: would cause ! 888: .q eric@ucbarpa ! 889: to get the error that will occur ! 890: when someone sends to ! 891: unix-wizards ! 892: due to the inclusion of ! 893: .q nosuchuser ! 894: on the list. ! 895: .sh 2 "Per-User Forwarding (.forward Files)" ! 896: .pp ! 897: As an alternative to the alias database, ! 898: any user may put a file with the name ! 899: .q .forward ! 900: in his or her home directory. ! 901: If this file exists, ! 902: .i sendmail ! 903: redirects mail for that user ! 904: to the list of addresses listed in the .forward file. ! 905: For example, if the home directory for user ! 906: .q mckusick ! 907: has a .forward file with contents: ! 908: .(b ! 909: mckusick@ernie ! 910: kirk@calder ! 911: .)b ! 912: then any mail arriving for ! 913: .q mckusick ! 914: will be redirected to the specified accounts. ! 915: .sh 2 "Special Header Lines" ! 916: .pp ! 917: Several header lines have special interpretations ! 918: defined by the configuration file. ! 919: Others have interpretations built into ! 920: .i sendmail ! 921: that cannot be changed without changing the code. ! 922: These builtins are described here. ! 923: .sh 3 "Return-Receipt-To:" ! 924: .pp ! 925: If this header is sent, ! 926: a message will be sent to any specified addresses ! 927: when the final delivery is complete. ! 928: if the mailer has the ! 929: .b l ! 930: flag (local delivery) set in the mailer descriptor. ! 931: .sh 3 "Errors-To:" ! 932: .pp ! 933: If errors occur anywhere during processing, ! 934: this header will cause error messages to go to ! 935: the listed addresses ! 936: rather than to the sender. ! 937: This is intended for mailing lists. ! 938: .sh 3 "Apparently-To:" ! 939: .pp ! 940: If a message comes in with no recipients listed in the message ! 941: (in a To:, Cc:, or Bcc: line) ! 942: then ! 943: .i sendmail ! 944: will add an ! 945: .q "Apparently-To:" ! 946: header line for any recipients it is aware of. ! 947: This is not put in as a standard recipient line ! 948: to warn any recipients that the list is not complete. ! 949: .pp ! 950: At least one recipient line is required under RFC 822. ! 951: .sh 1 "ARGUMENTS" ! 952: .pp ! 953: The complete list of arguments to ! 954: .i sendmail ! 955: is described in detail in Appendix A. ! 956: Some important arguments are described here. ! 957: .sh 2 "Queue Interval" ! 958: .pp ! 959: The amount of time between forking a process ! 960: to run through the queue ! 961: is defined by the ! 962: .b \-q ! 963: flag. ! 964: If you run in mode ! 965: .b f ! 966: or ! 967: .b a ! 968: this can be relatively large, ! 969: since it will only be relevant ! 970: when a host that was down comes back up. ! 971: If you run in ! 972: .b q ! 973: mode ! 974: it should be relatively short, ! 975: since it defines the maximum amount of time that a message ! 976: may sit in the queue. ! 977: .sh 2 "Daemon Mode" ! 978: .pp ! 979: If you allow incoming mail over an IPC connection, ! 980: you should have a daemon running. ! 981: This should be set by your ! 982: .i /etc/rc ! 983: file using the ! 984: .b \-bd ! 985: flag. ! 986: The ! 987: .b \-bd ! 988: flag and the ! 989: .b \-q ! 990: flag may be combined in one call: ! 991: .(b ! 992: /usr/lib/sendmail \-bd \-q30m ! 993: .)b ! 994: .sh 2 "Forcing the Queue" ! 995: .pp ! 996: In some cases you may find that the queue has gotten clogged for some reason. ! 997: You can force a queue run ! 998: using the ! 999: .b \-q ! 1000: flag (with no value). ! 1001: It is entertaining to use the ! 1002: .b \-v ! 1003: flag (verbose) ! 1004: when this is done to watch what happens: ! 1005: .(b ! 1006: /usr/lib/sendmail \-q \-v ! 1007: .)b ! 1008: .sh 2 "Debugging" ! 1009: .pp ! 1010: There are a fairly large number of debug flags ! 1011: built into ! 1012: .i sendmail . ! 1013: Each debug flag has a number and a level, ! 1014: where higher levels means to print out more information. ! 1015: The convention is that levels greater than nine are ! 1016: .q absurd, ! 1017: i.e., ! 1018: they print out so much information that you wouldn't normally ! 1019: want to see them except for debugging that particular piece of code. ! 1020: Debug flags are set using the ! 1021: .b \-d ! 1022: option; ! 1023: the syntax is: ! 1024: .(b ! 1025: .ta \w'debug-option 'u ! 1026: debug-flag: \fB\-d\fP debug-list ! 1027: debug-list: debug-option [ , debug-option ] ! 1028: debug-option: debug-range [ . debug-level ] ! 1029: debug-range: integer | integer \- integer ! 1030: debug-level: integer ! 1031: .)b ! 1032: where spaces are for reading ease only. ! 1033: For example, ! 1034: .(b ! 1035: \-d12 Set flag 12 to level 1 ! 1036: \-d12.3 Set flag 12 to level 3 ! 1037: \-d3-17 Set flags 3 through 17 to level 1 ! 1038: \-d3-17.4 Set flags 3 through 17 to level 4 ! 1039: .)b ! 1040: For a complete list of the available debug flags ! 1041: you will have to look at the code ! 1042: (they are too dynamic to keep this documentation up to date). ! 1043: .sh 2 "Trying a Different Configuration File" ! 1044: .pp ! 1045: An alternative configuration file ! 1046: can be specified using the ! 1047: .b \-C ! 1048: flag; for example, ! 1049: .(b ! 1050: /usr/lib/sendmail \-Ctest.cf ! 1051: .)b ! 1052: uses the configuration file ! 1053: .i test.cf ! 1054: instead of the default ! 1055: .i /usr/lib/sendmail.cf. ! 1056: If the ! 1057: .b \-C ! 1058: flag has no value ! 1059: it defaults to ! 1060: .i sendmail.cf ! 1061: in the current directory. ! 1062: .sh 2 "Changing the Values of Options" ! 1063: .pp ! 1064: Options can be overridden using the ! 1065: .b \-o ! 1066: flag. ! 1067: For example, ! 1068: .(b ! 1069: /usr/lib/sendmail \-oT2m ! 1070: .)b ! 1071: sets the ! 1072: .b T ! 1073: (timeout) option to two minutes ! 1074: for this run only. ! 1075: .sh 1 "TUNING" ! 1076: .pp ! 1077: There are a number of configuration parameters ! 1078: you may want to change, ! 1079: depending on the requirements of your site. ! 1080: Most of these are set ! 1081: using an option in the configuration file. ! 1082: For example, ! 1083: the line ! 1084: .q OT3d ! 1085: sets option ! 1086: .q T ! 1087: to the value ! 1088: .q 3d ! 1089: (three days). ! 1090: .sh 2 "Timeouts" ! 1091: .pp ! 1092: All time intervals are set ! 1093: using a scaled syntax. ! 1094: For example, ! 1095: .q 10m ! 1096: represents ten minutes, whereas ! 1097: .q 2h30m ! 1098: represents two and a half hours. ! 1099: The full set of scales is: ! 1100: .(b ! 1101: .ta 4n ! 1102: s seconds ! 1103: m minutes ! 1104: h hours ! 1105: d days ! 1106: w weeks ! 1107: .)b ! 1108: .sh 3 "Queue interval" ! 1109: .pp ! 1110: The argument to the ! 1111: .b \-q ! 1112: flag ! 1113: specifies how often a subdaemon will run the queue. ! 1114: This is typically set to between five minutes ! 1115: and one half hour. ! 1116: .sh 3 "Read timeouts" ! 1117: .pp ! 1118: It is possible to time out when reading the standard input ! 1119: or when reading from a remote SMTP server. ! 1120: Technically, ! 1121: this is not acceptable within the published protocols. ! 1122: However, ! 1123: it might be appropriate to set it to something large ! 1124: in certain environments ! 1125: (such as an hour). ! 1126: This will reduce the chance of large numbers of idle daemons ! 1127: piling up on your system. ! 1128: This timeout is set using the ! 1129: .b r ! 1130: option in the configuration file. ! 1131: .sh 3 "Message timeouts" ! 1132: .pp ! 1133: After sitting in the queue for a few days, ! 1134: a message will time out. ! 1135: This is to insure that at least the sender is aware ! 1136: of the inability to send a message. ! 1137: The timeout is typically set to three days. ! 1138: This timeout is set using the ! 1139: .b T ! 1140: option in the configuration file. ! 1141: .pp ! 1142: The time of submission is set in the queue, ! 1143: rather than the amount of time left until timeout. ! 1144: As a result, you can flush messages that have been hanging ! 1145: for a short period ! 1146: by running the queue ! 1147: with a short message timeout. ! 1148: For example, ! 1149: .(b ! 1150: /usr/lib/sendmail \-oT1d \-q ! 1151: .)b ! 1152: will run the queue ! 1153: and flush anything that is one day old. ! 1154: .sh 2 "Delivery Mode" ! 1155: .pp ! 1156: There are a number of delivery modes that ! 1157: .i sendmail ! 1158: can operate in, ! 1159: set by the ! 1160: .q d ! 1161: configuration option. ! 1162: These modes ! 1163: specify how quickly mail will be delivered. ! 1164: Legal modes are: ! 1165: .(b ! 1166: .ta 4n ! 1167: i deliver interactively (synchronously) ! 1168: b deliver in background (asynchronously) ! 1169: q queue only (don't deliver) ! 1170: .)b ! 1171: There are tradeoffs. ! 1172: Mode ! 1173: .q i ! 1174: passes the maximum amount of information to the sender, ! 1175: but is hardly ever necessary. ! 1176: Mode ! 1177: .q q ! 1178: puts the minimum load on your machine, ! 1179: but means that delivery may be delayed for up to the queue interval. ! 1180: Mode ! 1181: .q b ! 1182: is probably a good compromise. ! 1183: However, this mode can cause large numbers of processes ! 1184: if you have a mailer that takes a long time to deliver a message. ! 1185: .sh 2 "Log Level" ! 1186: .pp ! 1187: The level of logging can be set for sendmail. ! 1188: The default using a standard configuration table is level 9. ! 1189: The levels are as follows: ! 1190: .ip 0 ! 1191: No logging. ! 1192: .ip 1 ! 1193: Major problems only. ! 1194: .ip 2 ! 1195: Message collections and failed deliveries. ! 1196: .ip 3 ! 1197: Successful deliveries. ! 1198: .ip 4 ! 1199: Messages being defered ! 1200: (due to a host being down, etc.). ! 1201: .ip 5 ! 1202: Normal message queueups. ! 1203: .ip 6 ! 1204: Unusual but benign incidents, ! 1205: e.g., ! 1206: trying to process a locked queue file. ! 1207: .ip 9 ! 1208: Log internal queue id to external message id mappings. ! 1209: This can be useful for tracing a message ! 1210: as it travels between several hosts. ! 1211: .ip 12 ! 1212: Several messages that are basically only of interest ! 1213: when debugging. ! 1214: .ip 16 ! 1215: Verbose information regarding the queue. ! 1216: .sh 2 "File Modes" ! 1217: .pp ! 1218: There are a number of files ! 1219: that may have a number of modes. ! 1220: The modes depend on what functionality you want ! 1221: and the level of security you require. ! 1222: .sh 3 "To suid or not to suid?" ! 1223: .pp ! 1224: .i Sendmail ! 1225: can safely be made ! 1226: setuid to root. ! 1227: At the point where it is about to ! 1228: .i exec \|(2) ! 1229: a mailer, ! 1230: it checks to see if the userid is zero; ! 1231: if so, ! 1232: it resets the userid and groupid to a default ! 1233: (set by the ! 1234: .b u ! 1235: and ! 1236: .b g ! 1237: options). ! 1238: (This can be overridden ! 1239: by setting the ! 1240: .b S ! 1241: flag to the mailer ! 1242: for mailers that are trusted ! 1243: and must be called as root.) ! 1244: However, ! 1245: this will cause mail processing ! 1246: to be accounted ! 1247: (using ! 1248: .i sa \|(8)) ! 1249: to root ! 1250: rather than to the user sending the mail. ! 1251: .sh 3 "Temporary file modes" ! 1252: .pp ! 1253: The mode of all temporary files that ! 1254: .i sendmail ! 1255: creates is determined by the ! 1256: .q F ! 1257: option. ! 1258: Reasonable values for this option are ! 1259: 0600 ! 1260: and ! 1261: 0644. ! 1262: If the more permissive mode is selected, ! 1263: it will not be necessary to run ! 1264: .i sendmail ! 1265: as root at all ! 1266: (even when running the queue). ! 1267: .sh 3 "Should my alias database be writable?" ! 1268: .pp ! 1269: At Berkeley ! 1270: we have the alias database ! 1271: (/usr/lib/aliases*) ! 1272: mode 666. ! 1273: There are some dangers inherent in this approach: ! 1274: any user can add him-/her-self ! 1275: to any list, ! 1276: or can ! 1277: .q steal ! 1278: any other user's mail. ! 1279: However, ! 1280: we have found users to be basically trustworthy, ! 1281: and the cost of having a read-only database ! 1282: greater than the expense of finding and eradicating ! 1283: the rare nasty person. ! 1284: .pp ! 1285: The database that ! 1286: .i sendmail ! 1287: actually used ! 1288: is represented by the two files ! 1289: .i aliases.dir ! 1290: and ! 1291: .i aliases.pag ! 1292: (both in /usr/lib). ! 1293: The mode on these files should match the mode ! 1294: on /usr/lib/aliases. ! 1295: If ! 1296: .i aliases ! 1297: is writable ! 1298: and the ! 1299: DBM ! 1300: files ! 1301: (\c ! 1302: .i aliases.dir ! 1303: and ! 1304: .i aliases.pag ) ! 1305: are not, ! 1306: users will be unable to reflect their desired changes ! 1307: through to the actual database. ! 1308: However, ! 1309: if ! 1310: .i aliases ! 1311: is read-only ! 1312: and the DBM files are writable, ! 1313: a slightly sophisticated user ! 1314: can arrange to steal mail anyway. ! 1315: .pp ! 1316: If your DBM files are not writable by the world ! 1317: or you do not have auto-rebuild enabled ! 1318: (with the ! 1319: .q D ! 1320: option), ! 1321: then you must be careful to reconstruct the alias database ! 1322: each time you change the text version: ! 1323: .(b ! 1324: newaliases ! 1325: .)b ! 1326: If this step is ignored or forgotten ! 1327: any intended changes will also be ignored or forgotten. ! 1328: .sh 1 "THE WHOLE SCOOP ON THE CONFIGURATION FILE" ! 1329: .pp ! 1330: This section describes the configuration file ! 1331: in detail, ! 1332: including hints on how to write one of your own ! 1333: if you have to. ! 1334: .pp ! 1335: There is one point that should be made clear immediately: ! 1336: the syntax of the configuration file ! 1337: is designed to be reasonably easy to parse, ! 1338: since this is done every time ! 1339: .i sendmail ! 1340: starts up, ! 1341: rather than easy for a human to read or write. ! 1342: On the ! 1343: .q "future project" ! 1344: list is a ! 1345: configuration-file compiler. ! 1346: .pp ! 1347: An overview of the configuration file ! 1348: is given first, ! 1349: followed by details of the semantics. ! 1350: .sh 2 "The Syntax" ! 1351: .pp ! 1352: The configuration file is organized as a series of lines, ! 1353: each of which begins with a single character ! 1354: defining the semantics for the rest of the line. ! 1355: Lines beginning with a space or a tab ! 1356: are continuation lines ! 1357: (although the semantics are not well defined in many places). ! 1358: Blank lines and lines beginning with a sharp symbol ! 1359: (`#') ! 1360: are comments. ! 1361: .sh 3 "R and S \*- rewriting rules" ! 1362: .pp ! 1363: The core of address parsing ! 1364: are the rewriting rules. ! 1365: These are an ordered production system. ! 1366: .i Sendmail ! 1367: scans through the set of rewriting rules ! 1368: looking for a match on the left hand side ! 1369: (LHS) ! 1370: of the rule. ! 1371: When a rule matches, ! 1372: the address is replaced by the right hand side ! 1373: (RHS) ! 1374: of the rule. ! 1375: .pp ! 1376: There are several sets of rewriting rules. ! 1377: Some of the rewriting sets are used internally ! 1378: and must have specific semantics. ! 1379: Other rewriting sets ! 1380: do not have specifically assigned semantics, ! 1381: and may be referenced by the mailer definitions ! 1382: or by other rewriting sets. ! 1383: .pp ! 1384: The syntax of these two commands are: ! 1385: .(b F ! 1386: .b S \c ! 1387: .i n ! 1388: .)b ! 1389: Sets the current ruleset being collected to ! 1390: .i n . ! 1391: If you begin a ruleset more than once ! 1392: it deletes the old definition. ! 1393: .(b F ! 1394: .b R \c ! 1395: .i lhs ! 1396: .i rhs ! 1397: .i comments ! 1398: .)b ! 1399: The ! 1400: fields must be separated ! 1401: by at least one tab character; ! 1402: there may be embedded spaces ! 1403: in the fields. ! 1404: The ! 1405: .i lhs ! 1406: is a pattern that is applied to the input. ! 1407: If it matches, ! 1408: the input is rewritten to the ! 1409: .i rhs . ! 1410: The ! 1411: .i comments ! 1412: are ignored. ! 1413: .sh 3 "D \*- define macro" ! 1414: .pp ! 1415: Macros are named with a single character. ! 1416: These may be selected from the entire ASCII set, ! 1417: but user-defined macros ! 1418: should be selected from the set of upper case letters only. ! 1419: Lower case letters ! 1420: and special symbols ! 1421: are used internally. ! 1422: .pp ! 1423: The syntax for macro definitions is: ! 1424: .(b F ! 1425: .b D \c ! 1426: .i x\|val ! 1427: .)b ! 1428: where ! 1429: .i x ! 1430: is the name of the macro ! 1431: and ! 1432: .i val ! 1433: is the value it should have. ! 1434: Macros can be interpolated in most places using the escape sequence ! 1435: .b $ \c ! 1436: .i x . ! 1437: .sh 3 "C and F \*- define classes" ! 1438: .pp ! 1439: Classes of words may be defined ! 1440: to match on the left hand side of rewriting rules. ! 1441: For example ! 1442: a class of all local names for this site ! 1443: might be created ! 1444: so that attempts to send to oneself ! 1445: can be eliminated. ! 1446: These can either be defined directly in the configuration file ! 1447: or read in from another file. ! 1448: Classes may be given names ! 1449: from the set of upper case letters. ! 1450: Lower case letters and special characters ! 1451: are reserved for system use. ! 1452: .pp ! 1453: The syntax is: ! 1454: .(b F ! 1455: .b C \c ! 1456: .i c\|word1 ! 1457: .i word2... ! 1458: .br ! 1459: .b F \c ! 1460: .i c\|file ! 1461: [ ! 1462: .i format ! 1463: ] ! 1464: .)b ! 1465: The first form defines the class ! 1466: .i c ! 1467: to match any of the named words. ! 1468: It is permissible to split them among multiple lines; ! 1469: for example, the two forms: ! 1470: .(b ! 1471: CHmonet ucbmonet ! 1472: .)b ! 1473: and ! 1474: .(b ! 1475: CHmonet ! 1476: CHucbmonet ! 1477: .)b ! 1478: are equivalent. ! 1479: The second form ! 1480: reads the elements of the class ! 1481: .i c ! 1482: from the named ! 1483: .i file ; ! 1484: the ! 1485: .i format ! 1486: is a ! 1487: .i scanf \|(3) ! 1488: pattern ! 1489: that should produce a single string. ! 1490: .sh 3 "M \*- define mailer" ! 1491: .pp ! 1492: Programs and interfaces to mailers ! 1493: are defined in this line. ! 1494: The format is: ! 1495: .(b F ! 1496: .b M \c ! 1497: .i name , ! 1498: {\c ! 1499: .i field =\c ! 1500: .i value \|}* ! 1501: .)b ! 1502: where ! 1503: .i name ! 1504: is the name of the mailer ! 1505: (used internally only) ! 1506: and the ! 1507: .q field=name ! 1508: pairs define attributes of the mailer. ! 1509: Fields are: ! 1510: .(b ! 1511: .ta 1i ! 1512: Path The pathname of the mailer ! 1513: Flags Special flags for this mailer ! 1514: Sender A rewriting set for sender addresses ! 1515: Recipient A rewriting set for recipient addresses ! 1516: Argv An argument vector to pass to this mailer ! 1517: Eol The end-of-line string for this mailer ! 1518: Maxsize The maximum message length to this mailer ! 1519: .)b ! 1520: Only the first character of the field name is checked. ! 1521: .sh 3 "H \*- define header" ! 1522: .pp ! 1523: The format of the header lines that sendmail inserts into the message ! 1524: are defined by the ! 1525: .b H ! 1526: line. ! 1527: The syntax of this line is: ! 1528: .(b F ! 1529: .b H [\c ! 1530: .b ? \c ! 1531: .i mflags \c ! 1532: .b ? ]\c ! 1533: .i hname \c ! 1534: .b : ! 1535: .i htemplate ! 1536: .)b ! 1537: Continuation lines in this spec ! 1538: are reflected directly into the outgoing message. ! 1539: The ! 1540: .i htemplate ! 1541: is macro expanded before insertion into the message. ! 1542: If the ! 1543: .i mflags ! 1544: (surrounded by question marks) ! 1545: are specified, ! 1546: at least one of the specified flags ! 1547: must be stated in the mailer definition ! 1548: for this header to be automatically output. ! 1549: If one of these headers is in the input ! 1550: it is reflected to the output ! 1551: regardless of these flags. ! 1552: .pp ! 1553: Some headers have special semantics ! 1554: that will be described below. ! 1555: .sh 3 "O \*- set option" ! 1556: .pp ! 1557: There are a number of ! 1558: .q random ! 1559: options that ! 1560: can be set from a configuration file. ! 1561: Options are represented by single characters. ! 1562: The syntax of this line is: ! 1563: .(b F ! 1564: .b O \c ! 1565: .i o\|value ! 1566: .)b ! 1567: This sets option ! 1568: .i o ! 1569: to be ! 1570: .i value . ! 1571: Depending on the option, ! 1572: .i value ! 1573: may be a string, an integer, ! 1574: a boolean ! 1575: (with legal values ! 1576: .q t , ! 1577: .q T , ! 1578: .q f , ! 1579: or ! 1580: .q F ; ! 1581: the default is TRUE), ! 1582: or ! 1583: a time interval. ! 1584: .sh 3 "T \*- define trusted users" ! 1585: .pp ! 1586: Trusted users ! 1587: are those users who are permitted ! 1588: to override the sender address ! 1589: using the ! 1590: .b \-f ! 1591: flag. ! 1592: These typically are ! 1593: .q root, ! 1594: .q uucp, ! 1595: and ! 1596: .q network, ! 1597: but on some users it may be convenient ! 1598: to extend this list to include other users, ! 1599: perhaps to support ! 1600: a separate ! 1601: UUCP ! 1602: login for each host. ! 1603: The syntax of this line is: ! 1604: .(b F ! 1605: .b T \c ! 1606: .i user1 ! 1607: .i user2 ... ! 1608: .)b ! 1609: There may be more than one of these lines. ! 1610: .sh 3 "P \*- precedence definitions" ! 1611: .pp ! 1612: Values for the ! 1613: .q "Precedence:" ! 1614: field may be defined using the ! 1615: .b P ! 1616: control line. ! 1617: The syntax of this field is: ! 1618: .(b ! 1619: \fBP\fP\fIname\fP\fB=\fP\fInum\fP ! 1620: .)b ! 1621: When the ! 1622: .i name ! 1623: is found in a ! 1624: .q Precedence: ! 1625: field, ! 1626: the message class is set to ! 1627: .i num . ! 1628: Higher numbers mean higher precedence. ! 1629: Numbers less than zero ! 1630: have the special property ! 1631: that error messages will not be returned. ! 1632: The default precedence is zero. ! 1633: For example, ! 1634: our list of precedences is: ! 1635: .(b ! 1636: Pfirst-class=0 ! 1637: Pspecial-delivery=100 ! 1638: Pjunk=\-100 ! 1639: .)b ! 1640: .sh 2 "The Semantics" ! 1641: .pp ! 1642: This section describes the semantics of the configuration file. ! 1643: .sh 3 "Special macros, conditionals" ! 1644: .pp ! 1645: Macros are interpolated ! 1646: using the construct ! 1647: .b $ \c ! 1648: .i x , ! 1649: where ! 1650: .i x ! 1651: is the name of the macro to be interpolated. ! 1652: In particular, ! 1653: lower case letters are reserved to have ! 1654: special semantics, ! 1655: used to pass information in or out of sendmail, ! 1656: and some special characters are reserved to ! 1657: provide conditionals, etc. ! 1658: .pp ! 1659: The following macros ! 1660: .i must ! 1661: be defined to transmit information into ! 1662: .i sendmail: ! 1663: .(b ! 1664: .ta 4n ! 1665: e The SMTP entry message ! 1666: j The \*(lqofficial\*(rq domain name for this site ! 1667: l The format of the UNIX from line ! 1668: n The name of the daemon (for error messages) ! 1669: o The set of "operators" in addresses ! 1670: q default format of sender address ! 1671: .)b ! 1672: The ! 1673: .b $e ! 1674: macro is printed out when SMTP starts up. ! 1675: The first word must be the ! 1676: .b $j ! 1677: macro. ! 1678: The ! 1679: .b $j ! 1680: macro ! 1681: should be in RFC821 format. ! 1682: The ! 1683: .b $l ! 1684: and ! 1685: .b $n ! 1686: macros can be considered constants ! 1687: except under terribly unusual circumstances. ! 1688: The ! 1689: .b $o ! 1690: macro consists of a list of characters ! 1691: which will be considered tokens ! 1692: and which will separate tokens ! 1693: when doing parsing. ! 1694: For example, if ! 1695: .q r ! 1696: were in the ! 1697: .b $o ! 1698: macro, then the input ! 1699: .q address ! 1700: would be scanned as three tokens: ! 1701: .q add, ! 1702: .q r, ! 1703: and ! 1704: .q ess. ! 1705: Finally, the ! 1706: .b $q ! 1707: macro specifies how an address should appear in a message ! 1708: when it is defaulted. ! 1709: For example, on our system these definitions are: ! 1710: .(b ! 1711: De$j Sendmail $v ready at $b ! 1712: DnMAILER-DAEMON ! 1713: DlFrom $g $d ! 1714: Do.:%@!^=/ ! 1715: Dq$g$?x ($x)$. ! 1716: Dj$H.$D ! 1717: .)b ! 1718: An acceptable alternative for the ! 1719: .b $q ! 1720: macro is ! 1721: .q "$?x$x $.<$g>" . ! 1722: These correspond to the following two formats: ! 1723: .(b ! 1724: eric@Berkeley (Eric Allman) ! 1725: Eric Allman <eric@Berkeley> ! 1726: .)b ! 1727: .pp ! 1728: Some macros are defined by ! 1729: .i sendmail ! 1730: for interpolation into argv's for mailers ! 1731: or for other contexts. ! 1732: These macros are: ! 1733: .(b ! 1734: a The origination date in Arpanet format ! 1735: b The current date in Arpanet format ! 1736: c The hop count ! 1737: d The date in UNIX (ctime) format ! 1738: f The sender (from) address ! 1739: g The sender address relative to the recipient ! 1740: h The recipient host ! 1741: i The queue id ! 1742: p Sendmail's pid ! 1743: r Protocol used ! 1744: s Sender's host name ! 1745: t A numeric representation of the current time ! 1746: u The recipient user ! 1747: v The version number of sendmail ! 1748: w The hostname of this site ! 1749: x The full name of the sender ! 1750: y The id of the sender's tty ! 1751: z The home directory of the recipient ! 1752: .)b ! 1753: .pp ! 1754: There are three types of dates that can be used. ! 1755: The ! 1756: .b $a ! 1757: and ! 1758: .b $b ! 1759: macros are in Arpanet format; ! 1760: .b $a ! 1761: is the time as extracted from the ! 1762: .q Date: ! 1763: line of the message ! 1764: (if there was one), ! 1765: and ! 1766: .b $b ! 1767: is the current date and time ! 1768: (used for postmarks). ! 1769: If no ! 1770: .q Date: ! 1771: line is found in the incoming message, ! 1772: .b $a ! 1773: is set to the current time also. ! 1774: The ! 1775: .b $d ! 1776: macro is equivalent to the ! 1777: .b $a ! 1778: macro in UNIX ! 1779: (ctime) ! 1780: format. ! 1781: .pp ! 1782: The ! 1783: .b $f ! 1784: macro is the id of the sender ! 1785: as originally determined; ! 1786: when mailing to a specific host ! 1787: the ! 1788: .b $g ! 1789: macro is set to the address of the sender ! 1790: .ul ! 1791: relative to the recipient. ! 1792: For example, ! 1793: if I send to ! 1794: .q bollard@matisse ! 1795: from the machine ! 1796: .q ucbarpa ! 1797: the ! 1798: .b $f ! 1799: macro will be ! 1800: .q eric ! 1801: and the ! 1802: .b $g ! 1803: macro will be ! 1804: .q eric@ucbarpa. ! 1805: .pp ! 1806: The ! 1807: .b $x ! 1808: macro is set to the full name of the sender. ! 1809: This can be determined in several ways. ! 1810: It can be passed as flag to ! 1811: .i sendmail. ! 1812: The second choice is the value of the ! 1813: .q Full-name: ! 1814: line in the header if it exists, ! 1815: and the third choice is the comment field ! 1816: of a ! 1817: .q From: ! 1818: line. ! 1819: If all of these fail, ! 1820: and if the message is being originated locally, ! 1821: the full name is looked up in the ! 1822: .i /etc/passwd ! 1823: file. ! 1824: .pp ! 1825: When sending, ! 1826: the ! 1827: .b $h , ! 1828: .b $u , ! 1829: and ! 1830: .b $z ! 1831: macros get set to the host, user, and home directory ! 1832: (if local) ! 1833: of the recipient. ! 1834: The first two are set from the ! 1835: .b $@ ! 1836: and ! 1837: .b $: ! 1838: part of the rewriting rules, respectively. ! 1839: .pp ! 1840: The ! 1841: .b $p ! 1842: and ! 1843: .b $t ! 1844: macros are used to create unique strings ! 1845: (e.g., for the ! 1846: .q Message-Id: ! 1847: field). ! 1848: The ! 1849: .b $i ! 1850: macro is set to the queue id on this host; ! 1851: if put into the timestamp line ! 1852: it can be extremely useful for tracking messages. ! 1853: The ! 1854: .b $y ! 1855: macro is set to the id of the terminal of the sender ! 1856: (if known); ! 1857: some systems like to put this ! 1858: in the Unix ! 1859: .q From ! 1860: line. ! 1861: The ! 1862: .b $v ! 1863: macro is set to be the version number of ! 1864: .i sendmail ; ! 1865: this is normally put in timestamps ! 1866: and has been proven extremely useful for debugging. ! 1867: The ! 1868: .b $w ! 1869: macro is set to the name of this host ! 1870: if it can be determined. ! 1871: The ! 1872: .b $c ! 1873: field is set to the ! 1874: .q "hop count," ! 1875: i.e., the number of times this message has been processed. ! 1876: This can be determined ! 1877: by the ! 1878: .b \-h ! 1879: flag on the command line ! 1880: or by counting the timestamps in the message. ! 1881: .pp ! 1882: The ! 1883: .b $r ! 1884: and ! 1885: .b $s ! 1886: fields are set to the protocol used to communicate with sendmail ! 1887: and the sending hostname; ! 1888: these are not supported in the current version. ! 1889: .pp ! 1890: Conditionals can be specified using the syntax: ! 1891: .(b ! 1892: $?x text1 $| text2 $. ! 1893: .)b ! 1894: This interpolates ! 1895: .i text1 ! 1896: if the macro ! 1897: .b $x ! 1898: is set, ! 1899: and ! 1900: .i text2 ! 1901: otherwise. ! 1902: The ! 1903: .q else ! 1904: (\c ! 1905: .b $| ) ! 1906: clause may be omitted. ! 1907: .sh 3 "Special classes" ! 1908: .pp ! 1909: The class ! 1910: .b $=w ! 1911: is set to be the set of all names ! 1912: this host is known by. ! 1913: This can be used to delete local hostnames. ! 1914: .sh 3 "The left hand side" ! 1915: .pp ! 1916: The left hand side of rewriting rules contains a pattern. ! 1917: Normal words are simply matched directly. ! 1918: Metasyntax is introduced using a dollar sign. ! 1919: The metasymbols are: ! 1920: .(b ! 1921: .ta \w'\fB$=\fP\fIx\fP 'u ! 1922: \fB$*\fP Match zero or more tokens ! 1923: \fB$+\fP Match one or more tokens ! 1924: \fB$\-\fP Match exactly one token ! 1925: \fB$=\fP\fIx\fP Match any token in class \fIx\fP ! 1926: \fB$~\fP\fIx\fP Match any token not in class \fIx\fP ! 1927: .)b ! 1928: If any of these match, ! 1929: they are assigned to the symbol ! 1930: .b $ \c ! 1931: .i n ! 1932: for replacement on the right hand side, ! 1933: where ! 1934: .i n ! 1935: is the index in the LHS. ! 1936: For example, ! 1937: if the LHS: ! 1938: .(b ! 1939: $\-:$+ ! 1940: .)b ! 1941: is applied to the input: ! 1942: .(b ! 1943: UCBARPA:eric ! 1944: .)b ! 1945: the rule will match, and the values passed to the RHS will be: ! 1946: .(b ! 1947: .ta 4n ! 1948: $1 UCBARPA ! 1949: $2 eric ! 1950: .)b ! 1951: .sh 3 "The right hand side" ! 1952: .pp ! 1953: When the right hand side of a rewriting rule matches, ! 1954: the input is deleted and replaced by the right hand side. ! 1955: Tokens are copied directly from the RHS ! 1956: unless they are begin with a dollar sign. ! 1957: Metasymbols are: ! 1958: .(b ! 1959: .ta \w'$#mailer 'u ! 1960: \fB$\fP\fIn\fP Substitute indefinite token \fIn\fP from LHS ! 1961: \fB$>\fP\fIn\fP \*(lqCall\*(rq ruleset \fIn\fP ! 1962: \fB$#\fP\fImailer\fP Resolve to \fImailer\fP ! 1963: \fB$@\fP\fIhost\fP Specify \fIhost\fP ! 1964: \fB$:\fP\fIuser\fP Specify \fIuser\fP ! 1965: .)b ! 1966: .pp ! 1967: The ! 1968: .b $ \c ! 1969: .i n ! 1970: syntax substitutes the corresponding value from a ! 1971: .b $+ , ! 1972: .b $\- , ! 1973: .b $* , ! 1974: .b $= , ! 1975: or ! 1976: .b $~ ! 1977: match on the LHS. ! 1978: It may be used anywhere. ! 1979: .pp ! 1980: The ! 1981: .b $> \c ! 1982: .i n ! 1983: syntax ! 1984: causes the remainder of the line to be substituted as usual ! 1985: and then passed as the argument to ruleset ! 1986: .i n . ! 1987: The final value of ruleset ! 1988: .i n ! 1989: then becomes ! 1990: the substitution for this rule. ! 1991: .pp ! 1992: The ! 1993: .b $# ! 1994: syntax should ! 1995: .i only ! 1996: be used in ruleset zero. ! 1997: It causes evaluation of the ruleset to terminate immediately, ! 1998: and signals to sendmail that the address has completely resolved. ! 1999: The complete syntax is: ! 2000: .(b ! 2001: \fB$#\fP\fImailer\fP\fB$@\fP\fIhost\fP\fB$:\fP\fIuser\fP ! 2002: .)b ! 2003: This specifies the ! 2004: {mailer, host, user} ! 2005: 3-tuple necessary to direct the mailer. ! 2006: If the mailer is local ! 2007: the host part may be omitted. ! 2008: The ! 2009: .i mailer ! 2010: and ! 2011: .i host ! 2012: must be a single word, ! 2013: but the ! 2014: .i user ! 2015: may be multi-part. ! 2016: .pp ! 2017: A RHS may also be preceeded by a ! 2018: .b $@ ! 2019: or a ! 2020: .b $: ! 2021: to control evaluation. ! 2022: A ! 2023: .b $@ ! 2024: prefix causes the ruleset to return with the remainder of the RHS ! 2025: as the value. ! 2026: A ! 2027: .b $: ! 2028: prefix causes the rule to terminate immediately, ! 2029: but the ruleset to continue; ! 2030: this can be used to avoid continued application of a rule. ! 2031: The prefix is stripped before continuing. ! 2032: .pp ! 2033: The ! 2034: .b $@ ! 2035: and ! 2036: .b $: ! 2037: prefixes may preceed a ! 2038: .b $> ! 2039: spec; ! 2040: for example: ! 2041: .(b ! 2042: .ta 8n ! 2043: R$+ $:$>7$1 ! 2044: .)b ! 2045: matches anything, ! 2046: passes that to ruleset seven, ! 2047: and continues; ! 2048: the ! 2049: .b $: ! 2050: is necessary to avoid an infinite loop. ! 2051: .sh 3 "Semantics of rewriting rule sets" ! 2052: .pp ! 2053: There are five rewriting sets ! 2054: that have specific semantics. ! 2055: These are related as depicted by figure 2. ! 2056: .(z ! 2057: .hl ! 2058: .ie t .sp 2i ! 2059: .el \{\ ! 2060: .(c ! 2061: +---+ ! 2062: -->| 0 |-->resolved address ! 2063: / +---+ ! 2064: / +---+ +---+ ! 2065: / ---->| 1 |-->| S |-- ! 2066: +---+ / +---+ / +---+ +---+ \e +---+ ! 2067: addr-->| 3 |-->| D |-- --->| 4 |-->msg ! 2068: +---+ +---+ \e +---+ +---+ / +---+ ! 2069: --->| 2 |-->| R |-- ! 2070: +---+ +---+ ! 2071: .)c ! 2072: ! 2073: .ce ! 2074: Figure 2 \*- Rewriting set semantics ! 2075: .(c ! 2076: D \*- sender domain addition ! 2077: S \*- mailer-specific sender rewriting ! 2078: R \*- mailer-specific recipient rewriting ! 2079: .)c ! 2080: .\} ! 2081: .hl ! 2082: .)z ! 2083: .pp ! 2084: Ruleset three ! 2085: should turn the address into ! 2086: .q "canonical form." ! 2087: This form should have the basic syntax: ! 2088: .(b ! 2089: local-part@host-domain-spec ! 2090: .)b ! 2091: If no ! 2092: .q @ ! 2093: sign is specified, ! 2094: then the ! 2095: host-domain-spec ! 2096: .i may ! 2097: be appended from the ! 2098: sender address ! 2099: (if the ! 2100: .b C ! 2101: flag is set in the mailer definition ! 2102: corresponding to the ! 2103: .i sending ! 2104: mailer). ! 2105: Ruleset three ! 2106: is applied by sendmail ! 2107: before doing anything with any address. ! 2108: .pp ! 2109: Ruleset zero ! 2110: is applied after ruleset three ! 2111: to addresses that are going to actually specify recipients. ! 2112: It must resolve to a ! 2113: .i "{mailer, host, user}" ! 2114: triple. ! 2115: The ! 2116: .i mailer ! 2117: must be defined in the mailer definitions ! 2118: from the configuration file. ! 2119: The ! 2120: .i host ! 2121: is defined into the ! 2122: .b $h ! 2123: macro ! 2124: for use in the argv expansion of the specified mailer. ! 2125: .pp ! 2126: Rulesets one and two ! 2127: are applied to all sender and recipient addresses respectively. ! 2128: They are applied before any specification ! 2129: in the mailer definition. ! 2130: They must never resolve. ! 2131: .pp ! 2132: Ruleset four is applied to all addresses ! 2133: in the message. ! 2134: It is typically used ! 2135: to translate internal to external form. ! 2136: .sh 3 "Mailer flags etc." ! 2137: .pp ! 2138: There are a number of flags that may be associated with each mailer, ! 2139: each identified by a letter of the alphabet. ! 2140: Many of them are assigned semantics internally. ! 2141: These are detailed in Appendix C. ! 2142: Any other flags may be used freely ! 2143: to conditionally assign headers to messages ! 2144: destined for particular mailers. ! 2145: .sh 3 "The \*(lqerror\*(rq mailer" ! 2146: .pp ! 2147: The mailer with the special name ! 2148: .q error ! 2149: can be used to generate a user error. ! 2150: The (optional) host field is a numeric exit status to be returned, ! 2151: and the user field is a message to be printed. ! 2152: For example, the entry: ! 2153: .(b ! 2154: $#error$:Host unknown in this domain ! 2155: .)b ! 2156: on the RHS of a rule ! 2157: will cause the specified error to be generated ! 2158: if the LHS matches. ! 2159: This mailer is only functional in ruleset zero. ! 2160: .sh 2 "Building a Configuration File From Scratch" ! 2161: .pp ! 2162: Building a configuration table from scratch is an extremely difficult job. ! 2163: Fortunately, ! 2164: it is almost never necessary to do so; ! 2165: nearly every situation that may come up ! 2166: may be resolved by changing an existing table. ! 2167: In any case, ! 2168: it is critical that you understand what it is that you are trying to do ! 2169: and come up with a philosophy for the configuration table. ! 2170: This section is intended to explain what the real purpose ! 2171: of a configuration table is ! 2172: and to give you some ideas ! 2173: for what your philosophy might be. ! 2174: .sh 3 "What you are trying to do" ! 2175: .pp ! 2176: The configuration table has three major purposes. ! 2177: The first and simplest ! 2178: is to set up the environment for ! 2179: .i sendmail . ! 2180: This involves setting the options, ! 2181: defining a few critical macros, ! 2182: etc. ! 2183: Since these are described in other places, ! 2184: we will not go into more detail here. ! 2185: .pp ! 2186: The second purpose is to rewrite addresses in the message. ! 2187: This should typically be done in two phases. ! 2188: The first phase maps addresses in any format ! 2189: into a canonical form. ! 2190: This should be done in ruleset three. ! 2191: The second phase maps this canonical form ! 2192: into the syntax appropriate for the receiving mailer. ! 2193: .i Sendmail ! 2194: does this in three subphases. ! 2195: Rulesets one and two ! 2196: are applied to all sender and recipient addresses respectively. ! 2197: After this, ! 2198: you may specify per-mailer rulesets ! 2199: for both sender and recipient addresses; ! 2200: this allows mailer-specific customization. ! 2201: Finally, ! 2202: ruleset four is applied to do any default conversion ! 2203: to external form. ! 2204: .pp ! 2205: The third purpose ! 2206: is to map addresses into the actual set of instructions ! 2207: necessary to get the message delivered. ! 2208: Ruleset zero must resolve to the internal form, ! 2209: which is in turn used as a pointer to a mailer descriptor. ! 2210: The mailer descriptor describes the interface requirements ! 2211: of the mailer. ! 2212: .sh 3 "Philosophy" ! 2213: .pp ! 2214: The particular philosophy you choose will depend heavily ! 2215: on the size and structure of your organization. ! 2216: I will present a few possible philosophies here. ! 2217: .pp ! 2218: One general point applies to all of these philosophies: ! 2219: it is almost always a mistake ! 2220: to try to do full name resolution. ! 2221: For example, ! 2222: if you are trying to get names of the form ! 2223: .q user@host ! 2224: to the Arpanet, ! 2225: it does not pay to route them to ! 2226: .q xyzvax!decvax!ucbvax!c70:user@host ! 2227: since you then depend on several links not under your control. ! 2228: The best approach to this problem ! 2229: is to simply forward to ! 2230: .q xyzvax!user@host ! 2231: and let xyzvax ! 2232: worry about it from there. ! 2233: In summary, ! 2234: just get the message closer to the destination, ! 2235: rather than determining the full path. ! 2236: .sh 4 "Large site, many hosts \*- minimum information" ! 2237: .pp ! 2238: Berkeley is an example of a large site, ! 2239: i.e., more than two or three hosts. ! 2240: We have decided that the only reasonable philosophy ! 2241: in our environment ! 2242: is to designate one host as the guru for our site. ! 2243: It must be able to resolve any piece of mail it receives. ! 2244: The other sites should have the minimum amount of information ! 2245: they can get away with. ! 2246: In addition, ! 2247: any information they do have ! 2248: should be hints rather than solid information. ! 2249: .pp ! 2250: For example, ! 2251: a typical site on our local ether network is ! 2252: .q monet. ! 2253: Monet has a list of known ethernet hosts; ! 2254: if it receives mail for any of them, ! 2255: it can do direct delivery. ! 2256: If it receives mail for any unknown host, ! 2257: it just passes it directly to ! 2258: .q ucbvax, ! 2259: our master host. ! 2260: Ucbvax may determine that the host name is illegal ! 2261: and reject the message, ! 2262: or may be able to do delivery. ! 2263: However, it is important to note that when a new ethernet host is added, ! 2264: the only host that ! 2265: .i must ! 2266: have its tables updated ! 2267: is ucbvax; ! 2268: the others ! 2269: .i may ! 2270: be updated as convenient, ! 2271: but this is not critical. ! 2272: .pp ! 2273: This picture is slightly muddied ! 2274: due to network connections that are not actually located ! 2275: on ucbvax. ! 2276: For example, ! 2277: our TCP connection is currently on ! 2278: .q ucbarpa. ! 2279: However, ! 2280: monet ! 2281: .i "does not" ! 2282: know about this; ! 2283: the information is hidden totally between ucbvax and ucbarpa. ! 2284: Mail going from monet to a TCP host ! 2285: is transfered via the ethernet ! 2286: from monet to ucbvax, ! 2287: then via the ethernet from ucbvax to ucbarpa, ! 2288: and then is submitted to the Arpanet. ! 2289: Although this involves some extra hops, ! 2290: we feel this is an acceptable tradeoff. ! 2291: .pp ! 2292: An interesting point is that it would be possible ! 2293: to update monet ! 2294: to send TCP mail directly to ucbarpa ! 2295: if the load got too high; ! 2296: if monet failed to note a host as a TCP host ! 2297: it would go via ucbvax as before, ! 2298: and if monet incorrectly sent a message to ucbarpa ! 2299: it would still be sent by ucbarpa ! 2300: to ucbvax as before. ! 2301: The only problem that can occur is loops, ! 2302: as if ucbarpa thought that ucbvax had the TCP connection ! 2303: and vice versa. ! 2304: For this reason, ! 2305: updates should ! 2306: .i always ! 2307: happen to the master host first. ! 2308: .pp ! 2309: This philosophy results as much from the need ! 2310: to have a single source for the configuration files ! 2311: (typically built using ! 2312: .i m4 \|(1) ! 2313: or some similar tool) ! 2314: as any logical need. ! 2315: Maintaining more than three separate tables by hand ! 2316: is essentially an impossible job. ! 2317: .sh 4 "Small site \*- complete information" ! 2318: .pp ! 2319: A small site ! 2320: (two or three hosts) ! 2321: may find it more reasonable to have complete information ! 2322: at each host. ! 2323: This would require that each host ! 2324: know exactly where each network connection is, ! 2325: possibly including the names of each host on that network. ! 2326: As long as the site remains small ! 2327: and the the configuration remains relatively static, ! 2328: the update problem will probably not be too great. ! 2329: .sh 4 "Single host" ! 2330: .pp ! 2331: This is in some sense the trivial case. ! 2332: The only major issue is trying to insure that you don't ! 2333: have to know too much about your environment. ! 2334: For example, ! 2335: if you have a UUCP connection ! 2336: you might find it useful to know about the names of hosts ! 2337: connected directly to you, ! 2338: but this is really not necessary ! 2339: since this may be determined from the syntax. ! 2340: .sh 3 "Relevant issues" ! 2341: .pp ! 2342: The canonical form you use ! 2343: should almost certainly be as specified in ! 2344: the Arpanet protocols ! 2345: RFC819 and RFC822. ! 2346: Copies of these RFC's are included on the ! 2347: .i sendmail ! 2348: tape ! 2349: as ! 2350: .i doc/rfc819.lpr ! 2351: and ! 2352: .i doc/rfc822.lpr . ! 2353: .pp ! 2354: RFC822 ! 2355: describes the format of the mail message itself. ! 2356: .i Sendmail ! 2357: follows this RFC closely, ! 2358: to the extent that many of the standards described in this document ! 2359: can not be changed without changing the code. ! 2360: In particular, ! 2361: the following characters have special interpretations: ! 2362: .(b ! 2363: < > ( ) " \e ! 2364: .)b ! 2365: Any attempt to use these characters for other than their RFC822 ! 2366: purpose in addresses is probably doomed to disaster. ! 2367: .pp ! 2368: RFC819 ! 2369: describes the specifics of the domain-based addressing. ! 2370: This is touched on in RFC822 as well. ! 2371: Essentially each host is given a name ! 2372: which is a right-to-left dot qualified pseudo-path ! 2373: from a distinguished root. ! 2374: The elements of the path need not be physical hosts; ! 2375: the domain is logical rather than physical. ! 2376: For example, ! 2377: at Berkeley ! 2378: one legal host is ! 2379: .q a.cc.berkeley.arpa ; ! 2380: reading from right to left, ! 2381: .q arpa ! 2382: is a top level domain ! 2383: (related to, but not limited to, the physical Arpanet), ! 2384: .q berkeley ! 2385: is both an Arpanet host and a logical domain ! 2386: which is actually interpreted by ! 2387: a host called ucbvax ! 2388: (which is actually just the ! 2389: .q "major" ! 2390: host for this domain), ! 2391: .q cc ! 2392: represents the Computer Center, ! 2393: (in this case a strictly logical entity), ! 2394: and ! 2395: .q a ! 2396: is a host in the Computer Center; ! 2397: this particular host happens to be connected ! 2398: via berknet, ! 2399: but other hosts might be connected via one of two ethernets ! 2400: or some other network. ! 2401: .pp ! 2402: Beware when reading RFC819 ! 2403: that there are a number of errors in it. ! 2404: .sh 3 "How to proceed" ! 2405: .pp ! 2406: Once you have decided on a philosophy, ! 2407: it is worth examining the available configuration tables ! 2408: to decide if any of them are close enough ! 2409: to steal major parts of. ! 2410: Even under the worst of conditions, ! 2411: there is a fair amount of boiler plate that can be collected safely. ! 2412: .pp ! 2413: The next step is to build ruleset three. ! 2414: This will be the hardest part of the job. ! 2415: Beware of doing too much to the address in this ruleset, ! 2416: since anything you do will reflect through ! 2417: to the message. ! 2418: In particular, ! 2419: stripping of local domains is best deferred, ! 2420: since this can leave you with addresses with no domain spec at all. ! 2421: Since ! 2422: .i sendmail ! 2423: likes to append the sending domain to addresses with no domain, ! 2424: this can change the semantics of addresses. ! 2425: Also try to avoid ! 2426: fully qualifying domains in this ruleset. ! 2427: Although technically legal, ! 2428: this can lead to unpleasantly and unnecessarily long addresses ! 2429: reflected into messages. ! 2430: The Berkeley configuration files ! 2431: define ruleset nine ! 2432: to qualify domain names and strip local domains. ! 2433: This is called from ruleset zero ! 2434: to get all addresses into a cleaner form. ! 2435: .pp ! 2436: Once you have ruleset three finished, ! 2437: the other rulesets should be relatively trivial. ! 2438: If you need hints, ! 2439: examine the supplied configuration tables. ! 2440: .sh 3 "Testing the rewriting rules \*- the \-bt flag" ! 2441: .pp ! 2442: When you build a configuration table, ! 2443: you can do a certain amount of testing ! 2444: using the ! 2445: .q "test mode" ! 2446: of ! 2447: .i sendmail . ! 2448: For example, ! 2449: you could invoke ! 2450: .i sendmail ! 2451: as: ! 2452: .(b ! 2453: sendmail \-bt \-Ctest.cf ! 2454: .)b ! 2455: which would read the configuration file ! 2456: .q test.cf ! 2457: and enter test mode. ! 2458: In this mode, ! 2459: you enter lines of the form: ! 2460: .(b ! 2461: rwset address ! 2462: .)b ! 2463: where ! 2464: .i rwset ! 2465: is the rewriting set you want to use ! 2466: and ! 2467: .i address ! 2468: is an address to apply the set to. ! 2469: Test mode shows you the steps it takes ! 2470: as it proceeds, ! 2471: finally showing you the address it ends up with. ! 2472: You may use a comma separated list of rwsets ! 2473: for sequential application of rules to an input; ! 2474: ruleset three is always applied first. ! 2475: For example: ! 2476: .(b ! 2477: 1,21,4 monet:bollard ! 2478: .)b ! 2479: first applies ruleset three to the input ! 2480: .q monet:bollard. ! 2481: Ruleset one is then applied to the output of ruleset three, ! 2482: followed similarly by rulesets twenty-one and four. ! 2483: .pp ! 2484: If you need more detail, ! 2485: you can also use the ! 2486: .q \-d21 ! 2487: flag to turn on more debugging. ! 2488: For example, ! 2489: .(b ! 2490: sendmail \-bt \-d21.99 ! 2491: .)b ! 2492: turns on an incredible amount of information; ! 2493: a single word address ! 2494: is probably going to print out several pages worth of information. ! 2495: .sh 3 "Building mailer descriptions" ! 2496: .pp ! 2497: To add an outgoing mailer to your mail system, ! 2498: you will have to define the characteristics of the mailer. ! 2499: .pp ! 2500: Each mailer must have an internal name. ! 2501: This can be arbitrary, ! 2502: except that the names ! 2503: .q local ! 2504: and ! 2505: .q prog ! 2506: must be defined. ! 2507: .pp ! 2508: The pathname of the mailer must be given in the P field. ! 2509: If this mailer should be accessed via an IPC connection, ! 2510: use the string ! 2511: .q [IPC] ! 2512: instead. ! 2513: .pp ! 2514: The F field defines the mailer flags. ! 2515: You should specify an ! 2516: .q f ! 2517: or ! 2518: .q r ! 2519: flag to pass the name of the sender as a ! 2520: .b \-f ! 2521: or ! 2522: .b \-r ! 2523: flag respectively. ! 2524: These flags are only passed if they were passed to ! 2525: .i sendmail, ! 2526: so that mailers that give errors under some circumstances ! 2527: can be placated. ! 2528: If the mailer is not picky ! 2529: you can just specify ! 2530: .q "\-f $g" ! 2531: in the argv template. ! 2532: If the mailer must be called as ! 2533: .b root ! 2534: the ! 2535: .q S ! 2536: flag should be given; ! 2537: this will not reset the userid ! 2538: before calling the mailer\**. ! 2539: .(f ! 2540: \**\c ! 2541: .i Sendmail ! 2542: must be running setuid to root ! 2543: for this to work. ! 2544: .)f ! 2545: If this mailer is local ! 2546: (i.e., will perform final delivery ! 2547: rather than another network hop) ! 2548: the ! 2549: .q l ! 2550: flag should be given. ! 2551: Quote characters ! 2552: (backslashes and " marks) ! 2553: can be stripped from addresses if the ! 2554: .q s ! 2555: flag is specified; ! 2556: if this is not given ! 2557: they are passed through. ! 2558: If the mailer is capable of sending to more than one user ! 2559: on the same host ! 2560: in a single transaction ! 2561: the ! 2562: .q m ! 2563: flag should be stated. ! 2564: If this flag is on, ! 2565: then the argv template containing ! 2566: .b $u ! 2567: will be repeated for each unique user ! 2568: on a given host. ! 2569: The ! 2570: .q e ! 2571: flag will mark the mailer as being ! 2572: .q expensive, ! 2573: which will cause ! 2574: .i sendmail ! 2575: to defer connection ! 2576: until a queue run\**. ! 2577: .(f ! 2578: \**The ! 2579: .q c ! 2580: configuration option must be given ! 2581: for this to be effective. ! 2582: .)f ! 2583: .pp ! 2584: An unusual case is the ! 2585: .q C ! 2586: flag. ! 2587: This flag applies to the mailer that the message is received from, ! 2588: rather than the mailer being sent to; ! 2589: if set, ! 2590: the domain spec of the sender ! 2591: (i.e., the ! 2592: .q @host.domain ! 2593: part) ! 2594: is saved ! 2595: and is appended to any addresses in the message ! 2596: that do not already contain a domain spec. ! 2597: For example, ! 2598: a message of the form: ! 2599: .(b ! 2600: From: eric@ucbarpa ! 2601: To: wnj@monet, mckusick ! 2602: .)b ! 2603: will be modified to: ! 2604: .(b ! 2605: From: eric@ucbarpa ! 2606: To: wnj@monet, mckusick@ucbarpa ! 2607: .)b ! 2608: .i "if and only if" ! 2609: the ! 2610: .q C ! 2611: flag is defined in the mailer corresponding to ! 2612: .q eric@ucbarpa. ! 2613: .pp ! 2614: Other flags are described ! 2615: in Appendix C. ! 2616: .pp ! 2617: The S and R fields in the mailer description ! 2618: are per-mailer rewriting sets ! 2619: to be applied to sender and recipient addresses ! 2620: respectively. ! 2621: These are applied after the sending domain is appended ! 2622: and the general rewriting sets ! 2623: (numbers one and two) ! 2624: are applied, ! 2625: but before the output rewrite ! 2626: (ruleset four) ! 2627: is applied. ! 2628: A typical use is to append the current domain ! 2629: to addresses that do not already have a domain. ! 2630: For example, ! 2631: a header of the form: ! 2632: .(b ! 2633: From: eric ! 2634: .)b ! 2635: might be changed to be: ! 2636: .(b ! 2637: From: eric@ucbarpa ! 2638: .)b ! 2639: or ! 2640: .(b ! 2641: From: ucbvax!eric ! 2642: .)b ! 2643: depending on the domain it is being shipped into. ! 2644: These sets can also be used ! 2645: to do special purpose output rewriting ! 2646: in cooperation with ruleset four. ! 2647: .pp ! 2648: The E field defines the string to use ! 2649: as an end-of-line indication. ! 2650: A string containing only newline is the default. ! 2651: The usual backslash escapes ! 2652: (\er, \en, \ef, \eb) ! 2653: may be used. ! 2654: .pp ! 2655: Finally, ! 2656: an argv template is given as the E field. ! 2657: It may have embedded spaces. ! 2658: If there is no argv with a ! 2659: .b $u ! 2660: macro in it, ! 2661: .i sendmail ! 2662: will speak SMTP ! 2663: to the mailer. ! 2664: If the pathname for this mailer is ! 2665: .q [IPC], ! 2666: the argv should be ! 2667: .(b ! 2668: IPC $h [ \fIport\fP ] ! 2669: .)b ! 2670: where ! 2671: .i port ! 2672: is the optional port number ! 2673: to connect to. ! 2674: .pp ! 2675: For example, ! 2676: the specifications: ! 2677: .(b ! 2678: .ta \w'Mlocal, 'u +\w'P=/bin/mail, 'u +\w'F=rlsm, 'u +\w'S=10, 'u +\w'R=20, 'u ! 2679: Mlocal, P=/bin/mail, F=rlsm S=10, R=20, A=mail \-d $u ! 2680: Mether, P=[IPC], F=meC, S=11, R=21, A=IPC $h, M=100000 ! 2681: .)b ! 2682: specifies a mailer to do local delivery ! 2683: and a mailer for ethernet delivery. ! 2684: The first is called ! 2685: .q local, ! 2686: is located in the file ! 2687: .q /bin/mail, ! 2688: takes a picky ! 2689: .b \-r ! 2690: flag, ! 2691: does local delivery, ! 2692: quotes should be stripped from addresses, ! 2693: and multiple users can be delivered at once; ! 2694: ruleset ten ! 2695: should be applied to sender addresses in the message ! 2696: and ruleset twenty ! 2697: should be applied to recipient addresses; ! 2698: the argv to send to a message will be the word ! 2699: .q mail, ! 2700: the word ! 2701: .q \-d, ! 2702: and words containing the name of the receiving user. ! 2703: If a ! 2704: .b \-r ! 2705: flag is inserted ! 2706: it will be between the words ! 2707: .q mail ! 2708: and ! 2709: .q \-d. ! 2710: The second mailer is called ! 2711: .q ether, ! 2712: it should be connected to via an IPC connection, ! 2713: it can handle multiple users at once, ! 2714: connections should be deferred, ! 2715: and any domain from the sender address ! 2716: should be appended to any receiver name ! 2717: without a domain; ! 2718: sender addresses should be processed by ruleset eleven ! 2719: and recipient addresses by ruleset twenty-one. ! 2720: There is a 100,000 byte limit on messages passed through this mailer. ! 2721: .++ A ! 2722: .+c "COMMAND LINE FLAGS" ! 2723: .ba 0 ! 2724: .nr ii 1i ! 2725: .pp ! 2726: Arguments must be presented with flags before addresses. ! 2727: The flags are: ! 2728: .ip "\-f\ \fIaddr\fP" ! 2729: The sender's machine address is ! 2730: .i addr . ! 2731: This flag is ignored unless the real user ! 2732: is listed as a ! 2733: .q "trusted user" ! 2734: or if ! 2735: .i addr ! 2736: contains an exclamation point ! 2737: (because of certain restrictions in UUCP). ! 2738: .ip "\-r\ \fIaddr\fP" ! 2739: An obsolete form of ! 2740: .b \-f . ! 2741: .ip "\-h\ \fIcnt\fP" ! 2742: Sets the ! 2743: .q "hop count" ! 2744: to ! 2745: .i cnt . ! 2746: This represents the number of times this message has been processed ! 2747: by ! 2748: .i sendmail ! 2749: (to the extent that it is supported by the underlying networks). ! 2750: .i Cnt ! 2751: is incremented during processing, ! 2752: and if it reaches ! 2753: MAXHOP ! 2754: (currently 30) ! 2755: .i sendmail ! 2756: throws away the message with an error. ! 2757: .ip \-F\fIname\fP ! 2758: Sets the full name of this user to ! 2759: .i name . ! 2760: .ip \-n ! 2761: Don't do aliasing or forwarding. ! 2762: .ip \-t ! 2763: Read the header for ! 2764: .q To: , ! 2765: .q Cc: , ! 2766: and ! 2767: .q Bcc: ! 2768: lines, and send to everyone listed in those lists. ! 2769: The ! 2770: .q Bcc: ! 2771: line will be deleted before sending. ! 2772: Any addresses in the argument vector will be deleted ! 2773: from the send list. ! 2774: .ip \-b\fIx\fP ! 2775: Set operation mode to ! 2776: .i x . ! 2777: Operation modes are: ! 2778: .(b ! 2779: .ta 4n ! 2780: m Deliver mail (default) ! 2781: a Run in arpanet mode (see below) ! 2782: s Speak SMTP on input side ! 2783: d Run as a daemon ! 2784: t Run in test mode ! 2785: v Just verify addresses, don't collect or deliver ! 2786: i Initialize the alias database ! 2787: p Print the mail queue ! 2788: z Freeze the configuration file ! 2789: .)b ! 2790: The special processing for the ! 2791: ARPANET ! 2792: includes reading the ! 2793: .q "From:" ! 2794: line from the header to find the sender, ! 2795: printing ! 2796: ARPANET ! 2797: style messages ! 2798: (preceded by three digit reply codes for compatibility with ! 2799: the FTP protocol ! 2800: [Neigus73, Postel74, Postel77]), ! 2801: and ending lines of error messages with <CRLF>. ! 2802: .ip \-q\fItime\fP ! 2803: Try to process the queued up mail. ! 2804: If the time is given, ! 2805: a sendmail will run through the queue at the specified interval ! 2806: to deliver queued mail; ! 2807: otherwise, it only runs once. ! 2808: .ip \-C\fIfile\fP ! 2809: Use a different configuration file. ! 2810: .ip \-d\fIlevel\fP ! 2811: Set debugging level. ! 2812: .ip \-o\fIx\|value\fP ! 2813: Set option ! 2814: .i x ! 2815: to the specified ! 2816: .i value . ! 2817: These options are described in Appendix B. ! 2818: .pp ! 2819: There are a number of options that may be specified as ! 2820: primitive flags ! 2821: (provided for compatibility with ! 2822: .i delivermail ). ! 2823: These are the e, i, m, and v options. ! 2824: Also, ! 2825: the f option ! 2826: may be specified as the ! 2827: .b \-s ! 2828: flag. ! 2829: .+c "CONFIGURATION OPTIONS" ! 2830: .pp ! 2831: The following options may be set using the ! 2832: .b \-o ! 2833: flag on the command line ! 2834: or the ! 2835: .b O ! 2836: line in the configuration file: ! 2837: .nr ii 1i ! 2838: .ip A\fIfile\fP ! 2839: Use the named ! 2840: .i file ! 2841: as the alias file. ! 2842: If no file is specified, ! 2843: use ! 2844: .i aliases ! 2845: in the current directory. ! 2846: .ip a ! 2847: If set, ! 2848: wait for an ! 2849: .q @:@ ! 2850: entry to exist in the alias database ! 2851: before starting up. ! 2852: If it does not appear in five minutes, ! 2853: rebuild the database. ! 2854: .ip c ! 2855: If an outgoing mailer is marked as being expensive, ! 2856: don't connect immediately. ! 2857: This requires that queueing be compiled in, ! 2858: since it will depend on a queue run process to ! 2859: actually send the mail. ! 2860: .ip d\fIx\fP ! 2861: Deliver in mode ! 2862: .i x . ! 2863: Legal modes are: ! 2864: .(b ! 2865: .ta 4n ! 2866: i Deliver interactively (synchronously) ! 2867: b Deliver in background (asynchronously) ! 2868: q Just queue the message (deliver during queue run) ! 2869: .)b ! 2870: .ip D ! 2871: If set, ! 2872: rebuild the alias database if necessary and possible. ! 2873: If this option is not set, ! 2874: .i sendmail ! 2875: will never rebuild the alias database ! 2876: unless explicitly requested ! 2877: using ! 2878: .b \-bi . ! 2879: .ip e\fIx\fP ! 2880: Dispose of errors using mode ! 2881: .i x . ! 2882: The values for ! 2883: .i x ! 2884: are: ! 2885: .(b ! 2886: p Print error messages (default) ! 2887: q No messages, just give exit status ! 2888: m Mail back errors ! 2889: w Write back errors (mail if user not logged in) ! 2890: e Mail back errors and give zero exit stat always ! 2891: .)b ! 2892: .ip F\fIn\fP ! 2893: The temporary file mode, ! 2894: in octal. ! 2895: 644 and 600 are good choices. ! 2896: .ip f ! 2897: Save ! 2898: Unix-style ! 2899: .q From ! 2900: lines at the front of headers. ! 2901: Normally they are assumed redundant ! 2902: and discarded. ! 2903: .ip g\fIn\fP ! 2904: Set the default group id ! 2905: for mailers to run in ! 2906: to ! 2907: .i n . ! 2908: .ip H\fIfile\fP ! 2909: Specify the help file ! 2910: for SMTP. ! 2911: .ip i ! 2912: Ignore dots in incoming messages. ! 2913: .ip L\fIn\fP ! 2914: Set the default log level to ! 2915: .i n . ! 2916: .ip M\fIx\|value\fP ! 2917: Set the macro ! 2918: .i x ! 2919: to ! 2920: .i value . ! 2921: This is intended only for use from the command line. ! 2922: .ip m ! 2923: Send to me too, ! 2924: even if I am in an alias expansion. ! 2925: .ip o ! 2926: Assume that the headers may be in old format, ! 2927: i.e., ! 2928: spaces delimit names. ! 2929: This actually turns on ! 2930: an adaptive algorithm: ! 2931: if any recipient address contains a comma, parenthesis, ! 2932: or angle bracket, ! 2933: it will be assumed that commas already exist. ! 2934: If this flag is not on, ! 2935: only commas delimit names. ! 2936: Headers are always output with commas between the names. ! 2937: .ip Q\fIdir\fP ! 2938: Use the named ! 2939: .i dir ! 2940: as the queue directory. ! 2941: .ip r\fItime\fP ! 2942: Timeout reads after ! 2943: .i time ! 2944: interval. ! 2945: .ip S\fIfile\fP ! 2946: Log statistics in the named ! 2947: .i file . ! 2948: .ip s ! 2949: Be super-safe when running things, ! 2950: i.e., ! 2951: always instantiate the queue file, ! 2952: even if you are going to attempt immediate delivery. ! 2953: .i Sendmail ! 2954: always instantiates the queue file ! 2955: before returning control the the client ! 2956: under any circumstances. ! 2957: .ip T\fItime\fP ! 2958: Set the queue timeout to ! 2959: .i time . ! 2960: After this interval, ! 2961: messages that have not been successfully sent ! 2962: will be returned to the sender. ! 2963: .ip t\fIS,D\fP ! 2964: Set the local timezone name to ! 2965: .i S ! 2966: for standard time and ! 2967: .i D ! 2968: for daylight time; ! 2969: this is only used under version six. ! 2970: .ip u\fIn\fP ! 2971: Set the default userid for mailers to ! 2972: .i n . ! 2973: Mailers without the ! 2974: .i S ! 2975: flag in the mailer definition ! 2976: will run as this user. ! 2977: .ip v ! 2978: Run in verbose mode. ! 2979: .+c "MAILER FLAGS" ! 2980: The following flags may be set in the mailer description. ! 2981: .nr ii 4n ! 2982: .ip f ! 2983: The mailer wants a ! 2984: .b \-f ! 2985: .i from ! 2986: flag, ! 2987: but only if this is a network forward operation ! 2988: (i.e., ! 2989: the mailer will give an error ! 2990: if the executing user ! 2991: does not have special permissions). ! 2992: .ip r ! 2993: Same as ! 2994: .b f , ! 2995: but sends a ! 2996: .b \-r ! 2997: flag. ! 2998: .ip S ! 2999: Don't reset the userid ! 3000: before calling the mailer. ! 3001: This would be used in a secure environment ! 3002: where ! 3003: .i sendmail ! 3004: ran as root. ! 3005: This could be used to avoid forged addresses. ! 3006: This flag is suppressed if given from an ! 3007: .q unsafe ! 3008: environment ! 3009: (e.g, a user's mail.cf file). ! 3010: .ip n ! 3011: Do not insert a UNIX-style ! 3012: .q From ! 3013: line on the front of the message. ! 3014: .ip l ! 3015: This mailer is local ! 3016: (i.e., ! 3017: final delivery will be performed). ! 3018: .ip s ! 3019: Strip quote characters off of the address ! 3020: before calling the mailer. ! 3021: .ip m ! 3022: This mailer can send to multiple users ! 3023: on the same host ! 3024: in one transaction. ! 3025: When a ! 3026: .b $u ! 3027: macro occurs in the ! 3028: .i argv ! 3029: part of the mailer definition, ! 3030: that field will be repeated as necessary ! 3031: for all qualifying users. ! 3032: .ip F ! 3033: This mailer wants a ! 3034: .q From: ! 3035: header line. ! 3036: .ip D ! 3037: This mailer wants a ! 3038: .q Date: ! 3039: header line. ! 3040: .ip M ! 3041: This mailer wants a ! 3042: .q Message-Id: ! 3043: header line. ! 3044: .ip x ! 3045: This mailer wants a ! 3046: .q Full-Name: ! 3047: header line. ! 3048: .ip P ! 3049: This mailer wants a ! 3050: .q Return-Path: ! 3051: line. ! 3052: .ip u ! 3053: Upper case should be preserved in user names ! 3054: for this mailer. ! 3055: .ip h ! 3056: Upper case should be preserved in host names ! 3057: for this mailer. ! 3058: .ip A ! 3059: This is an Arpanet-compatible mailer, ! 3060: and all appropriate modes should be set. ! 3061: .ip U ! 3062: This mailer wants Unix-style ! 3063: .q From ! 3064: lines with the ugly UUCP-style ! 3065: .q "remote from <host>" ! 3066: on the end. ! 3067: .ip e ! 3068: This mailer is expensive to connect to, ! 3069: so try to avoid connecting normally; ! 3070: any necessary connection will occur during a queue run. ! 3071: .ip X ! 3072: This mailer want to use the hidden dot algorithm ! 3073: as specified in RFC821; ! 3074: basically, ! 3075: any line beginning with a dot ! 3076: will have an extra dot prepended ! 3077: (to be stripped at the other end). ! 3078: This insures that lines in the message containing a dot ! 3079: will not terminate the message prematurely. ! 3080: .ip L ! 3081: Limit the line lengths as specified in RFC821. ! 3082: .ip P ! 3083: Use the return-path in the SMTP ! 3084: .q "MAIL FROM:" ! 3085: command ! 3086: rather than just the return address; ! 3087: although this is required in RFC821, ! 3088: many hosts do not process return paths properly. ! 3089: .ip I ! 3090: This mailer will be speaking SMTP ! 3091: to another ! 3092: .i sendmail ! 3093: \*- ! 3094: as such it can use special protocol features. ! 3095: This option is not required ! 3096: (i.e., ! 3097: if this option is omitted the transmission will still operate successfully, ! 3098: although perhaps not as efficiently as possible). ! 3099: .ip C ! 3100: If mail is ! 3101: .i received ! 3102: from a mailer with this flag set, ! 3103: any addresses in the header that do not have an at sign ! 3104: (\c ! 3105: .q @ ) ! 3106: after being rewritten by ruleset three ! 3107: will have the ! 3108: .q @domain ! 3109: clause from the sender ! 3110: tacked on. ! 3111: This allows mail with headers of the form: ! 3112: .(b ! 3113: From: usera@hosta ! 3114: To: userb@hostb, userc ! 3115: .)b ! 3116: to be rewritten as: ! 3117: .(b ! 3118: From: usera@hosta ! 3119: To: userb@hostb, userc@hosta ! 3120: .)b ! 3121: automatically. ! 3122: .+c "OTHER CONFIGURATION" ! 3123: .rm $0 ! 3124: .nr ii 1i ! 3125: .pp ! 3126: There are some configuration changes that can be made by ! 3127: recompiling ! 3128: .i sendmail . ! 3129: These are located in three places: ! 3130: .ip md/config.m4 ! 3131: These contain operating-system dependent descriptions. ! 3132: They are interpolated into the Makefiles in the ! 3133: .i src ! 3134: and ! 3135: .i aux ! 3136: directories. ! 3137: This includes information about what version of UNIX ! 3138: you are running, ! 3139: what libraries you have to include, etc. ! 3140: .ip src/conf.h ! 3141: Configuration parameters that may be tweaked by the installer ! 3142: are included in conf.h. ! 3143: .ip src/conf.c ! 3144: Some special routines and a few variables ! 3145: may be defined in conf.c. ! 3146: For the most part these are selected from the settings ! 3147: in conf.h. ! 3148: .uh "Parameters in md/config.m4" ! 3149: .pp ! 3150: The following compilation flags may be defined in the ! 3151: .i m4CONFIG ! 3152: macro in ! 3153: .i md/config.m4 ! 3154: to define the environment in which you are operating. ! 3155: .ip V6 ! 3156: If set, ! 3157: this will compile a version 6 system, ! 3158: with 8-bit user id's, ! 3159: single character tty id's, ! 3160: etc. ! 3161: .ip VMUNIX ! 3162: If set, ! 3163: you will be assumed to have a Berkeley 4BSD or 4.1BSD, ! 3164: including the ! 3165: .i vfork \|(2) ! 3166: system call, ! 3167: special types defined in <sys/types.h> ! 3168: (e.g, u_char), ! 3169: etc. ! 3170: .lp ! 3171: If none of these flags are set, ! 3172: a version 7 system is assumed. ! 3173: .pp ! 3174: You will also have to specify what libraries to link with ! 3175: .i sendmail ! 3176: in the ! 3177: .i m4LIBS ! 3178: macro. ! 3179: Most notably, you will have to include ! 3180: .B \-ljobs ! 3181: if you are running a 4.1BSD system. ! 3182: .uh "Parameters in src/conf.h" ! 3183: .pp ! 3184: Parameters and compilation options ! 3185: are defined in conf.h. ! 3186: Most of these need not normally be tweaked; ! 3187: common parameters are all in sendmail.cf. ! 3188: However, the sizes of certain primitive vectors, etc., ! 3189: are included in this file. ! 3190: The numbers following the parameters ! 3191: are their default value. ! 3192: .nr ii 1.2i ! 3193: .ip "MAXLINE [256]" ! 3194: The maximum line length of any input line. ! 3195: If message lines exceed this length ! 3196: they will still be processed correctly; ! 3197: however, header lines, ! 3198: configuration file lines, ! 3199: alias lines, ! 3200: etc., ! 3201: must fit within this limit. ! 3202: .ip "MAXNAME [128]" ! 3203: The maximum length of any name, ! 3204: such as a host or a user name. ! 3205: .ip "MAXFIELD [2500]" ! 3206: The maximum total length of any header field, ! 3207: including continuation lines. ! 3208: .ip "MAXPV [40]" ! 3209: The maximum number of parameters to any mailer. ! 3210: This limits the number of recipients that may be passed in one transaction. ! 3211: .ip "MAXHOP [30]" ! 3212: When a message has been processed more than this number of times, ! 3213: sendmail rejects the message ! 3214: on the assumption that there has been an aliasing loop. ! 3215: This can be determined from the ! 3216: .b \-h ! 3217: flag ! 3218: or by counting the number of trace fields ! 3219: (i.e, ! 3220: .q Received: ! 3221: lines) ! 3222: in the message header. ! 3223: .ip "MAXATOM [100]" ! 3224: The maximum number of atoms ! 3225: (tokens) ! 3226: in a single address. ! 3227: For example, ! 3228: the address ! 3229: .q "eric@Berkeley" ! 3230: is three atoms. ! 3231: .ip "MAXMAILERS [25]" ! 3232: The maximum number of mailers that may be defined ! 3233: in the configuration file. ! 3234: .ip "MAXRWSETS [30]" ! 3235: The maximum number of rewriting sets ! 3236: that may be defined. ! 3237: .ip "MAXPRIORITIES [25]" ! 3238: The maximum number of values for the ! 3239: .q Precedence: ! 3240: field that may be defined ! 3241: (using the ! 3242: .b P ! 3243: line in sendmail.cf). ! 3244: .ip "MAXTRUST [30]" ! 3245: The maximum number of trusted users that may be defined ! 3246: (using the ! 3247: .b T ! 3248: line in sendmail.cf). ! 3249: .lp ! 3250: A number of other compilation options exist. ! 3251: These specify whether or not specific code should be compiled in. ! 3252: .nr ii 1i ! 3253: .ip DBM ! 3254: If set, ! 3255: the ! 3256: .q DBM ! 3257: package in UNIX is used ! 3258: (see DBM(3X) in [UNIX80]). ! 3259: If not set, ! 3260: a much less efficient algorithm for processing aliases is used. ! 3261: .ip DEBUG ! 3262: If set, debugging information is compiled in. ! 3263: To actually get the debugging output, ! 3264: the ! 3265: .b \-d ! 3266: flag must be used. ! 3267: .ip LOG ! 3268: If set, ! 3269: the ! 3270: .i syslog ! 3271: routine in use at some sites is used. ! 3272: This makes an informational log record ! 3273: for each message processed, ! 3274: and makes a higher priority log record ! 3275: for internal system errors. ! 3276: .ip QUEUE ! 3277: This flag should be set to compile in the queueing code. ! 3278: If this is not set, ! 3279: mailers must accept the mail immediately ! 3280: or it will be returned to the sender. ! 3281: .ip SMTP ! 3282: If set, ! 3283: the code to handle user and server SMTP will be compiled in. ! 3284: This is only necessary if your machine has some mailer ! 3285: that speaks SMTP. ! 3286: .ip DAEMON ! 3287: If set, ! 3288: code to run a daemon is compiled in. ! 3289: This code is for 4.2BSD ! 3290: if the ! 3291: NVMUNIX ! 3292: flag is specified; ! 3293: otherwise, ! 3294: 4.1a BSD code is used. ! 3295: Beware however ! 3296: that there are bugs in the 4.1a code ! 3297: that make it impossible for ! 3298: .b sendmail ! 3299: to work correctly ! 3300: under heavy load. ! 3301: .ip UGLYUUCP ! 3302: If you have a UUCP host adjacent to you which is not running ! 3303: a reasonable version of ! 3304: .i rmail , ! 3305: you will have to set this flag to include the ! 3306: .q "remote from sysname" ! 3307: info on the from line. ! 3308: Otherwise, UUCP gets confused about where the mail came from. ! 3309: .ip NOTUNIX ! 3310: If you are using a non-UNIX mail format, ! 3311: you can set this flag to turn off special processing ! 3312: of UNIX-style ! 3313: .q "From " ! 3314: lines. ! 3315: .uh "Configuration in src/conf.c" ! 3316: .pp ! 3317: Not all header semantics are defined in the configuration file. ! 3318: Header lines that should only be included by certain mailers ! 3319: (as well as other more obscure semantics) ! 3320: must be specified in the ! 3321: .i HdrInfo ! 3322: table in ! 3323: .i conf.c . ! 3324: This table contains the header name ! 3325: (which should be in all lower case) ! 3326: and a set of header control flags (described below), ! 3327: The flags are: ! 3328: .ip H_ACHECK ! 3329: Normally when the check is made to see if a header line is compatible ! 3330: with a mailer, ! 3331: .i sendmail ! 3332: will not delete an existing line. ! 3333: If this flag is set, ! 3334: .i sendmail ! 3335: will delete ! 3336: even existing header lines. ! 3337: That is, ! 3338: if this bit is set and the mailer does not have flag bits set ! 3339: that intersect with the required mailer flags ! 3340: in the header definition in ! 3341: sendmail.cf, ! 3342: the header line is ! 3343: .i always ! 3344: deleted. ! 3345: .ip H_EOH ! 3346: If this header field is set, ! 3347: treat it like a blank line, ! 3348: i.e., ! 3349: it will signal the end of the header ! 3350: and the beginning of the message text. ! 3351: .ip H_FORCE ! 3352: Add this header entry ! 3353: even if one existed in the message before. ! 3354: If a header entry does not have this bit set, ! 3355: .i sendmail ! 3356: will not add another header line if a header line ! 3357: of this name already existed. ! 3358: This would normally be used to stamp the message ! 3359: by everyone who handled it. ! 3360: .ip H_TRACE ! 3361: If set, ! 3362: this is a timestamp ! 3363: (trace) ! 3364: field. ! 3365: If the number of trace fields in a message ! 3366: exceeds a preset amount ! 3367: the message is returned ! 3368: on the assumption that it has an aliasing loop. ! 3369: .ip H_RCPT ! 3370: If set, ! 3371: this field contains recipient addresses. ! 3372: This is used by the ! 3373: .b \-t ! 3374: flag to determine who to send to ! 3375: when it is collecting recipients from the message. ! 3376: .ip H_FROM ! 3377: This flag indicates that this field ! 3378: specifies a sender. ! 3379: The order of these fields in the ! 3380: .i HdrInfo ! 3381: table specifies ! 3382: .i sendmail's ! 3383: preference ! 3384: for which field to return error messages to. ! 3385: .nr ii 5n ! 3386: .lp ! 3387: Let's look at a sample ! 3388: .i HdrInfo ! 3389: specification: ! 3390: .(b ! 3391: .ta 4n +\w'"return-receipt-to", 'u ! 3392: struct hdrinfo HdrInfo[] = ! 3393: { ! 3394: /* originator fields, most to least significant */ ! 3395: "resent-sender", H_FROM, ! 3396: "resent-from", H_FROM, ! 3397: "sender", H_FROM, ! 3398: "from", H_FROM, ! 3399: "full-name", H_ACHECK, ! 3400: /* destination fields */ ! 3401: "to", H_RCPT, ! 3402: "resent-to", H_RCPT, ! 3403: "cc", H_RCPT, ! 3404: /* message identification and control */ ! 3405: "message", H_EOH, ! 3406: "text", H_EOH, ! 3407: /* trace fields */ ! 3408: "received", H_TRACE|H_FORCE, ! 3409: ! 3410: NULL, 0, ! 3411: }; ! 3412: .)b ! 3413: This structure indicates that the ! 3414: .q To: , ! 3415: .q Resent-To: , ! 3416: and ! 3417: .q Cc: ! 3418: fields ! 3419: all specify recipient addresses. ! 3420: Any ! 3421: .q Full-Name: ! 3422: field will be deleted unless the required mailer flag ! 3423: (indicated in the configuration file) ! 3424: is specified. ! 3425: The ! 3426: .q Message: ! 3427: and ! 3428: .q Text: ! 3429: fields will terminate the header; ! 3430: these are specified in new protocols ! 3431: [NBS80] ! 3432: or used by random dissenters around the network world. ! 3433: The ! 3434: .q Received: ! 3435: field will always be added, ! 3436: and can be used to trace messages. ! 3437: .pp ! 3438: There are a number of important points here. ! 3439: First, ! 3440: header fields are not added automatically just because they are in the ! 3441: .i HdrInfo ! 3442: structure; ! 3443: they must be specified in the configuration file ! 3444: in order to be added to the message. ! 3445: Any header fields mentioned in the configuration file but not ! 3446: mentioned in the ! 3447: .i HdrInfo ! 3448: structure have default processing performed; ! 3449: that is, ! 3450: they are added unless they were in the message already. ! 3451: Second, ! 3452: the ! 3453: .i HdrInfo ! 3454: structure only specifies cliched processing; ! 3455: certain headers are processed specially by ad hoc code ! 3456: regardless of the status specified in ! 3457: .i HdrInfo . ! 3458: For example, ! 3459: the ! 3460: .q Sender: ! 3461: and ! 3462: .q From: ! 3463: fields are always scanned on ARPANET mail ! 3464: to determine the sender; ! 3465: this is used to perform the ! 3466: .q "return to sender" ! 3467: function. ! 3468: The ! 3469: .q "From:" ! 3470: and ! 3471: .q "Full-Name:" ! 3472: fields are used to determine the full name of the sender ! 3473: if possible; ! 3474: this is stored in the macro ! 3475: .b $x ! 3476: and used in a number of ways. ! 3477: .pp ! 3478: The file ! 3479: .i conf.c ! 3480: also contains the specification of ARPANET reply codes. ! 3481: There are four classifications these fall into: ! 3482: .(b ! 3483: .sz -1 ! 3484: .ta \w'char 'u +\w'Arpa_TUsrerr[] = 'u +\w'"888"; 'u ! 3485: char Arpa_Info[] = "050"; /* arbitrary info */ ! 3486: char Arpa_TSyserr[] = "455"; /* some (transient) system error */ ! 3487: char Arpa_PSyserr[] = "554"; /* some (transient) system error */ ! 3488: char Arpa_Usrerr[] = "554"; /* some (fatal) user error */ ! 3489: .sz ! 3490: .)b ! 3491: The class ! 3492: .i Arpa_Info ! 3493: is for any information that is not required by the protocol, ! 3494: such as forwarding information. ! 3495: .i Arpa_TSyserr ! 3496: and ! 3497: .i Arpa_PSyserr ! 3498: is printed by the ! 3499: .i syserr ! 3500: routine. ! 3501: TSyserr ! 3502: is printed out for transient errors, ! 3503: whereas PSyserr ! 3504: is printed for permanent errors; ! 3505: the distinction is made based on the value of ! 3506: .i errno . ! 3507: Finally, ! 3508: .i Arpa_Usrerr ! 3509: is the result of a user error ! 3510: and is generated by the ! 3511: .i usrerr ! 3512: routine; ! 3513: these are generated when the user has specified something wrong, ! 3514: and hence the error is permanent, ! 3515: i.e., ! 3516: it will not work simply by resubmitting the request. ! 3517: .pp ! 3518: If it is necessary to restrict mail through a relay, ! 3519: the ! 3520: .i checkcompat ! 3521: routine can be modified. ! 3522: This routine is called for every recipient address. ! 3523: It can return ! 3524: .b TRUE ! 3525: to indicate that the address is acceptable ! 3526: and mail processing will continue, ! 3527: or it can return ! 3528: .b FALSE ! 3529: to reject the recipient. ! 3530: If it returns false, ! 3531: it is up to ! 3532: .i checkcompat ! 3533: to print an error message ! 3534: (using ! 3535: .i usrerr ) ! 3536: saying why the message is rejected. ! 3537: For example, ! 3538: .i checkcompat ! 3539: could read: ! 3540: .(b ! 3541: .re ! 3542: .sz -1 ! 3543: .ta 4n +4n +4n +4n +4n +4n +4n ! 3544: bool ! 3545: checkcompat(to) ! 3546: register ADDRESS *to; ! 3547: { ! 3548: if (MsgSize > 50000 && to->q_mailer != LocalMailer) ! 3549: { ! 3550: usrerr("Message too large for non-local delivery"); ! 3551: NoReturn = TRUE; ! 3552: return (FALSE); ! 3553: } ! 3554: return (TRUE); ! 3555: } ! 3556: .sz ! 3557: .)b ! 3558: This would reject messages greater than 50000 bytes ! 3559: unless they were local. ! 3560: The ! 3561: .i NoReturn ! 3562: flag can be sent to supress the return of the actual body ! 3563: of the message in the error return. ! 3564: The actual use of this routine is highly dependent on the ! 3565: implementation, ! 3566: and use should be limited. ! 3567: .+c "SUMMARY OF SUPPORT FILES" ! 3568: .pp ! 3569: This is a summary of the support files ! 3570: that ! 3571: .i sendmail ! 3572: creates or generates. ! 3573: .nr ii 1i ! 3574: .ip "/usr/lib/sendmail" ! 3575: The binary of ! 3576: .i sendmail . ! 3577: .ip /usr/bin/newaliases ! 3578: A link to /usr/lib/sendmail; ! 3579: causes the alias database to be rebuilt. ! 3580: Running this program is completely equivalent to giving ! 3581: .i sendmail ! 3582: the ! 3583: .b \-bi ! 3584: flag. ! 3585: .ip /usr/bin/mailq ! 3586: Prints a listing of the mail queue. ! 3587: This program is equivalent to using the ! 3588: .b \-bp ! 3589: flag to ! 3590: .i sendmail . ! 3591: .ip /usr/lib/sendmail.cf ! 3592: The configuration file, ! 3593: in textual form. ! 3594: .ip /usr/lib/sendmail.fc ! 3595: The configuration file ! 3596: represented as a memory image. ! 3597: .ip /usr/lib/sendmail.hf ! 3598: The SMTP help file. ! 3599: .ip /usr/lib/sendmail.st ! 3600: A statistics file; need not be present. ! 3601: .ip /usr/lib/aliases ! 3602: The textual version of the alias file. ! 3603: .ip /usr/lib/aliases.{pag,dir} ! 3604: The alias file in ! 3605: .i dbm \|(3) ! 3606: format. ! 3607: .ip /etc/syslog ! 3608: The program to do logging. ! 3609: .ip /etc/syslog.conf ! 3610: The configuration file for syslog. ! 3611: .ip /etc/syslog.pid ! 3612: Contains the process id of the currently running syslog. ! 3613: .ip /usr/spool/mqueue ! 3614: The directory in which the mail queue ! 3615: and temporary files reside. ! 3616: .ip /usr/spool/mqueue/qf* ! 3617: Control (queue) files for messages. ! 3618: .ip /usr/spool/mqueue/df* ! 3619: Data files. ! 3620: .ip /usr/spool/mqueue/lf* ! 3621: Lock files ! 3622: .ip /usr/spool/mqueue/tf* ! 3623: Temporary versions of the qf files, ! 3624: used during queue file rebuild. ! 3625: .ip /usr/spool/mqueue/nf* ! 3626: A file used when creating a unique id. ! 3627: .ip /usr/spool/mqueue/xf* ! 3628: A transcript of the current session. ! 3629: .ro ! 3630: .ls 1 ! 3631: .tp ! 3632: .sp 2i ! 3633: .in 0 ! 3634: .ce 100 ! 3635: .sz 24 ! 3636: .b SENDMAIL ! 3637: .sz 14 ! 3638: .sp ! 3639: INSTALLATION AND OPERATION GUIDE ! 3640: .sp ! 3641: .sz 10 ! 3642: Eric Allman ! 3643: Britton-Lee, Inc. ! 3644: .sp ! 3645: Version 4.2 ! 3646: .ce 0 ! 3647: .bp 1 ! 3648: .ce ! 3649: .sz 12 ! 3650: TABLE OF CONTENTS ! 3651: .sz 10 ! 3652: .sp 2 ! 3653: .\" remove some things to avoid "out of temp file space" problem ! 3654: .rm sh ! 3655: .rm (x ! 3656: .rm )x ! 3657: .rm ip ! 3658: .rm pp ! 3659: .rm lp ! 3660: .rm he ! 3661: .rm fo ! 3662: .rm eh ! 3663: .rm oh ! 3664: .rm ef ! 3665: .rm of ! 3666: .xp
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.