Postfix + SASL2(using pam mech) + TLS HOWTO for FreeBSD
By: Ben Haga (tuximus [at] tuximus.mine.nu)
Introduction
If you have reached this page, you have found the HOWTO on how to create a working Postfix version 2 server running with SMTP AUTH (using SASL2 + PAM) and using TLS to get a secure connection to the server. Why must we have all of this security? Because it is always good to have as much security as possible. Even if you are the only user on your home network and you receive three mails a day from remote sources. You never know when someone is browsing your network and snooping for files you would rather keep private. But to be honest, this HOWTO is mostly for people who are running mail services for a group of people and would rather use SMTP AUTH than the classic "mynetworks=..." specifications. This way, you know what people are getting on your server and you know that you have granted them access to be retrieving mail. So let us get started.
Install Cyrus-SASL2 / Postfix
Go ahead and install Cyrus-SASL2 before you do anything else. You can either do this through ports by:
Configuration of Cyrus-SASL2
The first thing we shall do is create a symlink for /usr/local/lib/sasl2 to /usr/lib/sasl2 by doing this:
Now to start up the saslauthd daemon. All you have to do to start it is run "saslauthd -a pam" and it should start without a hitch (if it does not, ensure that PAM support is working with SASL2 altogether by checking if the configure script configured it with PAM support; it is the default, but it does not always work). Now go ahead and open up /etc/rc.local or create one if it does not exist and put "/usr/local/sbin/saslauthd -a pam" so it will start whenever you boot the machine.
That completes our SASL2 configuration, now it is onto Postfix to see if we cannot get this working!
Creating Keys and CA Certifications for TLS/SSL
This part can be a bit tricky, so in light of that, I will refer you to a truly excellent HOWTO on creating certs and even having them signed by yourself. The link for that is here. I would highly recommend that you put those in /usr/local/etc/postfix/ssl/ so they are easy to access and you will have no hard time remembering where they are.
Postfix Configuration
This part can be rather long. I will try to keep it short, but there is much to do. If you already know how to configure main.cf for everything such as $mydomain and all of that, just go ahead to the next paragraph; else, please keep reading for that information. Okay, go ahead and open up main.cf in your favorite browser (should be in /usr/local/etc/postfix/main.cf). You will see that there are a lot of comments in there and commented out options. It is a good idea to leave most of the comments in there for a later date in case that you would like to add more fucntionality or create transport maps, etc. The things we are to be concerned with in the HOWTO are myhostname (set to the hostname of your mail server, in my case it is mail.tuximus.mine.nu), mydomain (set to the domain name your server is on, in my case that would be tuximus.mine.nu), mydestination (this makes sure that you can relay the mail to your mailbox or maildir), and myorigin (this sets the name of the origin label put in outgoing mail, I put this as tuximus.mine.nu firstly because that is my domain, and secondly, because it looks better than an internal address, if Postfix decided to set that as myorigin). Now that was not so bad was it? Let us get to the TLS and SASL configuration!
Okay, I prefer to put the following information at the bottom of my configuration file under a label "## TLS and SASL ##", but it is really up to you, it will make no difference in how the functionality will load, since every line has the same precedence. Here is what to put:
Conclusion
Well, if this does not work, go ahead and feel free to email me at tuximus [at] tuximus.mine.nu to make adjustments to whatever does not work. Always be sure that everything is running correctly such as saslauthd and postfix. Remember, once you change the configuration in main.cf or master.cf, you *must* reload or stop and start Postfix by doing:
|
|
|
|
[Home] [FBSD Articles] [Scripts Corner] [Contribute] [Search] [FBSD Links] [Files]
About Us
FreeBSD Articles
*Hardware
*Networking
*Security
*Software
*X Windows
Forums
Defcon1 Forum
Files / Scripts
Newbies Corner
Tech. Talk
Tips and Tricks
FreeBSD Links
Articles in other
Languages :
*French Articles
*Spanish Articles
Want to Help ?
Click Here
Email Users

This site cannot be duplicated without permission
© 1998 - 2008 Defcon1, www.defcon1.org , Copyrights for all materials on this web site are held by the individual authors, artists, photographers or creators. Materials may not be reproduced or otherwise distributed without permission
of www.defcon1.org and the content's original author.