You are previewing Postfix.
O'Reilly logo
Postfix

Book Description

This book will offer broad coverage to instruct both the large ISP and the small business network administrator on how to install and configure a full featured Internet email system with a minimum amount of expense. This is possible using the Linux Operating System which supplies all of the necessary server software, the Postfix email software package, and Public Domain client email software on the client PC's. This book also includes educational information that can be used by network administrators in using Postfix to connect an office email server to an ISP. The Postfix email software package is in widely used on the Internet without any books documenting how to install, configure, and operate the email server. This book will provide all the information needed to run Postfix effectively and efficiently.

Table of Contents

  1. Copyright
    1. Dedication
  2. About the Author
    1. About the Technical Editor
  3. Acknowledgments
  4. Tell Us What You Think!
  5. INTRODUCTION
    1. How This Book Is Organized
    2. A Few Disclaimers
    3. Conventions Used in This Book
  6. I. Introduction to E-Mail Services and Postfix
    1. 1. E-Mail Services
      1. Early Mainframe E-Mail Systems
        1. Mainframe Messages
        2. Multi-Mainframe E-Mail Systems
      2. Unix E-Mail Systems
        1. Unix Mail Transfer Agent Programs
          1. The Sendmail Program
          2. The Postfix Program
          3. The qmail Program
          4. The smail Program
          5. The exim Program
        2. Unix Mail User Agent Programs
          1. The mail Program
          2. The pine Program
          3. X Window MUA Programs
      3. LAN-Based E-Mail Systems
      4. E-Mail Protocols
        1. Mail Transfer Agent Protocols
          1. SMTP
          2. ESMTP
          3. LMTP
        2. Mail User Agent Protocols
          1. The Post Office Protocol
          2. The Interactive Mail Access Protocol
      5. Summary
    2. 2. Postfix Services
      1. The Role of Postfix on a Unix Mail Server
        1. The TCP/IP Software
        2. The PPP Software
        3. The UUCP Software
        4. The MUA Server Software
      2. The Postfix Block Diagram
        1. Postfix Core Programs
        2. Postfix Message Queues
        3. Postfix Utility Programs
        4. Postfix Configuration Files
        5. Postfix Lookup Tables
      3. The Postfix Mail Delivery Process
        1. Receiving Messages
          1. sendmail
          2. postdrop
          3. smtpd
          4. pickup
        2. Processing Messages
          1. cleanup
          2. trivial-rewrite
          3. qmgr
        3. Delivering Messages
          1. local
          2. smtp
          3. pipe
          4. bounce
      4. Inside the Postfix Message Queue System
        1. Postfix Message Queue Structure
          1. active
          2. bounce
          3. corrupt
          4. defer
          5. deferred
          6. incoming
          7. maildrop
        2. Postfix Message States
          1. Message State 1: Message Insertion
          2. Message State 2: Message Header Formatting
          3. Message State 3: Message Storage
          4. Message State 4: Message Queuing and Preprocessing
          5. Message State 5: Message Delivery
          6. Problematic E-Mail Messages
      5. Postfix and sendmail
      6. Postfix: Future Features and Releases
        1. Modified active, bounce, and deferred Queues
        2. The flush Program and Message Queue
        3. LMTP Support
        4. The spawn Program
        5. The nqmgr Program
      7. Summary
    3. 3. Server Requirements for Postfix
      1. The Unix Operating System
        1. Memory Management
        2. Process Management
        3. Device Driver Management
        4. Filesystem Management
      2. The Linux Operating System
        1. The Linux Kernel
        2. The Linux Libraries
      3. The GNU Project
        1. GNU bash
        2. GNU gcc
        3. GNU make
      4. Summary
    4. 4. DNS and Postfix
      1. History of Computer Names
      2. Domain Names
        1. DNS Structure
        2. DNS Database Records
          1. Start of Authority Record (SOA)
          2. Internet Address Record (A)
          3. Canonical Name Record (CNAME)
          4. Name Server Record (NS)
          5. Host Information Record (HINFO)
          6. Pointer Record (PTR)
          7. Mail Server Record (MX)
        3. A Sample DNS Database for a Domain
        4. DNS and E-Mail
      3. Using DNS Client Programs
        1. Configuring DNS Client Files
          1. Hostname Resolver File
          2. Hosts File
          3. DNS Resolution File
        2. DNS Utilities
          1. The host Program
          2. The nslookup Program
          3. The dig Program
      4. Summary
    5. 5. SMTP and Postfix
      1. SMTP Description
        1. Basic SMTP Client Commands
          1. HELO Command
          2. MAIL Command
          3. RCPT Command
          4. DATA Command
          5. SEND Command
          6. SOML Command
          7. SAML Command
          8. RSET Command
          9. VRFY Command
          10. EXPN Command
          11. HELP Command
          12. NOOP Command
          13. QUIT Command
          14. TURN Command
        2. Server Responses
          1. SMTP Error Response Codes
          2. SMTP Informational Response Codes
          3. SMTP Service Response Codes
          4. SMTP Action Response Codes
      2. Extended SMTP
        1. The ETRN Command
        2. The AUTH Command
      3. LMTP
        1. Using LMTP
        2. LMTP Commands
      4. Message Formats
        1. Standard RFC 822 Header Fields
          1. Received Header Field
          2. Return-Path Header Field
          3. Originator Header Fields
          4. Resent Header Field
          5. Authentic Header Fields
          6. Resent-Authentic Header Fields
          7. Date Header Fields
          8. Destination Header Fields
          9. Optional Header Fields
        2. Using the RFC 822 Format in an SMTP Mail Transaction
      5. MIME and Binary Data
        1. MIME-Version Header Field
        2. Content-Transfer–Encoding
        3. Content-ID
        4. Content-Description
        5. Content-Type Header Field
      6. Summary
  7. II. Installing and Configuring Postfix
    1. 6. Installing Postfix
      1. Installing Postfix from an RPM
        1. The RPM Package Layout
        2. Installing the RPM
      2. Downloading and Compiling the Postfix Source Code
        1. Creating the Postfix userid and groupid
        2. Determining Postfix maildrop Security
        3. Compiling Postfix
        4. Installing Postfix
        5. Installing Postfix in a chroot Environment
      3. The Postfix Utility Programs
        1. Checking Mail Queues
        2. Starting and Stopping Postfix
        3. Maintaining Postfix User Alias Names
        4. Printing Mail Queue Messages
        5. Maintaining the Configuration File
        6. Sending Messages to Postfix Programs
        7. Locking Postfix Mailbox Files
        8. Logging Postfix Messages
        9. Maintaining Postfix Lookup Tables
        10. Maintaining Postfix Message Queues
      4. Summary
    2. 7. The master.cf Configuration File
      1. The Postfix master Program
      2. Configuring Process Behavior in Postfix
        1. Service Name
        2. Transport Type Name
        3. Private
        4. Unprivileged
        5. Chroot
        6. Wakeup
        7. Maxprocess
        8. Commands
      3. Summary
    3. 8. The main.cf Configuration File
      1. The Postfix Configuration File Format
      2. Configuration Parameters
        1. Local Pathname Information
        2. Queue and Process Ownership
          1. The mail_owner
          2. default_privs
        3. Internet Host and Domain Names
          1. myhostname and mydomain
        4. Sending Mail
          1. myorigin
        5. Receiving Mail
          1. inet_interfaces
          2. mydestination
          3. mynetworks
          4. mynetworks_style
        6. Connecting to Internet or Intranet Servers
          1. relay_host
        7. Rejecting Unknown Local Users
          1. local_recipient_maps
        8. “User not found” Options
          1. relocated_maps
        9. Address Rewriting
          1. allow_percent_hack, append_at_myorigin, append_dot_mydomain
          2. empty_address_recipient
          3. masquerade_domains, masquerade_exceptions
          4. swap_bangpath
          5. canonical_maps
        10. Virtual Domains
          1. virtual_maps
        11. Transport Map
          1. transport_maps
        12. Alias Database
          1. alias_maps
          2. alias_database
          3. allow_mail_to_commands, allow_mail_to_files
        13. Address Extensions
          1. recipient_delimiter
        14. Mailbox Delivery
          1. home_mailbox
          2. mailbox_command
          3. mailbox_transport, fallback_transport
          4. luser_relay
        15. UCE Controls
          1. header_checks
        16. Fast ETRN Service
          1. fast_flush_policy
        17. SMTP Greeting Banner
          1. smtpd_banner
        18. Parallel Delivery to the Same Destination
          1. initial_destination_concurrency
          2. default_destination_concurrency_limit
          3. local_destination_concurrency_limit
          4. default_destination_recipient_limit
        19. Debugging Control
          1. debug_peer_list, debug_peer_level
          2. debug_command
        20. Placing Limits on Objects
          1. message_size_limit
          2. line_length_limit
          3. header_size_limit
      3. Displaying and Modifying Configuration Parameters
      4. Summary
    4. 9. Postfix Lookup Tables
      1. Postfix Lookup Table Support
      2. Indexed Binary Database Files
        1. Creating the Text File
        2. Creating the Indexed Database File
          1. postmap
          2. postalias
      3. Regular Expression Lookup Tables
        1. regexp
          1. Regular Expression Formats
        2. PCRE
      4. Using External Databases
        1. NIS
        2. MySQL
        3. LDAP
      5. The Postfix Lookup Tables
        1. The access Table
        2. The aliases Table
        3. The canonical Table
        4. The relocated Table
        5. The transport Table
        6. The virtual Table
      6. Summary
    5. 10. Using Postfix
      1. Editing the master.cf File
      2. Determining Local Mail Delivery
        1. Using sendmail-Style Mailboxes
          1. sendmail-Style Mailboxes
          2. Configuring Postfix to Use sendmail-Style Mailboxes
        2. $HOME/Mailbox Delivery
          1. $HOME/Mailbox Mailboxes
          2. Configuring Postfix to Use $HOME/Mailbox
        3. $HOME/Maildir Delivery
          1. Maildir Mailboxes
          2. Configuring Postfix for Maildir Mailboxes
        4. External MDA Delivery
          1. Using MDA Programs
          2. Configuring Postfix to Use an MDA Program
      3. Editing the main.cf File
        1. Determining Interfaces
        2. Determining Recipient Addresses
        3. Determining the Origin Address
      4. Creating the aliases Table
      5. Testing Postfix
        1. Sending Mail Only
        2. Virtual Interfaces
        3. Sending and Receiving Mail
          1. Sending Mail to a Local User
          2. Sending Mail to a Remote User
          3. Sending Mail to a Nonexistent User
      6. Starting Postfix from a Boot Script
        1. On BSD Systems
        2. On System V Systems
      7. User Controlled Files
        1. The .forward File
        2. Address Extensions
      8. Summary
    6. 11. Using Postfix as an ISP Mail Server
      1. Features of an ISP E-Mail Server
        1. Virtual Domains
        2. Selective Relaying
      2. Configuring Virtual Domains
        1. Configuring DNS Records for Virtual Domains
        2. Configuring Postfix for Virtual Domains
          1. An Entire Domain
          2. Individual Users on a Domain
          3. Using the Transport Table for Virtual Domains
      3. Configuring Selective Relaying
        1. Setting Relaying Parameters
          1. Default Values
          2. Rejection Values
          3. Permit Values
          4. Database Checks
      4. Summary
    7. 12. Using Postfix as an Office Mail Server
      1. Internal Office Mail Servers
        1. Workstations
        2. Intranet Mail Servers
      2. External Office Mail Servers
        1. Full-time Internet Mail Server
          1. Connectivity
          2. Postfix Configuration
        2. Dial-Up Internet Mail Server
          1. Connectivity
          2. Postfix Configuration
          3. Retrieving Inbound Messages
        3. Firewall Internet Mail Server
          1. Connectivity
          2. Postfix Configuration
      3. Special Mail Situations
        1. Address Masquerading
        2. Virtual Hosting
        3. Fancy Mail Addresses
      4. Summary
    8. 13. Postfix Server Administration
      1. The Unix syslogd Program
        1. syslogd Parameters
        2. syslogd Configuration File
      2. Postfix Logging Formats
        1. Postfix Starting Log Entries
        2. Postfix Message Entries
        3. Postfix Error Entries
        4. Postfix Mail Delivery Problems
        5. Postfix Verbose Entries
      3. Postfix UCE Parameters
        1. Blocking UCE Sites
          1. Verifying HELO Addresses
          2. Verifying MAIL FROM: Addresses
        2. Getting Outside Help
        3. Blocking Known UCE Messages
      4. Summary
    9. 14. Migrating from Sendmail to Postfix
      1. What Is Sendmail?
      2. sendmail Files and Directories
        1. The sendmail Executable Program
        2. The sendmail Configuration File
        3. The sendmail Message Queue
        4. Querying the Message Queue
        5. Creating Mail Aliases
        6. Aliases Database
        7. Getting Mail Statistics
        8. Resetting Mail Statistics
        9. Storing Mail Statistics
        10. Setting sendmail to Record Mail Statistics
        11. The sendmail Help File
        12. User-Controlled Mail Forwarding
      3. Configuring Postfix to Use Sendmail Files
        1. Replacing the Sendmail Program Files
        2. Using Sendmail Mailboxes
          1. Normal Mailbox Delivery
          2. Postfix $HOME/Mailbox Delivery
          3. Postfix $HOME/Maildir Delivery
          4. Postfix MDA Program Delivery
        3. Using the Sendmail aliases File
          1. The aliases Database File
          2. The newaliases Program
          3. Supporting Files and Commands
        4. Using .forward Files in Postfix
        5. Using the Sendmail virtusertable and sendmail.cw Files
        6. Checking the Sendmail Mail Queue
      4. Summary
    10. 15. Using the Maildir Mailbox Format
      1. Standard Unix Mailboxes
        1. Local Message Storage
          1. Mailbox Message Format
          2. Problems with the mbox Mailbox Format
        2. Local Message Retrieval
      2. The Maildir Format
        1. Local Message Storage
          1. The Maildir new Directory
          2. The Maildir cur Directory
          3. The Maildir tmp Directory
        2. Local Message Retrieval
      3. Configuring Postfix to Use Maildir Mailboxes
      4. Using a Maildir-Aware MUA Program
        1. Installing courier-imap
        2. Configuring courier-imap
        3. Using courier-imap
        4. Using Shared Folders
      5. Summary
    11. 16. Using MDA Programs with Postfix
      1. What Is a Local Mail Delivery Agent?
        1. Automatic Mail Filtering
        2. Automatic Mail Replying
        3. Automatic Program Initialization by Mail
      2. Using an External MDA Program with Postfix
        1. Configuring the main.cf File
        2. Watching MDA Programs in the Postfix Log
      3. The procmail MDA Program
        1. Installing procmail
        2. The procmail Command Line
        3. User-Defined procmail Actions
      4. Summary
  8. III. Advanced Postfix Server Topics
    1. 17. Using MySQL with Postfix
      1. What Is MySQL?
      2. Installing MySQL
        1. Using a Binary Distribution
        2. Using a Source Code Distribution
          1. Create the MySQL User Id and Group Id
          2. Compile and Install MySQL
        3. Start the MySQL Server
        4. Server Housekeeping Tasks
      3. Configuring MySQL for Postfix
        1. Creating a MySQL User
        2. Creating a New Database and Table
      4. Using MySQL
        1. Adding Lookup Table Records
        2. Displaying Lookup Table Records
        3. Changing Lookup Table Records
        4. Backing Up the Database
      5. Configuring Postfix for MySQL
        1. Compiling Postfix for MySQL Support
        2. Pointing Postfix to the MySQL Table
        3. Using a MySQL Alias Lookup Table
      6. Summary
    2. 18. Using OpenLDAP with Postfix
      1. What Is LDAP?
        1. The LDAP System
        2. LDAP Database Options
          1. Standalone
          2. Replicated
          3. Distributed
      2. Installing the OpenLDAP Package
        1. Binary Distribution
        2. Source Code Distribution
        3. OpenLDAP Programs
          1. slapd
          2. slurpd
      3. Configuring OpenLDAP for Postfix
        1. Designing an Organizational LDAP Directory
        2. Creating the slapd.conf File
        3. Starting OpenLDAP
        4. Creating the Database Organization and Administrator Objects
        5. Adding User Objects
          1. OpenLDAP Versions Earlier Than 2.0
          2. OpenLDAP Version 2.0 and Later
            1. Defining New Object and Attribute Types
            2. Using Existing Object and Attribute Types
      4. Configuring Postfix for LDAP
        1. Compiling LDAP Support into Postfix
        2. LDAP Parameters
      5. Summary
    3. 19. Using Majordomo with Postfix
      1. Features of a Full Service Mailing List
        1. Open and Closed Mailing Lists
        2. Moderated and Unmoderated Mail Lists
        3. Remote Administration of Mailing Lists
        4. Digests of Mailing Lists
        5. Archives of Mail Lists
      2. Installing Majordomo
        1. Downloading Majordomo
        2. Creating a Majordomo System Username
        3. Edit the Majordomo Makefile
        4. Creating and Editing the majordomo.cf File
        5. Compiling Majordomo
        6. Creating Postfix Aliases for Majordomo
        7. Testing the Majordomo Installation
      3. Configuring a Majordomo Mailing List
      4. Using Majordomo
        1. subscribe
        2. unsubscribe
        3. get
        4. index
        5. which
        6. who
        7. info
        8. intro
        9. lists
        10. help
        11. end
      5. Mailing List Owner Commands
        1. approve
        2. config
        3. mkdigest
        4. newconfig
        5. newinfo
        6. passwd
        7. writeconfig
      6. Summary
    4. 20. Using POP3 and IMAP with Postfix
      1. E-Mail MUA Protocols
        1. POP3
        2. IMAP
      2. University of Washington IMAP
        1. Downloading and Installing UW IMAP
        2. Configuring UW POP3
        3. Configuring UW IMAP
      3. The qpopper Program
        1. Downloading qpopper
        2. Configuring qpopper
          1. Shadow Password Support
          2. APOP Authentication Support
          3. qpopper Bulletins
      4. Summary
    5. 21. Using SqWebMail with Postfix
      1. Web-Based Mail Clients
        1. SqWebMail
        2. IMHO
        3. TWIG
        4. WebMail
      2. Installing SqWebMail
        1. Before You Compile
          1. Authentication Modules
            1. Normal Password Support
            2. PAM Support
            3. SqWebMail User Database
            4. vpopmail User Database
            5. MySQL User Database
            6. LDAP User Database
            7. Standalone Program
          2. Spell Checking
          3. Web Server
        2. Compiling SqWebMail
          1. Configuring the Installation
          2. Running the Compiler
        3. Configuring SqWebMail
          1. authdaemond Configuration Files
          2. Standard Configuration Files
          3. Shared Folders
      3. Configuring Postfix for SqWebMail
      4. Using SqWebMail
        1. The Folders Web Page
        2. Reading Mail Messages
        3. Sending Mail Messages
        4. Changing Preferences
      5. Summary
    6. 22. Performance Tuning Postfix
      1. Tuning Postfix Parameters
        1. The master.cf Configuration File
          1. Configuring for Low-End Servers
          2. Configuring for Sending-Intensive Servers
        2. The main.cf Configuration File
          1. Inbound Message Controls
            1. The smtpd_recipient_limit Parameter
            2. The smtpd_timeout Parameter
            3. The smtpd_error_sleep_time Parameter
            4. The smtpd_soft_error_limit Parameter
            5. The smtpd_hard_error_limit Parameter
          2. Outbound Message Controls
            1. The initial_destination_concurrency Parameter
            2. The default_destination_concurrency_limit Parameter
            3. The default_destination_recipient_limit Parameter
          3. Unreachable Hosts
            1. The queue_run_delay Parameter
            2. The maximal_queue_lifetime Parameter
            3. The minimal_backoff_time Parameter
            4. The maximal_backoff_time Parameter
            5. The qmgr_message_recipient_limit Parameter
      2. Tuning the Unix System
        1. Asynchronous Versus Synchronous Disk Access
          1. Using mount Interactively
          2. Mounting Drives at Boot Time
        2. Asynchronous Versus Synchronous Log Entries
      3. Testing Postfix Performance
        1. The smtp-sink Program
        2. The smtp-source Program
      4. Summary
    7. 23. Common Postfix Problems
      1. Handling Undelivered Mail
        1. Listing Undelivered Mail
        2. Displaying Undelivered Mail
        3. Resending Undelivered Mail
      2. Using the postconf Program
      3. Troubleshooting Using the Mail Log
        1. Identifying Postfix Errors
        2. Using Verbose Logging Mode
        3. Using debug_peer_list
      4. Troubleshooting Using a Debugger
        1. Manual Debugging
        2. Automatic Debugging
      5. Summary