Product SiteDocumentation Site

43.4.2. Настройка Dovecot

Установить Dovecot:
# apt-get install dovecot
Изменить файлы для домена test.alt:
  • создать файл /etc/dovecot/dovecot-ldap.conf.ext:
    hosts            = test.alt:3268
    ldap_version     = 3
    auth_bind        = yes
    dn               = cn=vmail,cn=Users,dc=test,dc=alt
    dnpass           = Pa$$word
    base             = cn=Users,dc=test,dc=alt
    scope            = subtree
    deref            = never
    
    user_filter = (&(objectClass=user)(|(mail=%Lu)(sAMAccountName=%Lu)))
    user_attrs  = =uid=8,gid=12,mail=user
    pass_filter = (&(objectClass=user)(|(mail=%Lu)(sAMAccountName=%Lu)))
    pass_attrs = mail=user
    
  • привести файл /etc/dovecot/conf.d/10-auth.conf к виду:
    auth_mechanisms = plain
    !include auth-ldap.conf.ext
    
  • изменить файл /etc/dovecot/conf.d/10-mail.conf:
    mail_location = maildir:/var/mail/%d/%n:UTF-8:INBOX=/var/mail/%d/%n/Inbox
    mail_uid = mail
    mail_gid = mail
    first_valid_uid = 5
    first_valid_gid = 5
    
  • изменить файл /etc/dovecot/conf.d/10-master.conf:
    service imap-login {
      inet_listener imap {
        port = 0
      }
      inet_listener imaps {
      }
    }
    service pop3-login {
      inet_listener pop3 {
        port = 0
      }
      inet_listener pop3s {
        port = 0
      }
    }
    service lmtp {
      unix_listener lmtp {
      }
    }
    service imap {
    }
    service pop3 {
    }
    service auth {
      unix_listener auth-userdb {
      }
      unix_listener /var/spool/postfix/private/auth {
        mode = 0600
        user = postfix
        group = postfix
      }
    }
    service auth-worker {
    }
    service dict {
      unix_listener dict {
      }
    }
    
  • изменить файл /etc/dovecot/conf.d/15-lda.conf:
    protocol lda {
      hostname = test.alt
      postmaster_address = administrator@test.alt
    }
    
  • изменить файл /etc/dovecot/conf.d/15-mailboxes.conf:
    namespace inbox {
      inbox = yes
      mailbox Drafts {
        auto = subscribe
        special_use = \Drafts
      }
      mailbox Junk {
        auto = subscribe
        special_use = \Junk
      }
      mailbox Trash {
        auto = subscribe
        special_use = \Trash
      }
      mailbox Sent {
        auto = subscribe
        special_use = \Sent
      }
      mailbox "Sent Messages" {
        special_use = \Sent
      }
    }
    
  • создать файл /etc/dovecot/conf.d/10-stats.conf:
    service stats {
        unix_listener stats-reader {
            user = mail
            group = mail
            mode = 0660
        }
    
        unix_listener stats-writer {
            user = mail
            group = mail
            mode = 0660
        }
    }
    
  • перезапустить службу dovecot:
    # systemctl restart dovecot
    
Проверка конфигурации Dovecot (в выводе не должно быть никаких сообщений):
# doveconf >/dev/null