postfix 2.11 是否需要針對每個使用者或網域使用 VDA 修補程式進行修補配額支持,當 dovecot 2.2.x 用作 imap 伺服器?我使用 ubuntu 14.04 LTS 和 postfixadmin 2.3。我感謝任何有用的工作指南。謝謝
dovecot -n 輸出
大師.cf
貓 dovecot-sql.conf.ext
驅動程式 = mysql 連線 = 主機 = 127.0.0.1 dbname = postfixadmin 使用者 = postfixadmin 密碼 = XXXXXXX default_pass_scheme = MD5-CRYPT
password_query = SELECT 使用者名稱為用戶,密碼來自郵件信箱 WHERE username='%u'; user_query = SELECT maildir AS home,5000 AS uid,5000 AS gid, CONCAT("*:bytes=",quota) ASquota_rule FROM 信箱 WHERE username = '%n@%d' AND active=1;
答案1
如果postfix
不嘗試執行 LDA 本身並呼叫 dovecot deliver
,則postfix
根本不需要了解配額。
如果您已用於postfixadmin
虛擬網域管理,那麼您已經擁有配額限制所需的一切。您必須修改 的dovecot
SQL 查詢來取得使用者的配額:
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%,或是否達到。如果是這樣,則呼叫配額警告服務並啟動腳本,將警告訊息放入郵箱中,而無需進一步檢查配額。