You are previewing Invision Power Board 2: A User Guide.
O'Reilly logo
Invision Power Board 2: A User Guide

Book Description

A simple step-by-step guide to setting up a Linux email server using the most popular free Open Source tools

  • All the information you need to easily set up your own Linux email server

  • Shows how to provide web access to email, virus and spam protection, and more

  • Techniques to backup and protect your data

  • Applications used include PostFix, Courier, SquirrelMail, SpamAssassin, ProcMail, and ClamAV

  • In Detail

    Many businesses want to run their email servers on Linux, but getting started can be complicated. The attractiveness of a free-to-use and robust email service running on Linux can be undermined by the apparent technical challenges involved. Some of the complexity arises from the fact that an email server consists of several components that must be installed and configured separately, then integrated together. Unlike other approaches that deal with one component at a time, this book gives you a basic knowledge across all the server components, leaving you with a complete working email server for your small business network.

    Based entirely on free, Open Source software, you will see how to protect your server from spam and viruses, offer web access for remote access, and secure your installation with regular backups.

    This book gives you just what you need to know to set up and maintain an email server. It covers setting up the server and the mailserver, as well as extras such as spam and virus protection, and web based email. Written by professional Linux administrators the book is aimed at technically confident users and new and part-time system administrators. The emphasis is on simple, practical and reliable guidance.

    Table of Contents

    1. Linux Email: Set up and Run a Small Office Email Server
      1. Table of Contents
      2. Copyright
      3. Credits
      4. About the Authors
      5. Introduction
        1. What This Book Covers
        2. Conventions
          1. Reader Feedback
          2. Customer Support
          3. Errata
          4. Questions
      6. 1. Linux and E-Mail Basics
        1. Why Manage your own E-Mail Server?
        2. What you need to Host an E-Mail Server
        3. Sizing the Hardware of your E-Mail Server
        4. Main E-Mail Protocols—SMTP, POP, and IMAP
          1. Overview
          2. POP Protocol
          3. IMAP Protocol
          4. The SMTP Protocol
        5. E-Mail and DNS
          1. DNS Record Types Used by E-Mail Applications
        6. Backup Mail Servers
        7. Summary
      7. 2. Setting Up Postfix
        1. Introduction to Postfix
          1. What is Postfix?
          2. Postfix Architecture: An Overview
            1. New Message Arrival
            2. Scheduling Message Deliveries
            3. Message Delivery
            4. Supporting Programs
        2. Installation and Basic Configuration
          1. Choosing the Postfix Version
          2. Installing from a Package
          3. Installing from Source Code
          4. The Postfix Configuration
            1. main.cf
            2. master.cf
            3. Lookup Tables
          5. Getting Postfix Up and Running
            1. Domains and Hostnames
            2. Indirect Mail Delivery through Your ISP
            3. Choosing Network Interfaces
            4. Choosing Mailbox Format for Local Deliveries
            5. Error Reporting
            6. Other Useful Configuration Parameters
            7. Starting Postfix and Sending the First Message
        3. Stopping Spam and Other Unwanted Messages
          1. Postfix's Anti-Spam Methods: An Overview
          2. Understanding SMTP Restrictions
            1. Access Maps
            2. Examples
            3. Implementing New Policies
          3. Using DNS Blacklists
            1. Choosing DNS Blacklists
          4. Stopping Messages Based on Contents
            1. Configuring Header and Body Checks
            2. Examples
            3. Caveats
        4. Virtual Alias Domains and Local Aliases
          1. Virtual Alias Domains
            1. Many Virtual Alias Domains Mapping to One Local Domain
            2. One Virtual Alias Domain Mapping to Many Local Domains
            3. Group Addresses
            4. Introducing MySQL Lookups
          2. Local Aliases
            1. Command Deliveries
          3. Common Pitfalls
          4. Other Address Rewriting Mechanisms
        5. Troubleshooting Postfix Problems
          1. Reading and Interpreting the Log Files
            1. Message Queue ID
            2. Example: SMTP Submission, Local Delivery
            3. Example: Local Submission, SMTP Delivery
            4. Example: Connection Problems upon SMTP Delivery
            5. Getting More Detailed Log Messages
          2. Troubleshooting Lookup Tables with Postmap
          3. Getting Help
        6. Summary
      8. 3. Incoming Mail with POP and IMAP
        1. Downloading and Installing Courier-IMAP
          1. Installing Courier-IMAP from RPM
          2. Installing Courier-IMAP from Source
            1. Prerequisites
            2. Installing Versions below Courier-IMAP 4.0 from Source
            3. Building the Courier Authentication Library
            4. Configuring the Courier Authentication Library
            5. Resolving Errors
          3. Building Courier-IMAP
            1. Handling Errors
        2. Using POP3
          1. Configuring Courier-IMAP for POP3
          2. Testing the POP3 Service
          3. Retrieving E-Mail via POP3 with Outlook Express
        3. Using IMAP
          1. Configuring Courier for IMAP
          2. Testing the IMAP Service
          3. Retrieving Mail via IMAP with Mozilla Thunderbird
        4. Summary
      9. 4. Providing Webmail Access
        1. The Webmail Solution
          1. The Benefits
            1. Easy and Quick Access
            2. Easy Remote Access
            3. No Need to Maintain Clients
            4. User Interface to Configure Mail Server Options
            5. Possible Security Benefits
          2. The Disadvantages
            1. Performance
            2. Not Well Suited to Large E-Mail Volumes
            3. Not Well Suited to E-Mail Attachments
            4. Security Issues
        2. The SquirrelMail Webmail Package
        3. SquirrelMail Installation and Configuration
          1. Prerequisites to Installation
            1. Basic Requirements
            2. Apache
            3. PHP
            4. Configuration Requirements
          2. SquirrelMail Installation
            1. Source Installation
          3. Configuring SquirrelMail
        4. SquirrelMail Plug-Ins
          1. Installing Plug-Ins
          2. Example Plug-In Installation
            1. Download and Unpack the Plug-In
            2. Perform Custom Installation if Needed
            3. Enable the Plug-In in conf.pl
          3. Useful Plug-Ins
            1. Compatibility Plug-In (v1.3)
            2. Secure login (v1.2)
            3. HTTP Auth (v1.1)
            4. Password Forget (v2.1)
            5. HTML Mail (v2.0)
            6. Quick Save (v2.0)
            7. G/PGP Encryption Plug-In (v2.0)
            8. Quota Usage (v1.3)
            9. Sent Confirmation (v1.6)
            10. Timeout User (v1.6)
            11. E-Mail Footer (v0.4)
            12. Change Password (v2.7-1.4.x)
            13. Address Book Import-Export (v0.8)
            14. Plugin Updates (v0.7)
        5. Securing SquirrelMail
        6. Summary
      10. 5. Securing Your Installation
        1. Setting Up a Permanent Authorized Relay for an IP Address or Range of IP Addresses
          1. SMTP-After-POP
          2. Virtual Private Networks
          3. SMTP Authentication
          4. Static IP Ranges
            1. Generic Relay Rules
            2. Explicit Relay Rules
          5. Dynamic IP Ranges
        2. Cyrus SASL
          1. SASL Layers
            1. Authentication Interface
            2. Mechanism
            3. Method
            4. Password Verification Service
          2. Cyrus SASL Installation
          3. Cyrus SASL Configuration
            1. Selecting a Password Verification Service
            2. Choosing a Log Level
            3. Choosing Valid Mechanisms
            4. saslauthd
              1. Using an IMAP Server as Authentication Back End
              2. Using an LDAP Server as Authentication Back End
              3. Using the Local User Accounts
              4. Using PAM
            5. auxprop
              1. Configuring the sasldb Plug-In
              2. Configuring the sql Plug-In
            6. authdaemond
              1. Setting the authdaemond Password Verification Service
              2. Configuring the authdaemond Socket Path
        3. Testing Cyrus SASL Authentication
        4. Postfix SMTP AUTH Configuration
          1. Preparing the Configuration
          2. Enabling SMTP AUTH
          3. Setting the Security Policy
          4. Including Broken Clients
        5. Testing SMTP AUTH
        6. Enabling Relaying for Authenticated Clients
        7. Securing Plaintext Mechanisms
          1. Enabling Transport Layer Security
          2. Configuring Security Policy
        8. Dictionary Attacks
          1. Recipient Maps
            1. Checking Local Domain Recipients
            2. Checking Relay Domain Recipients
          2. Rate-Limiting Connections
        9. Summary
      11. 6. Getting Started with Procmail
        1. How can a Filtering System Help Me?
          1. Potential Uses for Mail Filtering
            1. Filtering and Sorting Mail
            2. Forwarding Mail
            3. Processing the Mail in an Application
            4. Acknowledgements and Out of Office/Vacation Replies
          2. File Locking and Integrity
        2. Introduction to Procmail
          1. Who Wrote It and When
          2. What Procmail Is Not Suitable For
          3. Versions Used
        3. Downloading and Installation
          1. Web Site Location
            1. Installing and Configuring Procmail
            2. Installation Options/Considerations
            3. Individual Installation
            4. System-Wide Installation
          2. Integration with Postfix Mail Service for System-Wide Delivery
            1. Create an Alias for System Accounts
            2. Add Procmail to the Postfix Configuration
            3. Postfix-Provided Environment Variables
        4. Basic Operations
          1. Configuration File
            1. File Format
            2. Configuration File Dissection
        5. Analyzing a Simple Rule
          1. The Rule Structure
            1. Variable Analysis
            2. Rule Analysis
        6. Creating and Testing a Rule
          1. 'hello world' Example
          2. Create rc.testing
          3. Perform Static Testing of the Script
          4. Configure Procmail to Process rc.testing
          5. Testing the Setup
        7. Configuration Debugging
          1. Check for Typos in the Scripts
          2. Look at the Log File for Error Messages
          3. Check File and Directory Permissions
          4. Turn on Full Logging
          5. Taking Steps to Avoid Disasters
        8. Understanding E-mail Structure
          1. Message Body
          2. E-Mail Headers
          3. Header Structure
          4. Official Definitions for Headers
        9. Example Rule Sets
          1. From Header
          2. Return-Path Header
            1. Filtering by Return-Path
          3. To and Cc Headers
            1. Filtering by To or Cc
          4. Subject Header
            1. Filtering by Subject
        10. System-Wide Rules
          1. System Rule: Remove Executables
          2. System Rule: Large E-Mails
        11. Summary
      12. 7. Advanced Procmail
        1. Delivering and Non-Delivering Recipes
          1. Non-Delivering Example
        2. Ordering of Procmail Recipes
        3. Formail
        4. Advanced Recipe Analysis
          1. Comments
          2. Variable Assignments
            1. Substitutions
            2. Default Values
            3. Command Output
            4. Pseudo-Variables
            5. Mailbox Variables
            6. Program Variables
            7. System Interaction Variables
            8. Logging Variables
            9. Procmail's State Variables
            10. Message Content Variables
            11. Locking Variables
            12. Error-Handling Variables
            13. Miscellaneous Variables
            14. EXAMPLE
          3. Recipes
            1. Colon Line
            2. Locking
              1. Automatic Locking
              2. Enforced Locking
              3. No Locking
            3. Flags
              1. Default Flags
              2. Scope of Matching—HB
              3. Scope of Action—hb
              4. Flow Control—aAeEc
              5. Case Sensitivity—D
              6. Execution Mode—fwWir
            4. Conditions
            5. Apply a Rule Unconditionally
            6. Tests with Regular Expressions
              1. EXAMPLE
            7. Test Size of Message Part
            8. Test Exit Code of External Program
              1. EXAMPLE
            9. Negation
              1. EXAMPLE
            10. Variable Substitution in Conditions
              1. EXAMPLE
            11. Action Line
            12. Forward to Other Addresses
              1. EXAMPLE
            13. Feed to a Shell or Command Pipeline
            14. Save to a Folder
            15. Compound Recipe
        5. Regular Expressions
          1. Introduction to Regular Expressions
            1. The Dot
            2. Quantifier Operation '?'
            3. The Asterisk *
            4. The Plus Sign +
            5. Restrictive Matches Using ( )
            6. A Simple Spam Filter
            7. Character Classes
            8. Start of Line
            9. End of Line
        6. Procmail Macros
          1. ^TO and ^TO_
          2. ^FROM_MAILER
          3. ^FROM_DAEMON
          4. EXAMPLE
        7. Advanced Recipe Examples
          1. Example 1: Vacation Auto-Reply
          2. Example 2: Organize Mail by Date
          3. Example 3: Inform Users of Large Mail
        8. Putting it all Together
          1. Creating a Structure to Base Your Own Rules Upon
            1. Rc.system
            2. Rc.lists
            3. Rc.killspam
            4. Rc.vacation
            5. Rc.largefiles
            6. Rc.viruses
            7. Rc.spamfilter
        9. Summary
      13. 8. Busting Spam with SpamAssassin
        1. Why Filter E-Mail?
          1. Spam is a Moving Target
          2. Spam Filtering Options
        2. SpamAssassin in Detail
        3. Getting SpamAssassin
          1. Using CPAN
            1. Configuring CPAN
          2. Installing SpamAssassin Using CPAN
          3. Using the rpmbuild Utility
          4. Using Pre-Built RPMs
          5. Testing the Installation
            1. Modified E-Mails
        4. Using SpamAssassin
          1. Using SpamAssassin with Procmail
            1. Global procmailrc File
            2. Using SpamAssassin on a Per-User Basis
          2. Using SpamAssassin as a Daemon with Postfix
          3. Using SpamAssassin with amavisd-new
            1. Installation from Package
            2. Installing Prerequisites
            3. Installing from Source
            4. Create a User Account for amavisd-new
            5. Configuring amavisd-new
            6. Configuring Postfix to Run amavisd-new
        5. Configuring E-Mail Clients
          1. Microsoft Outlook
          2. Microsoft Outlook Express
          3. Mozilla Thunderbird
        6. Customization
          1. Reasons to Customize
          2. Rules and Scores
          3. Altering Rule Scores
          4. Using other Rulesets
          5. Whitelists and Blacklists
          6. Bayesian Filtering
        7. Other SpamAssassin Features
        8. Summary
      14. 9. Antivirus Protection
        1. Introduction to ClamAV
        2. Document Types Supported
        3. Downloading and Installing ClamAV
          1. Requirements
          2. Adding a New System User and Group
          3. ClamAV
          4. Post Installation Testing
          5. Editing the Config Files
          6. clamd
          7. Closest Mirrors
          8. Sample Config File
        4. Downloading, Building, and Installing ClamSMTP
          1. ClamSMTP
          2. Download Source Code
          3. Build and Install
          4. Configure into Postfix
        5. Testing Filtering
          1. EICAR Test Virus
          2. Example: Test from the Command Line
          3. Testing CLAMD
          4. Testing Mail-Borne Virus Filtering
          5. Thorough E-Mail-Borne Testing
        6. Automating Startup and Shutdown
        7. Automating Update of Virus Data
          1. Setting Up Auto-Updating
            1. Quick Test
        8. Freshclam Configuration
        9. Monitoring Log Files
        10. Disinfecting Files
        11. Summary
      15. 10. Backing Up Your System
        1. What to Back Up
        2. What not to Back Up
        3. E-Mail
          1. Maildir and Backup
          2. Incremental and Full Backups for the Mailboxes
          3. Storage Considerations
          4. Backing Up E-Mail
            1. Full Backup
            2. Incremental Dumps
          5. Restore
            1. Interactive Restore
            2. Non-Interactive Restore Across the Network
        4. Configurations
          1. Backing Up Configurations on Backup Media
          2. Restoring the Configuration
          3. Subversion
          4. Installing Subversion
          5. Configuring Basic Subversion Functionality
            1. Creating the Repositories Directory
            2. Creating a Configuration for svnserve
          6. Repositories
            1. Creation
            2. Configuration
            3. Hooks
          7. Preparing the svn Client
          8. Importing Configuration
            1. Setting Properties
            2. Committing Changes
            3. Maintaining a ChangeLog
            4. Rollback
        5. Summary
      16. Index