Book Image

Qmail Quickstarter: Install, Set Up and Run your own Email Server

Book Image

Qmail Quickstarter: Install, Set Up and Run your own Email Server

Overview of this book

This book starts with setting up a qmail server and takes you through virtualization, filtering, and other advanced features like hosting multiple domains, mailing lists, and SSL Encryption. Finally, it discusses the log files and how to make qmail work faster. Qmail is a secure, reliable, efficient, simple message transfer agent. It is designed for typical Internet-connected UNIX hosts. Qmail is the second most common SMTP server on the Internet, and has by far the fastest growth of any SMTP server. Qmail's straight-paper-path philosophy guarantees that a message, once accepted into the system, will never be lost. Qmail also optionally supports maildir, a new, super-reliable user mailbox format.
Table of Contents (13 chapters)

Preface

Qmail is one of the most popular email servers. The current release was published in 1998, and has stood unchanged ever since. It has withstood the test of time surprisingly well, and a devoted community has grown around it to contribute experience, ideas, and patches to provide new features. While there is some dispute over the claim that qmail has no security flaws yet discovered, it cannot be denied that its security track record over the last ten years is unparalleled. Qmail includes several applications, including an SMTP server, a POP3 server, a QMTP server, and several related utilities for manipulating email and email storage. Qmail has been used by or is currently used by Hotmail, Yahoo!, NetZero, Speakeasy, Qwest, PayPal, Aruba.it, and others. You can learn more about qmail at http://cr.yp.to/qmail.html and http://www.qmail.org/.

This book treats qmail more as an architecture than a mail server, and from that perspective guides the reader through the installation, administration, customization, and deployment of a qmail-based server. The book begins with a quick, minimal, step-by-step walkthrough of a bare-bones qmail server, and then introduces and explains the basic design of the qmail architecture in easily understood terms.

The later chapters of the book are devoted to using qmail to provide specific features through customization and optimization. Alternative methods of providing each feature are compared, and a plethora of example scripts are provided to demonstrate the concepts and techniques.

What This Book Covers

Chapter 1 provides a quick step-by-step guide to installing a basic qmail server on a computer without an existing mail server, using ucspi-tcp and tcpserver to provide some of the basic services that a qmail SMTP server relies upon. At the end of the chapter is an overview of the qmail architecture that is explained in the following chapters to understand how qmail works and how the structure lends itself to customization.

Chapter 2 and Chapter 3 mirror each other: the former details how email enters the qmail queue, and the latter details how email leaves the qmail queue. The discussion of inbound mail includes the basic architectural details as well as discussion of authentication and the two protocols that qmail supports: SMTP and QMTP. The discussion of outbound mail also includes the basic architectural details and expands into basic filtering, the definition of users and mailboxes, and remote delivery.

Chapter 4 examines in detail the storage formats that qmail supports. Specifically, it covers the factors that influence the choice of the format to be used for a given situation, using mbox, Maildir, and MH as examples. One of the most common things to do with email is to retrieve it from a central server either via the POP3 or IMAP protocols, or via a webmail interface. The latter half of this chapter covers all three, and discusses the reasons for choosing one protocol over the other, how to choose an IMAP server package, and how to set up qmail's own POP3 server.

Chapter 5 begins the more advanced section of the book with a discussion of server virtualization. Multiple kinds of virtualization are discussed, including qmail's built-in virtual domain and virtual user framework, virtual domain management software, and the possibilities provided by having multiple qmail installations.

Chapter 6 unleashes the full power of the qmail architecture's design. By altering the flow of mail through the architecture—or changing the architecture itself—qmail can be made to perform virtually any task. Sending mail without a queue, blocking viruses, detecting spam, validating recipients, and using SPF and/or DomainKeys are all used as examples in this chapter. Both lightweight and heavyweight methods of spam and virus prevention are also discussed in detail.

Chapter 7 looks at some advanced features that don't quite fit into other, larger categories, such as SSL support and optimization for mailing-list delivery.

Chapter 8 covers ongoing maintenance, monitoring, and good administrative behavior. It provides a detailed description of the log files and how to interpret them and use the qmailanalog package to get statistical analysis of qmail's behavior. Expanding the log files to contain more information, identifying and recognizing problems (including "silly-qmail" syndrome), and using information in the logs to improve qmail's performance are all explored in this chapter.

What You Need for This Book

Qmail works on practically all UNIX systems: AIX, BSD/OS, FreeBSD, HP/UX, Irix, Linux, NetBSD, OpenBSD, OSF/1, SunOS, Solaris, etc. It automatically adapts itself to new UNIX variants.

Qmail does not support Windows.

Who This Book is For

This book is targeted at System Administrators familiar with Linux/UNIX and DNS servers who need to set up qmail.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

There are four styles for code. Code words and files in text that are not editable are shown as follows: "Qmail's SMTP server, for example, cannot talk to the network by itself; this ability is provided by software like inetd or tcpserver or similar." Code words and files in text that are editable are shown as follows: "Qmail comes with a set of minimal install instructions, in a file named INSTALL."

A block of code will be set as follows:

#!/bin/sh
# Using splogger to send the log through syslog.
# Using qmail-local to deliver messages to ~/Mailbox by default.
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start ./Mailbox splogger qmail

Any command-line input and output is written as follows:

chown root ~alias/.qmail-root
chmod 644 ~alias/.qmail-root

New terms and important words are introduced in a bold-type font. Usernames have been introduced in an italicized format as follows: "However, qmail does not deliver mail to the real root user."

Reader Feedback

Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to [email protected], making sure to mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email [email protected].

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer Support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the Example Code for the Book

Visit http://www.packtpub.com/support, and select this book from the list of titles to download any example code or extra resources for this book. The files available for download will then be displayed.

Note

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the Submit Errata link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Questions

You can contact us at [email protected] if you are having a problem with some aspect of the book, and we will do our best to address it.