Dovecot Server

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

Установка

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

sudo apt-get install dovecot-common dovecot-imapd dovecot-pop3d

Конфигурация

Для настройки dovecot вы можете отредактировать файл /etc/dovecot/dovecot.conf. Вы можете выбрать протокол, который будете использовать. Возможные варианты: pop3, pop3s (pop3 secure), imap и imaps (imap secure). Описание этих протоколов выходит за пределы данного руководства. Для дальнейшей информации посетите статьи в википедиа ulink url="http://en.wikipedia.org/wiki/POP3">POP3

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.

Выбрав тип почтового ящика, отредактируйте файл /etc/dovecot/dovecot.conf и измените следующую линию:

mail_location = maildir:~/Maildir # (for maildir)
or
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u # (for mbox)
[Замечание]

Вы должны настроить своего почтового агента (MTA, Mail Transport Agent) для передачи входящей почты на почтовый ящик этого типа, если он отличен от того, который вы уже настроили.

После установки dovecot, запустите демон dovecot для проверки правильности установки:

          
            sudo /etc/init.d/dovecot start
          
        

. Если у вас включены imap или pop3, вы также можете попытаться присоединиться к ним с помощью команд telnet localhost pop3 или telnet localhost imap2. Если вы увидели что-то похожее на то, что ниже, то установка завершена успешно:

bhuvan@rainbow:~$ telnet localhost pop3
Пытаемся 127.0.0.1...
Соединился с localhost.localdomain.
Клавиша возврата '^]'.
+OK Dovecot готов.

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. Please refer to «Создание сертификата со своей подписью» 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.

Настройка брандмауэра для почтового сервера

Для доступа к вашему почтовому серверу с другого компьютера вы должны настроить брандмауер на разрешение соединений по необходимым портам.

  • IMAP - 143

  • IMAPS - 993

  • POP3 - 110

  • POP3S - 995