The Perfect Server - Gentoo 2007.0 - Page 5
12 Postfix with SMTP-AUTH and TLS
First we want to set the USE flags appropriately.
echo "mail-mta/postfix sasl" >> /etc/portage/package.use
Then we actually install it.
emerge --ask --verbose postfix courier-imap procmail
courier-imap would actually be brought in as a dependency of postfix with these USE flags, but including it in the commandline will add it to the world file, the list of those packages we specifically wanted as opposed to dependencies.
Edit /etc/mail/aliases to provide an alias for root to your administrator user. In Gentoo there's a commented-out line for you to complete and uncomment.
Now we want to configure postfix itself. Note, under Gentoo it does not run in a chroot by default, and making it do so is currently beyond the scope of this HowTo.
We set up Postfix for normal Maildir operation. Note, that this does not set anything up specifically for ISPConfig; the changes we need to make for ISPConfig are given in step 18.
postconf -e "myhostname = $(hostname -f)"
Now we set up sasl.
postconf -e 'smtpd_sasl_local_domain ='
Now we want to make the ssl certificates for postfix.
Change the following default values for your domain. Basically these are just the default values that come up when you create a new certificate request, so you can leave this step out and just let yourself be faced with the usual defaults. You'd have to type them in at least twice, so it's probably worth it.
countryName_default stateOrProvinceName_default localityName_default 0.organizationName_default emailAddress_default
And create the certificates.
And configure postfix with them.
postconf -e 'smtpd_tls_auth_only = no'
Start postfix and saslauthd and set them to start on boot.
To see if SMTP-AUTH and TLS work properly now run the following command:
telnet localhost 25
After you have established the connection to your Postfix mail server type:
If you see the lines
250-AUTH LOGIN PLAIN
everything is fine.
The output on my system looks like this:
server1 misc # telnet localhost 25 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. 220 server1.example.com ESMTP Postfix ehlo localhost 250-server1.example.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN quit 221 2.0.0 Bye Connection closed by foreign host.
to return to the system's shell.
The courier-imap software we need was all installed as dependencies in the postfix install. So now we just need to finish setting it up.
Change the C, ST, L, CN and email parameters to match your server. In particular, make sure that the CN field is the hostname mail clients will be using to connect to your mailserver. Then,
Now you can start courier-imap's various services and configure them to start on boot.