Я пытаюсь настроить dovecot для работы с ограничениями квот.
Я следовал руководству и настраивал правильные шаги. Я даже сравнил их с нашим текущим почтовым сервером.
Проблема в том, что Dovecot не записывает в таблицу quota2 в нашей базе данных. Я проверил журналы mysql и файл maillog (расположение журнала dovecot), но не вижу никаких ошибок в отношении квоты. Все остальные запросы работают отлично. Также выбирается квота в таблице пользователей.
У кого-нибудь есть ключ? Что мне не хватает?
Dovecot -n вывод:
# 2.0.9: /etc/dovecot/dovecot.conf
# OS: Linux 3.14.35-28.38.amzn1.x86_64 x86_64 ext4
auth_mechanisms = plain login
dict {
quotadict = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
}
mail_location = maildir:/var/spool/mail/virtual/%d/%n
mail_plugins = quota
mail_privileged_group = mail
mbox_write_locks = fcntl
passdb {
args = /etc/dovecot/conf.d/dovecot-sql.conf.ext
driver = sql
}
plugin {
quota = dict:user::proxy::quotadict
}
service auth-worker {
user = vmail
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
}
user = dovecot
}
service imap-login {
inet_listener imap {
port = 143
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
ssl_ca = </root/ssl/root-cert.pem
ssl_cert = </root/ssl/private-cert.pem
ssl_key = </root/ssl/private-key.pem
userdb {
args = /etc/dovecot/conf.d/dovecot-sql.conf.ext
driver = sql
}
protocol lda {
mail_plugins = quota
}
protocol imap {
mail_plugins = quota imap_quota imap_quota
}
protocol pop3 {
mail_plugins = quota
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
dovecot-sql.conf.ext:
password_query = SELECT email as user, password FROM users WHERE email='%u';
user_query = \
SELECT CONCAT('/var/spool/mail/virtual/',CONCAT(SUBSTRING_INDEX(email,'@',-1),'/', \
SUBSTRING_INDEX(email,'@',1))) AS home, \
5001 AS uid, \
5001 AS gid, \
CONCAT('maildir:storage=',quota) AS quota \
FROM users WHERE email='%u' \
AND enabled = '1';
dovecot / dovecot-dict-sql.conf.ext:
map {
pattern = priv/quota/storage
table = quota2
username_field = username
value_field = bytes
}
map {
pattern = priv/quota/messages
table = quota2
username_field = username
value_field = messages
}
ОБНОВИТЬ:
Файлы журнала (без amavis)
May 8 10:03:47 host dovecot: master: Warning: Killed with signal 15 (by pid=18369 uid=0 code=kill)
May 8 10:03:47 host dovecot: imap: Server shutting down. bytes=9721/22462
May 8 10:03:47 host dovecot: imap: Server shutting down. bytes=4471/11038
May 8 10:03:47 host dovecot: imap: Server shutting down. bytes=4663/11356
May 8 10:03:47 host dovecot: imap: Server shutting down. bytes=8663/23549
May 8 10:03:48 host dovecot: master: Dovecot v2.0.9 starting up (core dumps disabled)
May 8 10:03:48 host dovecot: ssl-params: Generating SSL parameters
May 8 10:03:50 host dovecot: ssl-params: SSL parameters regeneration completed
May 8 10:03:55 host dovecot: auth: mysql: Connected to 127.0.0.1 (mail)
May 8 10:04:47 host dovecot: imap-login: Login: user=<test@jouwweb.email>, method=PLAIN, rip=80.113.202.232, lip=172.31.18.109, mpid=18399, TLS
May 8 10:04:47 host dovecot: imap: Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:04:47 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:04:47 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so
May 8 10:04:47 host dovecot: imap: Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:04:47 host dovecot: imap(test@jouwweb.email): Debug: Effective uid=5001, gid=5001, home=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:47 host dovecot: imap(test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:04:47 host dovecot: imap(test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:49 host dovecot: imap-login: Login: user=<test@jouwweb.email>, method=PLAIN, rip=80.113.202.232, lip=172.31.18.109, mpid=18402, TLS
May 8 10:04:49 host dovecot: imap: Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:04:49 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:04:49 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so
May 8 10:04:49 host dovecot: imap: Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:04:49 host dovecot: imap(test@jouwweb.email): Debug: Effective uid=5001, gid=5001, home=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:49 host dovecot: imap(test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:04:49 host dovecot: imap(test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:51 host dovecot: imap-login: Login: user=<test@jouwweb.email>, method=PLAIN, rip=80.113.202.232, lip=172.31.18.109, mpid=18404, TLS
May 8 10:04:51 host dovecot: imap: Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:04:51 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:04:51 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so
May 8 10:04:51 host dovecot: imap: Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:04:51 host dovecot: imap(test@jouwweb.email): Debug: Effective uid=5001, gid=5001,
May 8 10:03:47 host dovecot: master: Warning: Killed with signal 15 (by pid=18369 uid=0 code=kill)
May 8 10:03:47 host dovecot: imap: Server shutting down. bytes=9721/22462
May 8 10:03:47 host dovecot: imap: Server shutting down. bytes=4471/11038
May 8 10:03:47 host dovecot: imap: Server shutting down. bytes=4663/11356
May 8 10:03:47 host dovecot: imap: Server shutting down. bytes=8663/23549
May 8 10:03:48 host dovecot: master: Dovecot v2.0.9 starting up (core dumps disabled)
May 8 10:03:48 host dovecot: ssl-params: Generating SSL parameters
May 8 10:03:50 host dovecot: ssl-params: SSL parameters regeneration completed
May 8 10:03:55 host dovecot: auth: mysql: Connected to 127.0.0.1 (mail)
May 8 10:04:47 host dovecot: imap-login: Login: user=<test@jouwweb.email>, method=PLAIN, rip=80.113.202.232, lip=172.31.18.109, mpid=18399, TLS
May 8 10:04:47 host dovecot: imap: Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:04:47 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:04:47 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so
May 8 10:04:47 host dovecot: imap: Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:04:47 host dovecot: imap(test@jouwweb.email): Debug: Effective uid=5001, gid=5001, home=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:47 host dovecot: imap(test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:04:47 host dovecot: imap(test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:49 host dovecot: imap-login: Login: user=<test@jouwweb.email>, method=PLAIN, rip=80.113.202.232, lip=172.31.18.109, mpid=18402, TLS
May 8 10:04:49 host dovecot: imap: Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:04:49 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:04:49 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so
May 8 10:04:49 host dovecot: imap: Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:04:49 host dovecot: imap(test@jouwweb.email): Debug: Effective uid=5001, gid=5001, home=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:49 host dovecot: imap(test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:04:49 host dovecot: imap(test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:51 host dovecot: imap-login: Login: user=<test@jouwweb.email>, method=PLAIN, rip=80.113.202.232, lip=172.31.18.109, mpid=18404, TLS
May 8 10:04:51 host dovecot: imap: Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:04:51 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:04:51 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so
May 8 10:04:51 host dovecot: imap: Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:04:51 host dovecot: imap(test@jouwweb.email): Debug: Effective uid=5001, gid=5001, home=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:51 host dovecot: imap(test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:04:51 host dovecot: imap(test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:53 host dovecot: imap-login: Login: user=<test@jouwweb.email>, method=PLAIN, rip=80.113.202.232, lip=172.31.18.109, mpid=18406, TLS
May 8 10:04:53 host dovecot: imap: Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:04:53 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:04:53 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so
May 8 10:04:53 host dovecot: imap: Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:04:53 host dovecot: imap(test@jouwweb.email): Debug: Effective uid=5001, gid=5001, home=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:53 host dovecot: imap(test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:04:53 host dovecot: imap(test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:06:06 host dovecot: lmtp(18427): Debug: none: root=, index=, control=, inbox=
May 8 10:06:06 host dovecot: lmtp(18427): Connect from local
May 8 10:06:06 host dovecot: lmtp(18427): Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:06:06 host dovecot: lmtp(18427): Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:06:06 host dovecot: lmtp(18427): Debug: auth input: test@jouwweb.email home=/var/spool/mail/virtual/jouwweb.email/test uid=5001 gid=5001 quota=maildir:storage=10
May 8 10:06:06 host dovecot: lmtp(18427): Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:06:06 host dovecot: lmtp(18427, test@jouwweb.email): Debug: Effective uid=5001, gid=5001, home=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:06:06 host dovecot: lmtp(18427, test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:06:06 host dovecot: lmtp(18427, test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:06:06 host dovecot: lmtp(18427, test@jouwweb.email): 9nRZJ46KTFX7RwAAx8Xrpw: msgid=<26D1B8E0-9451-4EEB-B79E-A530F6236DE0@me.com>: saved mail to INBOX
May 8 10:06:06 host dovecot: lmtp(18427): Disconnect from local: Client quit
May 8 10:04:51 host dovecot: imap(test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:04:51 host dovecot: imap(test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:53 host dovecot: imap-login: Login: user=<test@jouwweb.email>, method=PLAIN, rip=80.113.202.232, lip=172.31.18.109, mpid=18406, TLS
May 8 10:04:53 host dovecot: imap: Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:04:53 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:04:53 host dovecot: imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so
May 8 10:04:53 host dovecot: imap: Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:04:53 host dovecot: imap(test@jouwweb.email): Debug: Effective uid=5001, gid=5001, home=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:04:53 host dovecot: imap(test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:04:53 host dovecot: imap(test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:06:06 host dovecot: lmtp(18427): Debug: none: root=, index=, control=, inbox=
May 8 10:06:06 host dovecot: lmtp(18427): Connect from local
May 8 10:06:06 host dovecot: lmtp(18427): Debug: Loading modules from directory: /usr/lib64/dovecot
May 8 10:06:06 host dovecot: lmtp(18427): Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
May 8 10:06:06 host dovecot: lmtp(18427): Debug: auth input: test@jouwweb.email home=/var/spool/mail/virtual/jouwweb.email/test uid=5001 gid=5001 quota=maildir:storage=10
May 8 10:06:06 host dovecot: lmtp(18427): Debug: Added userdb setting: plugin/quota=maildir:storage=10
May 8 10:06:06 host dovecot: lmtp(18427, test@jouwweb.email): Debug: Effective uid=5001, gid=5001, home=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:06:06 host dovecot: lmtp(18427, test@jouwweb.email): Debug: Quota root: name=storage=10 backend=maildir args=
May 8 10:06:06 host dovecot: lmtp(18427, test@jouwweb.email): Debug: maildir++: root=/var/spool/mail/virtual/jouwweb.email/test, index=, control=, inbox=/var/spool/mail/virtual/jouwweb.email/test
May 8 10:06:06 host dovecot: lmtp(18427, test@jouwweb.email): 9nRZJ46KTFX7RwAAx8Xrpw: msgid=<26D1B8E0-9451-4EEB-B79E-A530F6236DE0@me.com>: saved mail to INBOX
May 8 10:06:06 host dovecot: lmtp(18427): Disconnect from local: Client quit
Если вас интересует журнал с включенными amavis, проверьте файл gist ниже: https://gist.github.com/jordi12100/f14842f724d62a47c570
ОБНОВЛЕНИЕ 2 (спасибо Fox): квота обновляется. Однако почта не блокируется, когда я превышаю свой лимит. Текущий лимит составляет 10 КБ, и я его превысил после того, как отправил пару сообщений. Отсутствуют какие-либо настройки?
Небольшое предположение, основанное на сравнении вашей конфигурации с моим.
CONCAT('maildir:storage=',quota) AS quota
скорее должно быть CONCAT('maildir:storage=',quota) AS quota_rule
Я думаю, вы игнорируете quota=
настройка из конфигурации, путем записи для каждого пользователя. (Но я не эксперт, так что на самом деле только предположение)
Не помню почему, но мой запрос квоты concat('*:storage=', quota) as quota_rule
, если это как-то поможет ...
Изменить: я думаю, что он будет доставлен, потому что вы используете lmtp, но для lmtp не включена квота. Вам нужно что-то вроде меня:
protocol lmtp {
mail_plugins = quota fts fts_solr sieve
}