Monday, January 14, 2013

Postfix + Dovecot on Centos 6.2 Final Release

Postfix Instalation and Configuration Install postfix package
$ yum install postfix
Edit your main.cf
$ mcedit /etc/postfix/main.cf
and add this basic configuration (change nebula.anekarupatera.lan with your FQDN machine name.
Before editing main.cf we should generate key for ssl/tls certificate, and add the result to main.cf
$ genkey --days 365 nebula.anekarupatera.lan
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
relay_domains =
home_mailbox = Maildir/

inet_interfaces = all
inet_protocols = all

myhostname = nebula.anekarupatera.lan
mydomain = anekarupatera.lan
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 192.168.110.0/24, 127.0.0.0/8

unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory
#
# Configuring SSL/TLS in postfix
#
broken_sasl_auth_clients = yes
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
#
smtpd_tls_auth_only = no
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
#
tls_random_source = dev:/dev/urandom
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_tls_key_file = /etc/pki/tls/private/nebula.anekarupatera.lan.key
smtpd_tls_cert_file = /etc/pki/tls/certs/nebula.anekarupatera.lan.cert
Start your postfix service
$ /etc/init.d/postfix start
Dovecot Instalation and Configuration
$ yum install dovecot
Edit your dovecot.conf
$mcedit /etc/dovecot/dovecot.conf
And change the following line from
protocols = imap pop3 lmtp
to
protocols = imap pop3
Start your Dovecot service
$ /etc/init.d/dovecot start

No comments: