dovecot-n 输出

dovecot-n 输出

postfix 2.11 是否需要为每个用户或域安装 VDA 补丁配额支持,当 dovecot 2.2.x 用作 imap 服务器时?我使用的是 ubuntu 14.04 LTS 和 postfixadmin 2.3。我很感激任何有用的工作指南。谢谢

dovecot-n 输出

http://pastebin.com/LCPmQ5Th

主配置文件

http://pastebin.com/db6B2uMP

cat dovecot-sql.conf.ext

驱动程序 = mysql 连接 = 主机 = 127.0.0.1 dbname = postfixadmin 用户 = postfixadmin 密码 = XXXXXXXX default_pass_scheme = MD5-CRYPT

password_query = SELECT 用户名作为用户,密码 FROM mailbox WHERE username='%u'; user_query = SELECT maildir AS home,5000 AS uid,5000 AS gid,CONCAT("*:bytes=",quota) AS quote_rule FROM mailbox WHERE username = '%n@%d' AND active=1;

答案1

如果postfix不尝试执行 LDA 本身而是调用 dovecot deliver,那么postfix根本不需要了解配额。

如果您已经使用过postfixadmin虚拟域管理,那么您已经拥有了配额限制所需的一切。您必须修改的dovecotSQL 查询以获取用户的配额:

user_query = SELECT maildir AS home, \
                    26 AS uid, \
                    26 AS gid, \
                    CONCAT("*:bytes=",quota) AS quota_rule \
               FROM mailbox \
              WHERE username = '%n@%d' \
                AND active=1;

(不要盲目复制粘贴该示例,请将其用作模板)

然后你必须在dovecot.conf

更新:

. . . . . .
# this line enable quota plugin!
mail_plugins            = quota

# here is the plugin's configuration
plugin {
  quota                 = maildir:User quota
  quota_rule            = Junk:ignore
  quota_rule2           = Trash:storage=+100M
  quota_warning         = storage=90%% quota-warning 90 %u %d
  quota_warning2        = storage=80%% quota-warning 80 %u %d
  quota_exceeded_message = ERROR:422 - Mailbox full, sorry.
. . . . .
}
. . . . .
service quota-warning {
  executable    = script /path/to/the/overquota.sh
  user          = $mail_uid
  group         = $mail_gid
  unix_listener quota-warning {
    user        = $mail_uid
    group       = $mail_gid
  }
}
. . . . .

overquota.sh看起来应该是这样的:

#!/bin/sh
cat << EOT | /usr/local/libexec/dovecot/dovecot-lda -d $2 -o "plugin/quota=maildir:User quota:noenforcing"
From: postmaster@$3
To: $2
Subject: == Quota warning ==
Content-Type: text/plain; charset="UTF-8"

Your mailbox is $1% full, so clean up your mess, please!

EOT
exit 0
####

当 dovecotdeliver尝试将消息存储到收件箱时,它会检查配额是否已达到预定义阈值 80% 和 90%。如果已达到,则会调用配额警告服务并启动脚本,将警告消息放入邮箱,而无需进一步检查配额。

相关内容