Это старая версия документа.


Сервер Dovecot

Dovecot - это агент доставки почты (MDA), написанный с учетом в первую очередь безопасности. Он поддерживает основные форматы почтовых ящиков: mbox и Maildir. В этом разделе рассматривается как его настроить в качестве imap или pop3 сервера.

Установка

Для установки dovecot, выполните следующую команду в терминале:

sudo apt-get install dovecot-imapd dovecot-pop3d

Настройка

Чтобы настроить dovecot вам потребуется отредактировать файл /etc/dovecot/dovecot.conf. Вы можете выбрать какой протокол использовать. Это может быть pop3, pop3s (безопасный pop3), imap или imaps (безопасный imap). Описание этих протоколов находится за пределами рассматриваемых вопросов данного руководства. Для дополнительной информации обратитесь к статьям Wikipedia по POP3 и IMAP.

IMAPS и POP3S более безопасные чем обычные IMAP и POP3, поскольку используют SSL шифрование для соединения. Как только вы выберете протокол, исправьте следующую строку в файле /etc/dovecot/dovecot.conf:

protocols = pop3 pop3s imap imaps

Далее выберите формат почтового ящика, который вы собираетесь использовать. Dovecot поддерживает форматы maildir и mbox. Они оба имеют свои преимущества, которые обсуждаются на сайте Dovecot.

Once you have chosen your mailbox type, edit the file /etc/dovecot/dovecot.conf and change the following line:

mail_location = maildir:~/Maildir # (for maildir) or mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u # (for 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, restart the dovecot daemon in order to test your setup:

sudo /etc/init.d/dovecot restart

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.

Настройка Dovecot SSL

To configure dovecot to use SSL, you can edit the file /etc/dovecot/dovecot.conf and amend following lines:

ssl_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem ssl_key_file = /etc/ssl/private/ssl-cert-snakeoil.key ssl_disable = no disable_plaintext_auth = no

You can get the SSL certificate from a Certificate Issuing Authority or you can create self signed SSL certificate. The latter is a good option for email, because SMTP clients rarely complain about «self-signed certificates». Please refer to Certificates for details about how to create self signed SSL certificate. Once you create the certificate, you will have a key file and a certificate file. Please copy them to the location pointed in the /etc/dovecot/dovecot.conf configuration file.

Настройка защиты (Firewall) для почтового сервера

To access your mail server from another computer, you must configure your firewall to allow connections to the server on the necessary ports.

  IMAP - 143
  IMAPS - 993
  POP3 - 110
  POP3S - 995

Ссылки

  See the Dovecot website for more information.
  Also, the Dovecot Ubuntu Wiki page has more details.