AIX/HP-UX Interoperability Guide (continued)
[Last Chapter: 12. NFS]


13. Mail

13.1 AIX

AIX user agents are mail, mailx, and Mail, all of which are the same program since these are all hard links to the same executable. This program most closely resembles the mailx program found on HP-UX systems. Another user agent, mhmail, just composes, sends, and files messages. The default routing agent is the sendmail program, and the default delivery agents are /usr/bin/bellmail (for local users), Basic Networking Utilities (BNU, a version of UUCP), and SMTP (for TCP/IP).

Customizing the /etc/sendmail.cf file

The default /etc/sendmail.cf file defines configuration for local, TCP/IP, and BNU delivery. This should be enough for most sites, but if you need further customization, do the following:

  1. Edit the /etc/sendmail.cf file. You can use the vi editor or an editor that does not convert tabs to characters, or you can use the /usr/lib/edconfig command.
  2. Create the database file, /etc/sendmail.cfDB with the following command:

# sendmail -bz

  • Refresh the sendmail daemon:

    # refresh -s sendmail

    Stopping and Starting the sendmail Daemon

    sendmail by default should start up at bootup. If it doesn't, then uncomment the following line from /etc/rc.tcpip: start /usr/lib/sendmail "$src_running" "-bd -q${qpi}"

    To start the sendmail daemon using the SRC:

    # startsrc -s sendmail -a "-bd -q30m"

    To stop the sendmail daemon using the SRC type the following:

    # stopsrc -s sendmail

    To start the sendmail daemon using the command line:

    # sendmail -bd -q30m

    To stop the sendmail daemon using the KornShell kill command:

    # kill $(cat /etc/sendmail.pid)

    Mail Aliases

    AIX keeps mail aliases in /etc/aliases. In addition to aliases you provide, this file must contain an alias for each of the following:

    To compile the aliases database file type one of the following:

    # sendmail -bi
    # newaliases

    This command creates the following dbm files:

    The Mail Queue

    In AIX the mail queue directory is /var/spool/mqueue. The naming convention for the files in this directory is virtually the same as that for HP-UX:

    A file beginning with is a
    df data file
    qf queue control file
    tf temporary file
    xf transcript file
    nf backup file
    lf lock file

    The sendmail queue processing interval, as in HP-UX, is set with the -q option to the sendmail command.

    To process the mail queue once:

    # sendmail -q

    To process the mail queue every 15 minutes:

    # sendmail -q15m

    To process the mail queue every 30 seconds:

    # sendmail -q30s

    To change the processing interval permanently, edit the following line in /etc/rc.tcpip to the value you desire:

    qpi=30m

    The qpi variable is used as an argument in the next line:

    start /usr/lib/sendmail "$src_running" "-bd -q${qpi}"

    Mail Logging and Statistics

    Mail logging by default goes to the file /var/spool/mqueue/log. This is specified in the /etc/syslog.conf file. If you want to log to a different file just edit /etc/syslog.conf and refresh syslogd:

    # refresh -s syslogd

    AIX supports the mailstats command. For this command to work the /etc/sendmail.st file must exist with permissions 660.

    13.2 HP-UX

    HP-UX user agents are mail, mailx, and elm. mail is the standard AT&T program, whereas mailx is HP-UX's version of BSD's /usr/ucb/mail. The default routing agent is the sendmail program, and the supported delivery agents are /bin/rmail (for local users), UUCP, HP's OpenMail, X.400, and SMTP.

    You have two ways to configure mail. You can:

    1. Use SAM with the supplied sendmail configuration file, which provides basic connectivity appropriate for many installations.
    2. Install and start it manually, as explained in the "Manually Installing sendmail" section of this chapter.

    Using SAM to Install sendmail

    SAM installs the default sendmail configuration file, makes sendmail executable, creates the system-wide mail alias database files from the aliases source file, and invokes the daemon.

    The following steps tell how to use SAM to install sendmail:

    1. Start SAM.
    2. Select the Networking/Communications menu item.
    3. Select Services Enable/Disable.
    4. Select the sendmail menu item.
    5. Select the Enable action.
    6. Select OK. View the help screens if you need additional information.
    7. Exit the Services Enable/Disable screen by selecting Exit from the List menu. At the Networking/Communications screen, select either Previous Level to get to a previous level, or select Exit SAM to exit from SAM.

    Manually Installing sendmail

    When you installed the ARPA Services product, all files and directories needed to use sendmail were installed in the correct directories with the proper permissions except the alias file (/usr/lib/aliases), the sendmail configuration file (/usr/lib/sendmail.cf), and the sendmail executable file (/usr/lib/sendmail).

    To install sendmail, you must do the following:

    1. Install a sendmail configuration file as /usr/lib/sendmail.cf.
    2. Make sendmail executable.
    3. Create system-wide mail aliases.
    4. Invoke the sendmail daemon.

    Installing a Configuration File

    The supplied configuration file, /etc/newconfig/sendmail.cf is appropriate for many installations without modification. In particular, when initially installing sendmail, simply copying the supplied configuration file into place provides basic connectivity and permits you to integrate your system into your mail environment without immediately having to edit the configuration file. In addition, a number of localizations and routing options are provided. Descriptions of these options and detailed editing instructions are provided in the supplied configuration file itself.

    To install the supplied configuration file unmodified, copy the file /etc/newconfig/sendmail.cf to /usr/lib/sendmail.cf. To make any of the supported modifications, copy /etc/newconfig/sendmail.cf to /usr/lib/sendmail.cf and edit /usr/lib/sendmail.cf according to the instructions in the file itself.

    Making sendmail Executable

    To make sendmail executable, as superuser, issue the command:

    # chmod 5555 /usr/lib/sendmail

    sendmail is normally run setuid to root (mode 5555). The default configuration is believed to be safe. However, it is possible to misconfigure sendmail so that it inappropriately promotes the privilege of ordinary users.

    If sendmail does not run setuid to root, this risk is eliminated. Note that this causes sendmail to ignore the "S" mailer flag (not specified in the mailers defined in the default configuration file) and the values of the "u" and "g" configuration options, since it is unable to setuid to these users when executing mailers.

    sendmail can be run non-setuid (mode 1555) if the following changes to the default configuration are made:

    1. The queue directory (by default /usr/spool/mqueue) must be writeable by all (mode 0777).
    2. The alias database (by default /usr/lib/aliases.dir and /usr/lib/aliases.pag) must be writeable by all (mode 0666). If these files do not already exist, the superuser must first create them and then chmod them:

      # /usr/lib/sendmail -bi
      # chmod 666 /usr/lib/aliases.dir /usr/lib/aliases.pag

    Making these changes creates some security risk. Anyone will be able to delete mail from the mail queue. However, no one will be able to read other people's mail in the mail queue.

    Creating System-wide Mail Aliases

    The /etc/newconfig aliases file is an example alias file that contains default aliases needed by sendmail. To create system-wide mail aliases, copy /etc/newconfig/aliases to /usr/lib/aliases. You can add any aliases that are appropriate for your system by editing the /usr/lib/aliases file. Once sendmail is executable issue the following command:

    # newaliases

    This creates the alias database files, /usr/lib/aliases.dir and /usr/lib/aliases.pag.

    Invoking the sendmail Daemon

    To start the sendmail daemon, as superuser, issue the following command:

    # /usr/lib/sendmail -bd -q30m

    The -bd mode initializes the sendmail daemon to receive mail from the network. The -q30m flag causes sendmail to process the mail queue every 30 minutes.

    Whenever your system is rebooted, if sendmail is executable, the /etc/netbsdsrc script does the following:

    1. Starts the sendmail daemon to accept SMTP connections from the network and to process the mail queue every 30 minutes.
    2. Logs the restart of the sendmail daemon in the mail log, usually /usr/spool/mqueue/syslog.

    Stopping and Starting the sendmail Daemon

    If the sendmail configuration file or frozen configuration changes, you should kill and restart the sendmail daemon so that it re-reads the configuration file.

    The command

    # /usr/lib/sendmail -bk

    run by the superuser, kills a sendmail daemon started with -bd, whether or not it was started with the -q interval flag. It does not kill a sendmail daemon started only with -q interval. You must kill this type of daemon by finding its process ID and killing it explicitly.

    NOTE: Do not kill sendmail with kill -9. This may cause sendmail to corrupt the alias database. Use kill-15 instead.

    The sendmail frozen configuration file is /usr/lib/sendmail.fc. To freeze the configuration file, issue one of the following commands as superuser:

    # /usr/lib/sendmail -bz
    # /etc/freeze

    Then restart the sendmail daemon:

    # /usr/lib/sendmail -bd -q30m

    To use SAM to refreeze the configuration and kill and restart the sendmail daemon, do the following:

    1. Start SAM.
    2. Select the Networking/Communications menu item.
    3. Select Services Enable/Disable.
    4. Select the sendmail menu item.
    5. Select the Restart action.
    6. Fill in the form according to its instructions or answer the prompt in the window. View the help screens for information about filling in the form.
    7. Exit the Services Enable/Disable screen to a previous level by selecting Exit from the List menu. Then, to exit the Networking/Communications screen, select either Previous Level to exit to a previous level or Exit SAM to exit from SAM.
    8. Select apply to enter additional names of systems to be configured (use apply as a shortcut to remain in the add screen). Then, press OK when you are done with the screen.

    The Mail Queue

    The HP-UX mail queue directory is /usr/spool/mqueue. The naming conventions for the files in this directory are nearly identical to those found in AIX. See AIX "The Mail Queue" for more information on the file name formats.

    The System Log

    sendmail logs its mail messages through the syslogd logging facility. The syslogd configuration on diskless clients should forward all logging that results from sending mail to the cluster root server. The syslogd configuration on cluster servers and standalone systems by default write mail logging to the file /usr/spool/mqueue/syslog. To change this file, edit the /etc/syslog.conf file

    13.3 An Interoperability Exercise: Creating Mail Hubs

    There several ways to create a central mail hub or server. You can use MX records in DNS, you can use the aliases database, or you can configure sendmail.cf. Below are two examples of using sendmail.cf. This example assumes the machines are on the same network, are part of the same DNS domain, and have the same users available.

    Sending AIX Mail to an HP-UX Hub

    Configuring AIX's sendmail.cf file to route to an HP-UX hub is quite simple. Consider the following lines from /etc/sendmail.cf:

    ###################################################################
    #
    # Host name for central mail server  (YOU MAY OPTIONALLY DEFINE THIS)
    #
    # Optionally defined macro specifying name of host to which you want
    # to relay all local mail.  This is used if there is a central mail
    # server that should receive all mail for a given area.
    #
    # When this macro is defined, mail that would otherwise be delivered
    # to "user" on the local machine is delivered to "user@server" on the
    # server machine.  Note that this is similar to what would occur if
    # the mail spool directory were remote-mounted from the mail server.
    # For this reason, this macro can be used to achieve the same effect
    # as remote-mounting the mail spool directory, but without the access
    # and locking problems that can sometimes occur with remotely mounted
    # filesystems.
    #
    #DLMailServerName
    #
    ###################################################################
    
    

    If, for example, your mail hub's hostname was elmo, you would need to create a line that reads:

    DLelmo

    Mail sent to dylan@sadie, for example, would be directed to the machine elmo, even if elmo was an HP-UX box, provided of course that sadie's /etc/sendmail.cf file contains the above line and that the user dylan was recognized on both systems. The user dylan would then have to either log on to sadie to get his messages, or the /usr/mail directory on sadie would have to be mounted on /var/spool/mail on elmo. NFS mounts of the respective mail spooling directories on both systems seem to have no problem with permissions as long as they are exported read-write with either root access granted to machines within the domain or with the anonymous userid set to 0.

    Remember that making the above change in /etc/sendmail.cf is not enough: you have to rebuild /etc/sendmail.cfDB and refresh the sendmail daemon.

    Sending HP-UX Mail to an AIX Hub

    This direction is a bit harder to implement. There are several steps involved:

    1. Set the "S" macro. By default it is blank. The line that reads

      DS should have the hub's name appended. For example:

      DSsadie

    2. Comment out the following line:

      R$+<@$+> $#tcp$@$2$:$1<@$2> user@domain

    3. Uncomment the following line:

      R$+<@$+> $#tcp$@$S$:$1<@$2> user@domain to SMTP relay

    4. Comment out the following line:

      R$+ $#local$:$1 name

    5. Add the following rule:

      R$+ $#tcp$A$S$:$1

    6. Uncomment and change the following line:
      From:

      #R$+ $:$1<@$w> add local domain To:

      R$+ $:$1<@$S> add local domain

    Assuming that the above sendmail.cf file belongs to the HP-UX machine called elmo, mail sent to dylan@elmo would be routed to dylan@sadie, an AIX machine. You can export /usr/mail from elmo for NFS mounting to /var/spool/mail on sadie. Again, the export must either grant root access or set the anonymous userid to 0.

    13.4 Summary

    AIX and HP-UX have similar mail agents in mail and mailx, respectively, but there the similarity ends. AIX's mailx is actually a hard link to mail. HP-UX's mail program is the old AT&T version and is not found in AIX. elm is packaged with HP-UX but not AIX.

    Each of the two system's sendmail files look and feel much the same, though their locations are different. Below lists the major files and their locations.
    AIX HP-UX
    /etc/sendmailsendmail /usr/lib/sendmailsendmail
    /etc/sendmail.cf /usr/lib/sendmail.cf
    /etc/aliases /usr/lib/aliases
    /etc/aliasesDB/DB.dir /usr/lib/aliases.dir
    /etc/aliasesDB/DB.pag /usr/lib/aliases.pag
    /etc/sendmail.cfDB /usr/lib/sendmail.fc
    /var/spool/mail /usr/mail
    /var/spool/mqueue /usr/spool/mqueue
    /usr/share/lib/Mail.rc /usr/lib/mailx/mailx.rc
    /usr/sbin/mailq /usr/bin/mailq
    /usr/sbin/mailstats /usr/bin/mailstats
    /etc/sendmailsendmail.st /usr/lib/sendmailsendmail.st


    [Next Chapter: 14. X11]


    Provide feedback to: alan_roberts@hp.com

    [Table of Contents] [Outline] [Index] (Updated 09 MAR 97)
    Copyright 1996 Hewlett-Packard Company. All rights reserved.