Dovecot é um Agente de Entrega de Correio Electrónico, escrito principalmente com a preocupação da segurança em mente. Suporta os principais formatos de caixas de correio: mbox ou Maildir. Esta secção exemplifica como configurá-lo como servidor imap ou pop3.
Para instalar dovecot, execute o comando seguinte numa linha de comandos:
sudo apt-get install dovecot-common dovecot-imapd dovecot-pop3d
Para configurar dovecot, edite o ficheiro /etc/dovecot/dovecot.conf
. Pode escolher o protocolo a utilizar. Nomeadamente, pop3, pop3s (pop3 seguro), imap e imaps (imap seguro). Uma descrição destes protocolos está para além dos objectivos deste guia. Para mais informação, consulte os artigos wikipedia em POP3 e IMAP.
IMAPS and POP3S are more secure that the simple IMAP and
POP3 because they use SSL encryption to connect. Once you
have chosen the protocol, amend the following line in the file
/etc/dovecot/dovecot.conf
:
protocols = pop3 pop3s imap imaps
It enables the protocols when dovecot is started. Next, add the following line in the pop3 section of the file /etc/dovecot/dovecot.conf
:
pop3_uidl_format = %08Xu%08Xv
Next, choose the mailbox you use. Dovecot supports maildir and mbox formats. These are the most commonly used mailbox formats. They both have their own benefits and they are discussed on the dovecot website.
Uma vez escolhido o tipo de caixa de correio, edite o ficheiro /etc/dovecot/dovecot.conf
e altere a linha seguinte:
default_mail_env = maildir:~/Maildir # (para o maildir) or default_mail_env = mbox:~/mail:INBOX=/var/spool/mail/%u # (para mbox)
![]() |
|
You should configure your Mail Transport Agent (MTA) to transfer the incoming mail to this type of mailbox if it is different from the one you have configured. |
Once you have configured dovecot, start the dovecot daemon in order to test your setup:
sudo /etc/init.d/dovecot start
If you have enabled imap, or pop3, you can also try to log in with the commands telnet localhost pop3 or telnet localhost imap2. If you see something like the following, the installation has been successful:
bhuvan@rainbow:~$ telnet localhost pop3 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. +OK Dovecot ready.
Para configurar o dovecot para utilizar SSL, pode editar o ficheiro /etc/dovecot/dovecot.conf
e corrija as seguintes linhas:
ssl_cert_file = /etc/ssl/certs/dovecot.pem ssl_key_file = /etc/ssl/private/dovecot.pem ssl_disable = no disable_plaintext_auth = no
Os ficheiros cert e key são gerados automaticamente pelo dovecot quando o instala. Por favor note que estas chaves não são assinadas e darão erros "bad signature" quando se ligar de um cliente. Para evitar isso, pode utilizar certificados comerciais, ou ainda melhor, pode utilizar os seus próprios certificados SSL.