Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
25.  Mail Services (Tasks) Setting Up Mail Services (Tasks) How to Set Up a Mail Gateway  Previous   Contents   Next 
   
 

How to Use DNS With sendmail

The DNS name service does not support aliases for individuals. This name service does support aliases for hosts or domains that use Mail Exchange (MX) records and cname records. You can specify host names, domain names, or both names in the DNS database. For more information about sendmail and DNS, see "Interactions of sendmail With Name Services" in Chapter 26, Mail Services (Reference), or see the System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP).

  1. Become superuser or assume an equivalent role.

    For information about roles, refer to "Using Privileged Applications" in System Administration Guide: Security Services.

  2. Enable DNS host lookups (NIS+ only).

    Edit the /etc/nsswitch.conf file and remove the # from the hosts definition that includes the dns flag. The host entry must include the dns flag, as the following example shows, in order for the DNS host aliases to be used.

    # grep hosts /etc/nsswitch.conf
    #hosts:     nisplus [NOTFOUND=return] files
    hosts:      nisplus dns [NOTFOUND=return] files
  3. Check for a mailhost and mailhost.domain entry.

    Use nslookup to ensure that an entry exists for mailhost and mailhost.domain in the DNS database. For more information, refer to the nslookup(1M) man page.

How to Set Up a Virtual Host

If you need to assign more than one IP address to a host, see this Web site: http://www.sendmail.org/virtual-hosting.html. This site provides complete instructions on how to use sendmail to set up a virtual host. However, in the "Sendmail Configuration" section, do not perform step 3b, as shown in the following.

# cd sendmail-VERSION/cf/cf
# ./Build mailserver.cf
# cp mailserver.cf /etc/mail/sendmail.cf

Instead, for the Solaris operating environment, perform the following steps.

# cd /usr/lib/mail/cf
# /usr/ccs/bin/make mailserver.cf
# cp mailserver.cf /etc/mail/sendmail.cf

mailserver

Use the name of the .cf file.

"Building the sendmail.cf Configuration File (Task)" outlines these same three steps as part of the build process.

After you have generated your /etc/mail/sendmail.cf file, you can continue with the next steps to create a virtual user table, and so forth.

Building the sendmail.cf Configuration File (Task)

"How to Build a New sendmail.cf File" shows you how to build the configuration file. Although you can still use older versions of sendmail.cf files, the best practice is to use the new format.

For more details, you should read from the following resources.

The following sections in Chapter 27, What's New With Mail Services (Reference) identify new m4 configuration features.

How to Build a New sendmail.cf File

The following procedure shows you how to build a new configuration file.


Note - /usr/lib/mail/cf/main-v7sun.mc is now /usr/lib/mail/cf/main.mc.


  1. Become superuser or assume an equivalent role.

    For information about roles, refer to "Using Privileged Applications" in System Administration Guide: Security Services.

  2. Stop sendmail.

    # /etc/init.d/sendmail stop
  3. Make a copy of the configuration files that you are changing.

    # cd /usr/lib/mail/cf
    # cp main.mc myhost.mc

    myhost

    Select a new name for your .mc file.

  4. Edit the new configuration files (for example, myhost.mc), as necessary.

    For example, add the following command line to enable domain masquerading.

    # cat myhost.mc
    ..
    MASQUERADE_AS(`host.domain')

    host.domain

    Use the desired host name and domain name.

    In this example, MASQUERADE_AS causes mail that is sent to be labeled as originating from host.domain, rather than $j.

  5. Build the configuration file by using m4.

    # /usr/ccs/bin/make myhost.cf
  6. Test the new configuration file by using the -C option to specify the new file.

    # /usr/lib/sendmail -C myhost.cf -v testaddr </dev/null

    This command sends a message to testaddr while displaying messages as it runs. Only outgoing mail can be tested without restarting the sendmail service on the system. For systems that are not handling mail yet, use the full testing procedure in "How to Test the Mail Configuration".

  7. Install the new configuration file after making a copy of the original.

    # cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.save
    # cp myhost.cf /etc/mail/sendmail.cf
  8. Restart the sendmail service.

    # /etc/init.d/sendmail start

Managing Mail Delivery by Using an Alternate Configuration (Task)

To facilitate the transport of inbound and outbound mail, the new default configuration of sendmail uses a daemon and a client queue runner. If you have disabled your daemon, you should perform the following task. For a detailed explanation, refer to "New Configuration File, submit.cf".

How to Manage Mail Delivery by Using an Alternate Configuration of sendmail.cf

In the default configuration of sendmail, the client queue runner must be able to submit mail to the daemon on the local SMTP port. If the daemon is not listening on the SMTP port, the mail remains in the queue. To avoid this problem, perform the following task. For more information about the daemon and client queue runner and to understand why you might have to use this alternate configuration, refer to "New Configuration File, submit.cf".

This procedure ensures that your daemon runs only to accept connections from the local host.

  1. Become superuser or assume an equivalent role.

    For information about roles, refer to "Using Privileged Applications" in System Administration Guide: Security Services.

  2. Stop sendmail.

    # /etc/init.d/sendmail stop
  3. Make a copy of the configuration file (either subsidiary.mc or main.mc, depending on your requirements) that you are changing. In this example, the subsidiary.mc file is used.

    # cd /usr/lib/mail/cf
    # cp subsidiary.mc myhost.mc

    myhost

    Select a new name for your .mc file.

  4. Edit the new configuration file (for example, myhost.mc).

    Add the following lines before the MAILER() lines.

    # cat myhost.mc
    ..
    DAEMON_OPTIONS(`NAME=NoMTA4, Family=inet, Addr=127.0.0.1')dnl
    DAEMON_OPTIONS(`NAME=NoMTA6, Family=inet6, Addr=::1')dnl
  5. Build the configuration file by using m4.

    # /usr/ccs/bin/make myhost.cf
  6. Install the new configuration file after making a copy of the original.

    # cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.save
    # cp myhost.cf /etc/mail/sendmail.cf
  7. Restart the sendmail service.

    # /etc/init.d/sendmail start
 
 
 
  Previous   Contents   Next