Friday, May 30, 2008

Very Basic Mail Server setup with Postfix + Dovedot

This is just a very basic overview on setting up a MailServer with Postfix + Dovecot. I'm basing this on a Redhat flavored GNU/Linux, but this should work on other GNU/Linux's as well.

1. Install postfix and dovecot ( ex. if using yum, yum install postfix )

2. Go in to /etc/postfix dirtectory and re-name the main.cf to main.cf.orig or something similar.

3. Create an empty main.cf

myhostname = mail.domain.com
mydomain = domain.com
myorigin = $mydomain
mydestination = domain.com, mail.domain.com, localhost, localhost.localdomain

inet_interfaces = all
mynetworks = 127.0.0.0/8

local_recipient_maps = unix:passwd.byname, $alias_maps

smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes

smtpd_recipient_restrictions = reject_rbl_client bl.spamcop.net,
reject_rbl_client dnsbl.njabl.org,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client list.dsbl.org,
reject_non_fqdn_sender,
reject_invalid_hostname,
reject_unauth_destination,
reject_unlisted_recipient,
reject_unauth_destination,
reject_unknown_sender_domain,
reject_unauth_pipelining,
permit_sasl_authenticated,
permit_mynetworks

4. Add/Change the below lines in /etc/dovecot.conf

protocols = pop3
pop3_listen = *

5. Make sure your /etc/sysconfig/network has the correct FQDN

...
HOSTNAME = mail.domain.com
..

6. Make sure your /etc/hosts is correct.

127.0.0.1 localhost.localdomain localhost
interface_ip mail.domain.com mail

7. Do chkconfig service_name on for services postfix, dovecot and saslauthd and start the services with the service service_name start command.

8. Create the necessary user accounts with useradd command and assign passwords, and configure your mail clients to use the server for incoming(POP3) and outgoing(SMTP) with authentication.

ex: useradd -s /sbin/nologin username
ex: passwd username

Thats it.

You should be good to go..of course you have to have the necessary DNS settings and other changes, depending on your setup ( ex: firewall ), but for the Mail Server configuration, this is pretty much it.

Please keep in mind, that this is a very basic setup, and i have not tested the configuration above. This is just in case someone wants to get an idea. There are so many good guides on the net in setting up postfix, just search around for a while and you will see. If you need any help, there is always helpful #postfix on freenode. But please examine the situation well before asking for help, so they can help you better.

Other than that, put a comment or reach me at yajith at gmail dot com (yajith@gmail.com). I will help you ( or at least try ) with my limited knowledge.