Почтовый сервер в связке Postfix, Dovecot, MySQL

Материал из megapuper
Версия от 20:51, 3 декабря 2013; Root (обсуждение | вклад) (Новая страница: «Рихтуем конфиг dovecot.conf: base_dir = /var/run/dovecot/ disable_plaintext_auth = no shutdown_clients = yes ### LOG ### syslog_facility = ma…»)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Рихтуем конфиг dovecot.conf:

base_dir = /var/run/dovecot/
disable_plaintext_auth = no
shutdown_clients = yes
 
### LOG ###
syslog_facility = mail
auth_verbose=yes
auth_debug=yes
auth_debug_passwords=yes
mail_debug=yes

log_path=/var/log/dovecot-info.log
info_log_path=/var/log/dovecot.log
 
#####################
login_dir = /var/run/dovecot/login
login_chroot = yes
login_user = dovecot
login_process_size = 64
login_process_per_connection = yes
login_processes_count = 5
mail_location = maildir:/var/spool/mail/%u
mail_uid = virtual
mail_gid = virtual
mail_privileged_group = mail
dotlock_use_excl = yes
verbose_proctitle = yes
first_valid_uid = 1981
last_valid_uid = 1981
first_valid_gid = 1981
last_valid_gid = 1981
maildir_copy_with_hardlinks = yes
 
### PROTOCOLS ###
protocols = imap pop3
 
protocol imap {
  listen = *:143
  #ssl_listen =*:993
  #mail_plugins = autocreate expire # quota imap_quota
  imap_client_workarounds = delay-newmail netscape-eoh tb-extra-mailbox-sep
}

protocol pop3 {
  listen = *:110
  #ssl_listen =*:995
  pop3_uidl_format = %08Xu%08Xv
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
  #mail_plugins = expire # quota
}

protocol lda {
  postmaster_address = postmaster@megapuper.ru
  sendmail_path = /usr/sbin/sendmail
  #mail_plugins = sieve #expire  quota
  mail_plugin_dir = /usr/local/lib/dovecot/lda
}

###  AUTH  ###
auth_username_format = %Lu
auth default {
  mechanisms = plain login
  passdb sql {
    args = /usr/local/etc/dovecot-sql.conf
  }
  userdb sql {
    args = /usr/local/etc/dovecot-sql.conf
  }
  user = nobody #virtual
  socket listen {
    master {
      path = /var/run/dovecot/auth-master
      mode = 0666
    }
    client {
      path = /var/run/dovecot/auth
      mode = 0660
      user = postfix
      group = postfix
    }
  }
}
 
### PLUGINS ###
#dict {
#  expire = mysql:/usr/local/etc/dovecot-dict-expire.conf
#}
plugin {
#  sieve=/home/spool/mail/%d/%u/sieve/dovecot.sieve
#  sieve_dir=/home/spool/mail/%d/%u/sieve
  
#  autocreate = Trash
#  autocreate2 = Junk
#  autocreate3 = Drafts
#  autocreate4 = Sent
#  autocreate5 = Прочитано
#  autosubscribe = Trash
#  autosubscribe2 = Junk
#  autosubscribe3 = Drafts
#  autosubscribe4 = Sent
#  autosubscribe5 = Прочитано
#  expire = Trash 1 Spam 30
#  expire_dict = proxy::expire
  auth_socket_path = /var/run/dovecot/auth-master
}
 
### SSL ###
ssl=no
ssl_cert_file = /etc/ssl/certs/dovecot.pem
ssl_key_file = /etc/ssl/private/dovecot.pem  

Создаём конфиг dovecot-sql.conf:

driver = mysql
connect = host=localhost dbname=postfix user=postfix password='пароль'
default_pass_scheme = PLAIN
password_query = SELECT `username` as `user`, `password` FROM  \
`mailbox` WHERE `username` = '%n@%d' AND `active`='1'
user_query = SELECT CONCAT('/var/spool/mail/',maildir) AS `home`, 1981 AS `uid`, 1981 AS `gid` \
FROM `mailbox` WHERE `username` = '%n@%d' AND `active`='1'