1. Home
  2. Computing & Technology
  3. Linux

Linux Network Administrators Guide

From Authors, for About.com

18.8.4.2. The access database

An alternative system that offers greater flexibility and control at the cost of manual configuration is the sendmail access_db feature. The access database allows you to configure which hosts or users you will accept mail from and which you will relay mail for.

Managing who you will relay mail for is important, as it is another technique commonly employed by spamming hosts to circumvent systems such as the Real-time Blackhole List just described. Instead of sending the mail to you directly, spammers will relay the mail via some other unsuspecting host who allows it. The incoming SMTP connection then doesn't come from the known spamming host, it instead comes from the relay host. To ensure that your own mail hosts aren't used in this way, you should relay mail only for known hosts. Versions of sendmail that are 8.9.0 or newer have relaying disabled by default, so for those you'll need to use the access database to enable individual hosts to relay.

The general idea is simple. When a new incoming SMTP connection is received, sendmail retrieves the message header information and then consults the access database to see whether it should proceed to accept the body of the message itself.

The access database is a collection of rules that describe what action should be taken for messages received from nominated hosts. The default access control file is called /etc/mail/access . The table has a simple format. Each line of the table contains an access rule. The lefthand side of each rule is a pattern used to match the sender of an incoming mail message. It may be a complete email address, a hostname, or an IP address. The righthand side is the action to take. There are five types of action you may configure. These are:

  • OK
  •    

    Accept the mail message.


  • RELAY
  •    

    Accept messages from this host or user even if they are not destined for our host; that is, accept messages for relaying to other hosts from this host.


  • REJECT
  •    

    Reject the mail with a generic message.


  • DISCARD
  •    

    Discard the message using the $#discard mailer.


  • ### any text
  •    

    Return an error message using ### as the error code (which should be RFC-821 compliant) and "any text" as the message.


An example /etc/mail/access might look like:


   

friends@cybermail.com REJECT
aol.com REJECT
207.46.131.30 REJECT
postmaster@aol.com OK
linux.org.au RELAY

This example would reject any email received from friends@cybermail.com , any host in the domain aol.com and the host 207.46.131.30 . The next rule would accept email from postmaster@aol.com despite the fact that the domain itself has a reject rule. The last rule allows relaying of mail from any host in the linux.org.au domain.

To enable the access database feature, use the following declaration in your sendmail.mc file:


   

FEATURE(access_db)

The default definition builds the database using hash -o /etc/mail/access , which generates a simple hashed database from the plain text file. This is perfectly adequate in most installations. There are other options that you should consider if you intend to have a large access database. Consult the sendmail book or other sendmail documentation for details.

* License

* Linux Network Administrators Guide Guide Index

Explore Linux
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux Documentation
  5. Linux Network Admin Guide
  6. Linux Network Administrators Guide - 18.8.4. Managing Unwanted or Unsolicited Mail (Spam)

©2009 About.com, a part of The New York Times Company.

All rights reserved.