Annotation of researchv10no/lbin/mailx/docs/admin, revision 1.1.1.1

1.1       root        1: .if n .pH aguide2.mail %W%
                      2: .Bk "System Administrator's Guide"
                      3: .CH "Mail Subsystem Administration" F
                      4: .H 1 "Administering the Mail Subsystem"
                      5: .IX istart \f4mail\f1, administration
                      6: The purpose of this appendix is to aid the System Administrator in taking
                      7: advantage of various options within the mail subsystem.
                      8: By default, the mail subsystem provides electronic communications between
                      9: users on the same machine, or between machines connected together on a UUCP
                     10: network, and
                     11: supports two addressing schemes, known as ``bang'' style and ``domain''
                     12: style.
                     13: .IX \f4mail\f1, bang addressing
                     14: .IX \f4mail\f1, domain addressing
                     15: The System Administrator does not need to do anything for mail to work in
                     16: the default manner.
                     17: .P
                     18: .IX \f4mail\f1, smart host
                     19: This appendix will provide information on
                     20: setting up a smarter host,
                     21: establishing a domain name,
                     22: administering a set of sites so that they all send mail with the same machine
                     23: name,
                     24: .IX \f4mail\f1, machine cluster
                     25: .IX \f4mail\f1, gateway machine
                     26: setting up the mail directory to be shared across a networked file
                     27: system, such as RFS and NFS,
                     28: .IX \f4mail\f1, LAN
                     29: .IX \f4mail\f1, RFS
                     30: .IX \f4mail\f1, NFS
                     31: filling in alias information,
                     32: .IX \f4mail\f1, alias lists
                     33: and
                     34: setting up a connection to another site that uses the
                     35: .IX \f4mail\f1, SMTP (Simple Mail Transfer Protocol)
                     36: .IX SMTP (see \f4mail\f1)
                     37: .IX Simple Mail Transfer Protocol (see \f4mail\f1)
                     38: Simple Mail Transfer Protocol (SMTP).
                     39: .H 2 "Mail Administration Files"
                     40: .IX files, mail
                     41: .IX \f4mail\f1, files
                     42: .IX \f4/usr/lib/mail\f1 files
                     43: .IX \f4/etc/mail\f1 files
                     44: .IX \f4mail\f1, \f4/etc/mail\f1 files
                     45: There are four files that are important to mail administration.
                     46: The surrogate file, \f4/etc/mail/mailsurr\f1,
                     47: .IX \f4mailsurr\f1 mail file
                     48: is described on the \f4mailsurr\f1(4) manual page.
                     49: It describes how to rewrite addresses and how to deliver messages through
                     50: the networks.
                     51: The configuration file, \f4/etc/mail/mailcnfg\f1,
                     52: .IX \f4mailcnfg\f1 mail file
                     53: is described on \f4mailcnfg\f1(4).
                     54: It permits various per-site options to be established.
                     55: For more information on the \f4mailsurr\f1 and \f4mailcnfg\f1 manual pages,
                     56: see the \f2System Administrator's Reference Manual\f1.
                     57: The master alias path file, \f4/etc/mail/namefiles\f1, points
                     58: .IX \f4namefiles\f1 mail file
                     59: to one alias file, \f4/etc/mail/names\f1.
                     60: Both are described on
                     61: \f4mailalias\f1(1).
                     62: .IX \f4names\f1 mail file
                     63: These two files are used to define name mappings and address lists.
                     64: For more information on the \f4mailalias\f1 manual page, see
                     65: the \f2User's Reference Manual\f1.
                     66: .H 3 "Mail Addressing Styles"
                     67: .IX \f4mail\f1, address style translation
                     68: .IX address style translation (see \f4mail\f1)
                     69: The default surrogate file contains entries to translate between domain
                     70: style addresses and bang style addresses.
                     71: Bang style addressing is
                     72: characterized by exclamation points (a.k.a. bangs) within the
                     73: address and looks like \f2host\f4!\f2user\f1
                     74: or \f2host1\f4!\f2host2\f4!\f2user\f1.
                     75: Domain style addressing is characterized by the commercial
                     76: at sign (\f4@\f1) and looks like \f2user\f4@\f2host\f4.\f2domain\f1
                     77: or \f2user\f4@\f2host\f1.
                     78: .H 2 "Establishing a Smarter Host"
                     79: Although it is possible to maintain the data files for the UUCP
                     80: network so that the system knows about hundreds or thousands of other
                     81: systems that can be contacted, it is impractical to do so.
                     82: It is often much easier to set up what is known as a ``smarter host,'' that is,
                     83: another UNIX system to which remote mail will be shipped if the
                     84: local machine doesn't know about the system to which the mail is being sent.
                     85: For example, assume you need to send a mail message to \f4hosta!tony\f1,
                     86: but your local machine does not know about \f4hosta\f1.
                     87: The mail message can be automatically routed to the machine
                     88: \f4worldly\f1, which has a more extensive list of UUCP connections.
                     89: .P
                     90: This is done in two steps:
                     91: .AL
                     92: .LI
                     93: Add a line to mailcnfg that says
                     94: .DS I UI
                     95: SMARTERHOST=\f2smhost\fP
                     96: .DE
                     97: where \f2smhost\f1 is replaced with the name of the smarter system (\f4worldly).
                     98: .LI
                     99: Remove the \f4#\f1 character from the line within
                    100: \f4mailsurr\f1 that looks like this:
                    101: .DS I UI
                    102: #'.+'  '.*[!@].*'      'Translate R=%X!%n'
                    103: .DE
                    104: .LE
                    105: .H 2 "Establishing Domain Addresses"
                    106: .IX istart \f4mail\f1, domain addressing
                    107: As distributed, mail knows about two forms of domain style addresses:
                    108: .DS I
                    109: \f2user\f4@\f2host\f1
                    110: .DE
                    111: and
                    112: .DS I
                    113: \f2user\f4@\f2host\f4.UUCP\f1
                    114: .DE
                    115: It does not know about
                    116: .DS I
                    117: \f2user\f4@\f2host\f4.\f2domain\f1
                    118: .DE
                    119: A domain name is an internationally recognized and registered name for a
                    120: set of machines.
                    121: Commercial entities may be registered under domain names similar to
                    122: \&\f4.\f2company-name\f4.COM\f1 and educational entities may be registered
                    123: under domain names similar to \(CW.\f2school\f4.EDU\f1.
                    124: (Note that \f4.UUCP\f1 is not a true domain name.
                    125: The high-level domain names of \f4.COM\f1 and \f4.EDU\f1 are assigned
                    126: by a central authority.)
                    127: A system will generally know how to establish direct connections to
                    128: other machines within the local domain, 
                    129: but will want to make use of a smarter host to take care of other domains.
                    130: .P
                    131: To establish the local domain name, complete this step:
                    132: .AL
                    133: .LI
                    134: Type the command
                    135: .DS I UI
                    136: /usr/sbin/domainname \f2domain\fP
                    137: .DE
                    138: where \f2domain\f1 is replaced with the domain name, such as
                    139: \&\f4.\f2company-name\f4.COM\f1 or whatever is appropriate, and contains
                    140: the leading period.
                    141: (Any periods present within the domain name will be converted to 
                    142: \f4\e.\f1 before being passed to the regular expressions in the surrogate
                    143: file.)
                    144: .LE
                    145: The domain name will also be used by the SMTP router when rewriting
                    146: header files into RFC822 format (see ``Administering SMTP'' below).
                    147: .IX iend \f4mail\f1, domain addressing
                    148: .H 2 "Establishing a Mail Cluster or Gateway"
                    149: .IX istart \f4mail\f1, machine cluster
                    150: .IX istart \f4mail\f1, gateway machine
                    151: With the arrival of inexpensive personal computers, it is often desirable
                    152: to assign a single name to a set (or a cluster) of machines by which all the
                    153: machines in the cluster will be known to external machines, for purposes of
                    154: mail.
                    155: For example, a cluster of machines known internally under names such as
                    156: \f4Xsysa\f1, \f4Xsysb\f1 and \f4Xsysc\f1, could be assigned the cluster name
                    157: of \f4Xsys\f1.
                    158: Mail sent from any of these machines would be shown as being from \f4Xsys\f1;
                    159: that is, the internal names would not be known outside the cluster.
                    160: .P
                    161: To establish a cluster name, add a line to the \f4mailcnfg\f1 that says:
                    162: .DS I UI
                    163: CLUSTER=\f2extname\fP
                    164: .DE
                    165: where \f2extname\f1 is the name by which the machine is known
                    166: externally (\f4Xsys\f1).
                    167: .IX iend \f4mail\f1, machine cluster
                    168: .IX iend \f4mail\f1, gateway machine
                    169: .H 2 "Establishing Mail Service on a Networked File System (RFS or NFS)"
                    170: .IX istart \f4mail\f1, LAN
                    171: .IX istart \f4mail\f1, RFS
                    172: .IX istart \f4mail\f1, NFS
                    173: With the arrival of inexpensive Local Area Networking (LAN) and networked file
                    174: systems such as RFS and NFS, clusters of machines 
                    175: that share many file systems can be set up.
                    176: It is also possible to share \f4/var/mail\f1 across the machines.
                    177: .IX \f4/var/mail\f1
                    178: .IX files, mail
                    179: .IX \f4mail\f1, files
                    180: In this case, you can arrange to have all user's mail boxes created on only
                    181: one machine, but accessible from all machines.
                    182: .P
                    183: As an example, assume that you want the machines \f4Xsysa\f1, \f4Xsysb\f1 and
                    184: \f4Xsysc\f1 to share the mail directory under \f4Xsysa\f1.
                    185: In addition, the entire file system for each system is mounted under the names
                    186: \f4/Xsysa\f1, \f4/Xsysb\f1 and \f4/Xsysc\f1.
                    187: All users have home directories under file systems named \f4/homea\f1,
                    188: \f4/homeb\f1 and \f4/\f1homec, which are mounted on
                    189: the corresponding machines.
                    190: .P
                    191: To establish a shared \f4/var/mail\f1 file system, complete the following
                    192: steps:
                    193: .AL
                    194: .LI
                    195: Make certain that \f4/var/mail\f1 from \f4Xsysa\f1 is advertised.
                    196: .LI
                    197: Remove the directory \f4/var/mail/:saved\f1 from the systems that
                    198: will not have a local \f4/var/mail\f1 (\f4Xsysb\f1 and \f4Xsysc\f1).
                    199: .LI
                    200: Add a line to \f4mailcnfg\f1 that says
                    201: .DS I UI
                    202: FAILSAFE=Xsysa
                    203: .DE
                    204: With this specified, \f4mail\f1 will look for the presence of
                    205: \f4/var/mail/:saved\f1.
                    206: If the directory is not there (indicating that the network connection to
                    207: \f4Xsysa\f1 has been lost), \f4mail\f1 will requeue the file to be delivered to
                    208: \f4Xsysa\f1 via other means (such as UUCP or SMTP).
                    209: .LI
                    210: Move any mailboxes from \f4/var/mail\f1 on \f4Xsysb\f1 and
                    211: \f4Xsysc\f1 to \f4Xsysa\f1 (otherwise the files will be inaccessible).
                    212: .LI
                    213: Mount \f4/var/mail\f1 from \f4Xsysa\f1.
                    214: .LI
                    215: In order for the \f4notify\f1 program to identify where the
                    216: user is logged in (so that it can notify the user when new mail arrives),
                    217: create a file on all machines named \f4/etc/mail/notify.sys\f1
                    218: with contents similar to the following:
                    219: .SS
                    220: Xsysa  /Xsysa
                    221: Xsysb  /Xsysb
                    222: Xsysc  /Xsysc
                    223: .SE
                    224: The first column lists the name of the system and the second gives a pathname
                    225: of the \f4root\f1 filesystem for each machine.
                    226: .LI
                    227: In order for the \f4notify\f1 program to handle a network failure,
                    228: create a file on all machines named \f4/etc/mail/notify.fsys\f1
                    229: with contents similar to the following:
                    230: .SS
                    231: /homea Xsysa
                    232: /homeb Xsysb
                    233: /homec Xsysc
                    234: .SE
                    235: The first column lists a file system name and the second column contains the
                    236: system (machine name) on which that file system is normally mounted.
                    237: If \f4notify\f1 cannot open the mail file for writing, it will look up the
                    238: file system in this list and requeue the file to be delivered to the
                    239: corresponding system via other means (such as UUCP or SMTP).
                    240: .LE
                    241: .IX iend \f4mail\f1, LAN
                    242: .IX iend \f4mail\f1, RFS
                    243: .IX iend \f4mail\f1, NFS
                    244: .H 2 "Administering \f4alias\fP Lists"
                    245: .IX istart \f4mail\f1, alias lists
                    246: .IX istart alias lists, \f4mail\f1
                    247: Before delivering a local mail message, \f4mail\f1 will look up the user name to
                    248: see if it has been aliased to another name or list of names.
                    249: The master alias path file \f4/etc/mail/namefiles\f1 contains a list of
                    250: files that \f4mail\f1 will search for aliases.
                    251: As distributed, this list contains only one file,
                    252: \f4/etc/mail/names\f1, to be searched for aliases.
                    253: If the named alias is found at the beginning of a line within an alias file,
                    254: the rest of that line will be used as the alias.
                    255: This may contain a single name, or a list of names separated by whitespace.
                    256: For example, if you want to set up a group mailing list (e.g., \f4andy.group\f1)
                    257: that will be expanded, add a line similar to the following to the alias file:
                    258: .DS I UI
                    259: andy.group tony paul john ned gary hailey mike
                    260: .DE
                    261: Recursive references are permitted, as in this reference to
                    262: \f4andy.group\f1 within another alias:
                    263: .DS I UI
                    264: armida.dept andy.group danielle.group bob.group \e
                    265:        lee.group pier.group
                    266: .DE
                    267: Several alias files can be listed in \f4namefiles\f1, which may be kept
                    268: anywhere on the machine.
                    269: This permits different alias files to be owned by different administrators.
                    270: .IX iend \f4mail\f1, alias lists
                    271: .IX iend alias lists, \f4mail\f1
                    272: .H 2 "Other Tricks of the \f4surrogate\fP File Trade"
                    273: .H 3 "Logging Mail"
                    274: .IX \f4mail\f1, logging
                    275: .IX logging mail
                    276: Occasionally it may be necessary to keep a log of traffic going through the
                    277: system.
                    278: For example, if you were to write a program \f4/usr/lib/mail/surrcmd/logmail\fP
                    279: that takes three arguments (a log file name, the sender and recipient), it
                    280: could log all external mail flowing through the system by using this
                    281: surrogate entry:
                    282: .SS
                    283: \&'.+!.+' '.*' '> /usr/lib/mail/surrcmd/logmail /var/adm/mailtransport %R %n'
                    284: .SE
                    285: Another example would be to log traffic to or from
                    286: a particular system (here to \f5xyz\f1 and from \f5abc\f1):
                    287: .SS
                    288: \&'.*' 'xyz!.+' '> /usr/lib/mail/surrcmd/logmail /var/adm/mailto-xyz %R %n'
                    289: \&'abc!.+' '.*' '> /usr/lib/mail/surrcmd/logmail /var/adm/mailfrom-abc %R %n'
                    290: .SE
                    291: .H 3 "Path Translation"
                    292: .IX PATH Translation
                    293: .IX translate, PATH
                    294: Many systems have a path translation program available that will give the
                    295: shortest route to a given system, based on various criteria or a database.
                    296: An example of this is the public domain smail program.
                    297: As an alternative to using a smarter host, the autorouter can be invoked as
                    298: a final step in the mailsurr file:
                    299: .SS
                    300: \&'.+' '.*[!@].*'              'Translate R=|smail -A %n'
                    301: .SE
                    302: .H 3 "Controlling Mail Resource Access"
                    303: .IX Deny, mail access
                    304: .IX \f4mail\f1, controlling access
                    305: It is often necessary to control access to commercial services, such as AT&T
                    306: Mail.
                    307: One method of doing this is to prevent any non-local users from sending mail
                    308: to the commercial site using the Accept and Deny commands:
                    309: .SS
                    310: \&'[^!]+' 'attmail!.+' 'Accept'
                    311: \&'.+'    'attmail!.+' 'Deny'
                    312: .SE
                    313: Another method is to use an external program to check the sender's path to
                    314: see if it is a valid user of the service.
                    315: For example, this shell script returns 0 if the sender is a valid system,
                    316: and 1 otherwise:
                    317: .SS
                    318: case "$1" in
                    319:     abc | def | ghi ) exit 0 ;;
                    320:     * ) echo "$1 is not permitted to send mail to external service"
                    321:        exit 1 ;;
                    322: esac
                    323: .SE
                    324: If the script were installed as /usr/lib/mail/surrcmd/chksender,
                    325: it would be invoked as a delivery agent which will either continue or fail:
                    326: .SS
                    327: # check senders more than one hop away
                    328: \&'.+!(.+)![^!]+' 'attmail!.+' '< C=0;F=*; /usr/lib/mail/surrcmd/chksender \e\e1'
                    329: # check senders one hop away
                    330: \&'(.+)![^!]+'    'attmail!.+' '< C=0;F=*; /usr/lib/mail/surrcmd/chksender \e\e1'
                    331: .SE
                    332: .H 2 "Administering SMTP"
                    333: .IX istart \f4mail\f1, SMTP (Simple Mail Transfer Protocol)
                    334: .IX SMTP (see \f4mail\f1)
                    335: .IX Simple Mail Transfer Protocol (see \f4mail\f1)
                    336: .IX TCP/IP
                    337: The Simple Mail Transfer Protocol
                    338: (SMTP) mail subsystem is delivered as a group of programs that
                    339: allow UNIX System mail to send and receive mail using the SMTP protocol.
                    340: This protocol is typically used over TCP/IP networks.
                    341: However, as delivered, the SMTP processes can connect over any
                    342: TLI-based, connection-oriented, transport that has been administered
                    343: to have an SMTP service.
                    344: .P
                    345: To establish SMTP service requires these steps:
                    346: .AL
                    347: .LI
                    348: By default, SMTP is installed in the mail surrogate file,
                    349: but it is turned off (commented out).
                    350: It may be turned on by uncommenting the line that says:
                    351: .SS
                    352: #'.+' '([^!@]+)!(.+)' '< /usr/lib/mail/surrcmd/smtpqer %R \e\e1 \e\e2'
                    353: .SE
                    354: To uncomment this line, edit the \f4mailsurr\f1 file to
                    355: remove the \f4#\f1 from the start of each line.
                    356: .P
                    357: Mail is addressed using the standard UNIX system mail
                    358: formats of \f2host\f4!\f2user\f1 or \f2user\f4@\f2host\f1.
                    359: If \f2host\f1 is known to support SMTP mail delivery, the mail
                    360: will be queued for delivery using SMTP.
                    361: If not, \f4smtpqer\f1 will not accept the message, and delivery will be
                    362: done by subsequent surrogates in the \f4mailsurr\f1 file.
                    363: .P
                    364: .IX files, SMTP (see \f4mail\f1)
                    365: All messages that are spooled for SMTP delivery are stored in the directory
                    366: \f4/var/spool/smtpq/\f2host\f1, where \f2host\f1 is the name of the machine
                    367: to which mail is being sent.
                    368: .LI
                    369: The list of machines that will accept SMTP mail is specified by the
                    370: \f4netdird\f1 service.
                    371: See \f4netdird\f1(1M) in the \f2System Administrator's Reference Manual\f1
                    372: to see how to add services to this database.
                    373: By default, the SMTP daemon \f4smtpd\f1 will always start when
                    374: your system is booted.
                    375: If \f4smtpd\f1 finds that there are no networks installed for which the
                    376: SMTP service is defined, it will exit.
                    377: .P
                    378: When the daemon \f4smtpd\f1 receives a piece of mail, it does three things:
                    379: 1) it inserts a valid UNIX System mail ``\f4From \f1''
                    380: header line;
                    381: 2) it converts the recipient address to \f2host\f4!\f2user\f1 form; and,
                    382: 3) hands the message to \f4rmail\f1 for delivery.
                    383: .LI
                    384: The following entry must be uncommented from \f4root\f1's \f4crontab\f1 file
                    385: [see \f4crontab\f1(1) for an explanation of this file]:
                    386: .SS
                    387: 25 * * * * /usr/lib/mail/surrcmd/smtpsched
                    388: 55 1 * * * /usr/lib/mail/surrcmd/smtpsched -c -w 1 -r 7
                    389: .SE
                    390: To do this, execute the following commands as root:
                    391: .SS
                    392: # crontab -l > /tmp/cron.temp
                    393: # ed /tmp/cron.temp
                    394: g!/smtpsched!s/^#//
                    395: w
                    396: q
                    397: # crontab /tmp/cron.temp
                    398: # rm /tmp/cron.temp
                    399: #
                    400: .SE
                    401: .P
                    402: By default, mail that cannot be delivered immediately (as
                    403: it is sent), is queued and retried at one hour intervals by \f4smtpsched\f1.
                    404: You can change the interval by modifying the
                    405: entry for \f4smtpsched\f1 in \f4root\f1's \f4cron\f1 file.
                    406: .IX \f4smtpsched\f1(1M)
                    407: .LE
                    408: .P
                    409: .IX logs, SMTP (see \f4mail\f1)
                    410: SMTP logs all SMTP activity, including
                    411: incoming mail messages, in the log file \f4/var/spool/smtpq/LOG\f1.
                    412: .IX \f4/var/spool/smtpq/LOG\f1
                    413: It is backed up once per day by \f4smtpsched\f1; previous days' log files are
                    414: located in \f4/var/spool/smtpq/LOG.\f2n\f1, where \f2n\f1 is the day
                    415: of the week (from 0 to 6).
                    416: The \f4smtpsched\f1 program will also return undeliverable mail messages.
                    417: For more information on \f4smtpsched\f1(1M)
                    418: see the \f2System Administrator's Reference Manual\f1.
                    419: .H 3 "Setting Up SMTP to Listen Over Multiple Networks"
                    420: \f4smtpd\f1 will listen to any connection-oriented TLI network
                    421: that provides the SMTP service.
                    422: TLI networks are specified in \f4/etc/netconfig\f1.
                    423: For each network that is
                    424: connection-oriented, \f4smtpd\f1 will use \f4netdir_getbyname\f1(3) to
                    425: determine if the SMTP service exists for that network.
                    426: If the service does exist, a port is opened at the address returned by this
                    427: function.
                    428: To make the listener listen to a new network,
                    429: first administer the \f4netdir\f1 databases, and then restart the listener.
                    430: .IX iend \f4mail\f1, SMTP (Simple Mail Transfer Protocol)
                    431: .IX iend \f4mail\f1, administration

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.