HPlogo Installing and Administering Internet Services: HP 9000 Networking > Chapter 2 Installing and Configuring Internet Services

Installing sendmail

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

When you install sendmail, the installation script creates and modifies files on the system that are needed for sendmail operation. The sendmail configuration file supplied with HP-UX 11.0 will work without modifications for most installations. Therefore, the only steps you must do are: set up sendmail servers to run with NFS, configure and start sendmail clients, and verify that sendmail is running properly.

This section contains information about the following tasks:

NOTE: HP recommends that you use sendmail with the BIND name server. The BIND name server should have an MX record for every host in the domain(s) that it serves. For more information on how sendmail uses MX records, see Chapter 4 “Installing and Administering sendmail”.

Installing sendmail on a Standalone System

When sendmail is installed, it is automatically configured to send and receive mail for users on the local system only. The standalone system processes all outbound mail and establishes connections to the message destination host or to Mail Exchanger (MX) hosts (see Chapter 4 “Installing and Administering sendmail” for more information). The sendmail daemon is then started when you reboot the system, so you do not need to make any changes to any system files.

The sendmail installation script makes the following configuration changes:

  • Sets the SENDMAIL_SERVER variable in the /etc/rc.config.d/mailservs file to 1. This ensures that the sendmail daemon is started whenever you reboot your system or run the sendmail startup script.

  • Creates /etc/mail/sendmail.cf and /etc/mail/aliases files with default configurations. These files are created with root as the owner, other as the group, and permissions set to 0444.

    NOTE: If an /etc/mail/sendmail.cf file already exists, the existing file is saved to /etc/mail/#sendmail. If an /etc/mail/aliases file already exists, then the sendmail installation script does not create it.
  • Creates the file /etc/mail/sendmail.cw that contains the hostname and the fully-qualified hostname for the system. For example, the system dog in the domain cup.hp.com has the following entries in the file:

    dog
    dog.cup.hp.com

  • Finally, the installation script issues the following command to run the sendmail startup script:

    /sbin/init.d/sendmail start

    The sendmail startup script generates the aliases database from the /etc/mail/aliases source file. The generated database is located in the file /etc/mail/aliases.db.

    The sendmail startup script then starts the sendmail daemon by issuing the following command:

    /usr/sbin/sendmail  -bd  -q30m

    The -q30m option tells sendmail to process the mail queue every 30 minutes.

    For more information about sendmail command line options, type man 1M sendmail at the HP-UX prompt.

Installing sendmail on a Mail Server

This section describes how to configure a system to allow users on other (client) systems to use sendmail. The mail server receives mail for local users and for the users on client systems. Users on client systems then NFS mount the mail directory from the server and read mail over an NFS link. For more information on how sendmail clients and servers work, see “Default Client-Server Operation”.

The sendmail installation script performs the configuration changes that are described in “Installing sendmail on a Standalone System”. To set the system up as an NFS server and allow the sendmail clients to read and write to the /var/mail directory, do the following:

  1. Make sure all mail users have accounts on the mail server and that their user IDs and group IDs on the mail server are the same as on the client machines. (This step is not necessary if you are using NIS or NIS+ and your mail server is in the same NIS or NIS+ domain as the clients.)

  2. In the /etc/rc.config.d/nfsconf file, use a text editor to set the NFS_SERVER variable to 1.

  3. Use a text editor to add the following line to the /etc/exports file:

    /var/mail  -access=client,client...

    where each mail client is listed in the access list. If the /etc/exports file does not exist, you will have to create it.

  4. Issue the following command to run the NFS startup script:

    /sbin/init.d/nfs.server  start

For more information on NFS, see Installing and Administering NFS Services.

Installing sendmail on a Mail Client

sendmail clients do not receive mail on their local system; instead, users on the client systems obtain their mail on the mail server. User mail directories reside on the server, and users read their mail over an NFS link. By default, a sendmail client forwards to the server any local mail (a user address destined for the client system) and sends non-local mail directly to the destination system or MX host. Outgoing mail appears to originate from the server, so replies are sent to the server. For more information on how sendmail clients and servers work, see Chapter 4 “Installing and Administering sendmail”. sendmail clients can be diskless systems.

To configure a sendmail client system to access a sendmail server:

  1. In the /etc/rc.config.d/mailservs file, use a text editor to set the SENDMAIL_SERVER variable to 0. This ensures that the sendmail daemon will not be started when you reboot your system or run the sendmail startup script.

  2. In the /etc/rc.config.d/mailservs file, use a text editor to set the SENDMAIL_SERVER_NAME variable to the host name or IP address of the mail server you will use (the machine that will run the sendmail daemon).

  3. In the /etc/rc.config.d/nfsconf file, use a text editor to set the NFS_CLIENT variable to 1.

  4. Use a text editor to add the following line to the /etc/fstab file:

    servername:/var/mail  /var/mail  nfs  0  0

    where servername is the name configured in the SENDMAIL_SERVER_NAME variable in /etc/rc.config.d/mailservs. If the /etc/fstab file does not exist, you will have to create it.

  5. Issue the following command to run the sendmail startup script:

    /sbin/init.d/sendmail start

  6. Issue the following command to run the NFS startup script:

    /sbin/init.d/nfs.client start

The sendmail startup script assumes that this system will use the host specified by the SENDMAIL_SERVER_NAME variable as the mail hub. The script also assumes that mail sent from this system should appear to be from the host specified by the SENDMAIL_SERVER_NAME variable (this feature may previously have been known as "site hiding"). The script therefore modifies the macros DM (for "masquerade") and DH (for "mail hub") in the system's /etc/mail/sendmail.cf file to use the host specified by the SENDMAIL_SERVER_NAME variable. Note that if the DM and DH macros have previously been defined, the startup script does not modify them.

As mentioned earlier, the client system now forwards local mail to the mail server and forwards other mail directly to remote systems. To configure the client system to relay all mail to the mail server for delivery, see “Modifying the Default sendmail Configuration File”.

The NFS startup script NFS-mounts the /var/mail directory from the mail server to your system. For more information on NFS, see Installing and Administering NFS Services.

Verifying Your sendmail Installation

You can verify that sendmail has been installed properly and is working properly by doing the things described in the following sections:

Mailing to a Local User

To check your local mailer or user agent, mail a message to a local user (for example, joe) on your system:

date  |  mailx  -s  "Local sendmail Test"  joe

This should result in a message similar to the following being sent to user joe:

From joe Wed Aug 6 09:18 MDT 1986
Received: by node2; Wed, 6 Aug 86 09:18:53 mdt
Date: Wed, 6 Aug 86 09:18:53 mdt
From: Joe User <joe>
Return-Path: <joe>
To: joe
Subject: Local sendmail Test

Wed Aug 6 09:18:49 MDT 1986

An entry in your /var/adm/syslog/mail.log file should have been logged for the local message transaction. See “Configuring and Reading the sendmail Log” for more information.

Mailing to a Remote User with UUCP Addressing

For this test, mail a message to a remote user with the UUCP transport by using a host !user address, where host is a system to which your local host has a direct UUCP connection. (The uuname command lists the UUCP names of known systems. Type man 1 uuname at the HP-UX prompt for more information.)

To verify both inbound and outbound UUCP connections, mail the message in a loop, using the syntax remote_host !my_host !user. For example, if you try

date | mailx -s "UUCP Test" node1!node2!joe

and node2 is your local host, you should receive a message similar to this:

From node1!node2!joe Wed Aug  6 09:48 MDT 1986
Received: by node2; Wed, 6 Aug 86 09:48:09 mdt
Return-Path: <node1!node2!joe>
Received: from node1.UUCP; Wed, 6 Aug 86 09:30:16
Received: by node1; Wed, 6 Aug 86 09:30:16 mdt
Received: from node2.UUCP; Wed, 6 Aug 86 09:26:18
Received: by node2; Wed, 6 Aug 86 09:26:18 mdt
Date: Wed, 6 Aug 86 09:26:18 mdt
From: Joe User <node1!node2!joe>
To: node1!node2!joe
Subject: UUCP Test

Wed Aug 6 09:26:15 MDT 1986

An entry in your /var/adm/syslog/mail.log file should have been logged for the UUCP mail transaction. See “Configuring and Reading the sendmail Log” for more information.

NOTE: In this example, if you mail to yourself, and if the local system is running sendmail, be sure the configuration file on the local system has set the m option (for a pre-version 6 configuration file) or the MeToo option (for a version 6 configuration file). The local system's configuration file should contain a line beginning with Om or O MeToo. If such a line is not in the local host's configuration file, sendmail on the local host notices that the sender is the same as the recipient and your address is removed from the recipient list.

Mailing to a Remote User with the SMTP Transport

For this test, mail a message to a remote user with the SMTP transport using a user @host address, where host is a system that provides an SMTP server (for example, the sendmail daemon).

To verify both inbound and outbound SMTP connections, mail the message in a loop, using the syntax user %my_host @remote_host. For example, if you try

date | mailx -s "Round Robin SMTP" joe%node2@node1

you should receive a message similar to the following:

From joe@node2 Wed Aug  6 14:22 MDT 1986
Received: from node1 by node2; Wed, 6 Aug 86 14:22:56 mdt
Return-Path: <joe@node2>
Received: from node2 by node1; Wed, 6 Aug 86 14:25:04 mdt
Received: by node2; Wed, 6 Aug 86 14:22:31 mdt
Date: Wed, 6 Aug 86 14:22:31 mdt
From: Joe User <joe@node2>
To: joe%node2@node1
Subject: Round Robin SMTP

Wed Aug 6 14:22:28 MDT 1986

An entry in your /var/adm/syslog/mail.log file should have been logged for the SMTP mail transaction. See “Configuring and Reading the sendmail Log” for more information.

NOTE: In this example, if you mail to yourself, and if the remote system is running sendmail, be sure the configuration file on the remote system has set the m option (for a pre-version 6 configuration file) or the MeToo option (for a version 6 configuration file). The remote system's configuration file should contain a line beginning with Om or O MeToo. If such a line is not in the remote host's configuration file, sendmail on the remote host notices that the sender is the same as the recipient and your address is removed from the recipient list.
© 2000 Hewlett-Packard Development Company, L.P.