Dovecot är en Mail Delivery Agent som är skriven med största fokus på säkerhet. Den stöder de vanligaste mailbox-formaten: mbox och maildir. Den här avdelningen förklarar hur du ställer in det för att bli en imap- eller pop3-server.
Kör följande kommando i en terminalpromt för att installera dovecot:
sudo apt-get install dovecot-common dovecot-imapd dovecot-pop3d
För att konfigurera dovecot kan du ändra på filen /etc/dovecot/dovecot.conf
. Du kan välja vilket protokoll du vill använda. Det kan vara pop3, pop3s (säker pop3), imap och imaps (säker imap). Den här guiden kommer inte att ta upp skillnaden på dessa protokoll. För mer information, läs wikipediaartiklarna om POP3 och 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.
När du har valt mailbox-typ, ändra på filen /etc/dovecot/dovecot.conf
och ändra följande rad:
default_mail_env = maildir:~/Maildir # (för maildir) eller default_mail_env = mbox:~/mail:INBOX=/var/spool/mail/%u # (för 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.
För att få dovecot att använda SSL kan du ändra på filen /etc/dovecot/dovecot.conf
och lägga till följande rader:
ssl_cert_file = /etc/ssl/certs/dovecot.pem ssl_key_file = /etc/ssl/private/dovecot.pem ssl_disable = no disable_plaintext_auth = no
Filerna cert och key skapas automatiskt av dovecot när du installerar det. Notera att de här nycklarna inte är signerade och kommer att orsaka "felaktig signatur"-fel hos klienten när den ansluter. För att undvika det här kan du använda komerciella certifikat eller, ännu bättre, dina egna SSL-certifikat.