| <--YBC |
Technical Documents and Other Useful Information
- Postfix/Imap/Squirrelmail
|
Last Reviewed 03/07/06
|
|
|
Introduction: What is Postfix? Is Postfix everything I need to have a complete mail server? A Mail User Agent (MUA) is needed to access these mailboxes. A mail user agent can be as simple as the pine email program checking email delivered to a local mailbox. If you want to check your mail on a remote mail server you will need to use a mail user agent protocol such as IMAP (Interactive Mail Access Protocol) or POP. Most email client programs (otherwise known as Mail User Agents) communicate over the IMAP or POP protocols to receive email from where the Postfix MTA placed it. There are also webmail interfaces today that allow a user to access her/his mail directory from a website. Understanding just how Postfix Processes Mail: local machine->sendmail->postdrop->maildrop->pickup->cleanup If the message starts out externally it proceeds right to the cleanup process. The cleanup process makes sure all of the email header information is in order. Then it passes the message to the nqmgr, which is a process that decides just where the mail should go. Three of the more typical destinations include 1. a local mailbox, 2. an eternal smtp server, or 3. a bounce, or deferred directory. Bounced messages are sent back to the nqmgr for processing back to the original sender. Deferred messages are kept for a certain time period and sent back through nqmgr in hopes of a successful future delivery. The various programs above that process the mail send the mail through different queues. These directories can be found in the /var/spool/postfix. By default Postfix will place the delivered mail in the /var/spool/mail directory. This default mail directory can be changed in the main.cf file. Configuration Files. Looking at the configuration files for Postfix: Two main config files, master.cf and main.cf The master.cf file controls basic behaviors of the core processes. Be very careful how you manipulate the data here. By default the Redhat and Mandrake rpms allow most core processes to operate in a chroot jail. To get Postfix running you should not have to edit anything in this file, especially when installed via rpm. There are hundreds of parameters that can go in the main.cf directory. Be sure to back up the default file as it is nicely documented. Where everything is stored: What the hostname and domain name is, where applicable: myhostname = bob.sample.org (This is used as the default address for
all local users). If the hostname is the same as the domain name, then the mydomain is the only variable needed. myorigin = $mydomain Determines the format of the origin address for all messages sent by postfix inet_interfaces = all What interfaces Postfix will accept connections on. mydestination = $myhostname, localhost.$mydomain The final name to accept mail for. ***Important*** home_mailbox = Maildir/ - This tells Postfix to deliver to the /home/user/Maildir directory. This is necessary so that courier-imap can access the delivered mail. Understanding Log Files (/var/log/mail/info) May 19 00:21:50 sample postfix/smtpd[1352]: 90C0126ECAE: client=someone.mchsi.com[204.xxx.xxx.xxx] May 19 00:21:51 sample postfix/cleanup[1353]: 90C0126ECAE: message-id=3EC875C3.2010500@mchsi.com May 19 00:21:51 sample postfix/nqmgr[3296]: 90C0126ECAE: from= <someone@mchsi.com>, size=2666, nrcpt=3 (queue active) May 19 00:21:51 sample postfix/local[1357]: 90C0126ECAE: to=<bob@sample.org>, relay=local, delay=1, status=sent (maildir) May 19 00:21:52 sample postfix/smtpd[1352]: disconnect from someone.mchsi.com[204.xxx.xxx.xxx] Other neat easy things to do with Postfix: Aliases can be set up in /etc/postfix/aliases In the form mike: michael, bob (The alias mike is delivered to both user michael and bob) Virtual Domains can be set up in /etc/postfix/virtual In the form mike@mikesite.com: mike (this is just one way to do it for a small number of users. Proper dns service will also have to be configured as well.) UCE (Spam Controls) I've not used these yet. Out of the box Postfix is not an open relay. Where do I get the Postfix software? The software is compiled into almost every Linux distribution, finding it will not be hard at all. The source can be found directly from postfix.org What are the latest versions? RH9: postfix-1.1.11-11.i386.rpm Mandrake 9.1: 2.0.6-1mdk.i586 Adding Courier-Imap as the MUA (Mail User Agent Protocol) If you can find a rpm or packaged install, this will be easiest. :-) Courier is actually an entire mail server program, you'll just need the courier-imap portion which can be downloaded separately. Courier-imap includes a pop3 server and an imap server. The download instructions as well as instructions for making the rpm or installing from a tarball can be found at courier-mta.org. Installing from a tarball isn't that hard, it actually worked flawlessly on my RH9 Server. Being able to use an rpm though will create all of the boot scripts that will make courier-imap work right off of the install. :-) Courier-imap requires a Maildir format to retrieve mail from. A mailbox will need to be created for each user, in his or her home directory. The command to use is: /usr/lib/courier-imap/bin/maildirmake Maildir This command can be run in each home directory (as each user, not as root). A Maildir can be added to /etc/skel so that it is automatically created for each new user. Remember that Postfix needs to be configured to deliver to the Maildir directory instead of the default delivery location. Adding Squirrelmail as a Web-based email client. Squirrelmail is very easy to set up. Out of the box it has most everything needed to be fully functional. Squirrelmail is a set of php files and scripts along with a web page framework that can be dropped right in to an existing website. The configuration script is very straightforward. It contains default values for several different imap servers and Linux distributions. Be sure to enable php support in your web server, and also allow: HTTP file uploads. file_uploads = On (From the /etc/php.ini file) Other Comments Practice with security in mind. Either block ports properly at your firewall or keep the test mail server off of the network. You can also configure most services only to respond on certain interfaces/ports. Join the discussion lists, or peruse the extensive online archives/faqs for answers to common problems. If you are thinking about setting up Squirrelmail you may also want to make that part of your website secure so the passwords aren't passing back and forth in clear text. Resources Books Postfix Richard Blum The Book of Postfix Ralf Hildebrandt, Patrick Koetter (Not yet released) An O'Reiley Postfix Book Kyle Dent (Not yet released) Links http://www.postfix.org/faq.html
Great Compilation Doc:
|
|
||
|
Problems with this site? Contact the
webmaster
Yellow Bug Computers, 2004 |