Wednesday, February 13, 2013

IMAP on Oracle Linux 6

Hi there,

To enable IMAP on Oracle Linux 6, the steps are pretty simple.
  • Configure postfix. Edit /etc/postfix/main.cf
uncomment home_mailbox = Maildir/
add to the end of the main.cf file :
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
  •  restart service
#service postfix restart
  • Install dovecot
# yum install dovecot
  • enable the imap service
# vi /etc/dovecot/dovecot.conf
change from:
#protocols = imap pop3 lmtp 
to:
protocols = imap
  • edit /etc/dovecot/10-mail.conf
#vi /etc/dovecot/10-mail.conf
add
mail_location = maildir:~/Maildir
  • edit /etc/dovecot/conf.d/10-master.conf
change from:
unix_listener auth-userdb {
#mode = 0600
#user =
#group =
}
to
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
  •  edit /etc/dovecot/conf.d/10-auth.conf
# vi /etc/dovecot/conf.d/10-auth.conf 
disable_plaintext_auth = no 
auth_mechanisms = plain login 
  • check the status of the sevice
 [root@ol6 ~]# chkconfig --list dovecot
dovecot         0:off 1:off 2:off 3:off 4:off 5:off 6:off
  • enable it in case it was off
 [root@ol6 ~]# chkconfig dovecot on
  • start the service 
 [root@ol6 ~]# service dovecot start
Starting Dovecot Imap:                                     [  OK  ]
  • check the service is listening on imap port.. tcp 143 for imap, tcp 993 for imaps
[root@ol6 ~]# netstat -anp | egrep ':143|:993'
tcp        0      0 0.0.0.0:993                 0.0.0.0:*                   LISTEN      26394/dovecot    
tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      26394/dovecot    
tcp        0      0 :::993                      :::*                        LISTEN      26394/dovecot    
tcp        0      0 :::143                      :::*                        LISTEN      26394/dovecot    
  • configure the firewall to allow incoming connections to 143 and 993 tcp if you have iptables running
  • done!
Now, let's test the system is running.

Dovecot will use a combination of user and password, so will check access for oracle user
  • send a test email to our user
# echo test | mail -s test oracle
  • install mutt mail client
#yum install mutt
  • set a password to a user, in order to test if you don't have a password yet
#passwd oracle
  • test dovecot imap
#mutt -f imap://server/user
  •  accept the certificate
(r)eject, accept (o)nce, (a)ccept always 

Done. 
Ok, not so simple, but pretty straightforward.

Dedicated to my friends on tcs india.

Alvaro.



No comments:

Post a Comment