Skip to content

Commit 8687b1b

Browse files
author
Kristan Kenney
committed
Merge branch 'mail-quota-show'
2 parents 71f74cc + 163f044 commit 8687b1b

File tree

6 files changed

+89
-3
lines changed

6 files changed

+89
-3
lines changed

bin/v-add-mail-account

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ if [[ "$MAIL_SYSTEM" =~ exim ]]; then
6262
if [ "$quota" = 'unlimited' ]; then
6363
quota='0'
6464
fi
65-
str="$account:$md5:$user:mail::$HOMEDIR/$user:$quota"
65+
str="$account:$md5:$user:mail::$HOMEDIR/$user::userdb_quota_rule=*:storage=${quota}M"
6666
echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd
6767
fi
6868

bin/v-change-mail-account-password

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ md5="{MD5}$($BIN/v-generate-password-hash md5 $salt <<<$password)"
5656

5757
if [[ "$MAIL_SYSTEM" =~ exim ]]; then
5858
sed -i "/^$account:/d" $HOMEDIR/$user/conf/mail/$domain/passwd
59-
str="$account:$md5:$user:mail::$HOMEDIR/$user:$quota"
59+
str="$account:$md5:$user:mail::$HOMEDIR/$user::userdb_quota_rule=*:storage=${quota}M"
6060
echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd
6161
fi
6262

bin/v-change-mail-account-quota

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if [[ "$MAIL_SYSTEM" =~ exim ]]; then
5858
quota=0
5959
fi
6060
sed -i "/^$account:/d" $HOMEDIR/$user/conf/mail/$domain/passwd
61-
str="$account:$md5:$user:mail::$HOMEDIR/$user:$quota"
61+
str="$account:$md5:$user:mail::$HOMEDIR/$user::userdb_quota_rule=*:storage=${quota}M"
6262
echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd
6363
fi
6464

install/deb/dovecot/conf.d/20-imap.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ protocol imap {
1414

1515
# Space separated list of plugins to load (default is global mail_plugins).
1616
#mail_plugins = $mail_plugins
17+
mail_plugins = quota imap_quota
1718

1819
# IMAP logout format string:
1920
# %i - total number of bytes read from client

install/deb/dovecot/conf.d/20-pop3.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ protocol pop3 {
7878

7979
# Space separated list of plugins to load (default is global mail_plugins).
8080
#mail_plugins = $mail_plugins
81+
mail_plugins = quota
8182

8283
# Workarounds for various client bugs:
8384
# outlook-no-nuls:
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
##
2+
## Quota configuration.
3+
##
4+
5+
# Note that you also have to enable quota plugin in mail_plugins setting.
6+
# <doc/wiki/Quota.txt>
7+
8+
##
9+
## Quota limits
10+
##
11+
12+
# Quota limits are set using "quota_rule" parameters. To get per-user quota
13+
# limits, you can set/override them by returning "quota_rule" extra field
14+
# from userdb. It's also possible to give mailbox-specific limits, for example
15+
# to give additional 100 MB when saving to Trash:
16+
17+
plugin {
18+
#quota_rule = *:storage=1G
19+
#quota_rule2 = Trash:storage=+100M
20+
21+
# LDA/LMTP allows saving the last mail to bring user from under quota to
22+
# over quota, if the quota doesn't grow too high. Default is to allow as
23+
# long as quota will stay under 10% above the limit. Also allowed e.g. 10M.
24+
#quota_grace = 10%%
25+
26+
# Quota plugin can also limit the maximum accepted mail size.
27+
#quota_max_mail_size = 100M
28+
}
29+
30+
##
31+
## Quota warnings
32+
##
33+
34+
# You can execute a given command when user exceeds a specified quota limit.
35+
# Each quota root has separate limits. Only the command for the first
36+
# exceeded limit is excecuted, so put the highest limit first.
37+
# The commands are executed via script service by connecting to the named
38+
# UNIX socket (quota-warning below).
39+
# Note that % needs to be escaped as %%, otherwise "% " expands to empty.
40+
41+
plugin {
42+
#quota_warning = storage=95%% quota-warning 95 %u
43+
#quota_warning2 = storage=80%% quota-warning 80 %u
44+
}
45+
46+
# Example quota-warning service. The unix listener's permissions should be
47+
# set in a way that mail processes can connect to it. Below example assumes
48+
# that mail processes run as vmail user. If you use mode=0666, all system users
49+
# can generate quota warnings to anyone.
50+
#service quota-warning {
51+
# executable = script /usr/local/bin/quota-warning.sh
52+
# user = dovecot
53+
# unix_listener quota-warning {
54+
# user = vmail
55+
# }
56+
#}
57+
58+
##
59+
## Quota backends
60+
##
61+
62+
# Multiple backends are supported:
63+
# dirsize: Find and sum all the files found from mail directory.
64+
# Extremely SLOW with Maildir. It'll eat your CPU and disk I/O.
65+
# dict: Keep quota stored in dictionary (eg. SQL)
66+
# maildir: Maildir++ quota
67+
# fs: Read-only support for filesystem quota
68+
69+
plugin {
70+
#quota = dirsize:User quota
71+
quota = maildir:User quota
72+
#quota = dict:User quota::proxy::quota
73+
#quota = fs:User quota
74+
}
75+
76+
# Multiple quota roots are also possible, for example this gives each user
77+
# their own 100MB quota and one shared 1GB quota within the domain:
78+
plugin {
79+
#quota = dict:user::proxy::quota
80+
#quota2 = dict:domain:%d:proxy::quota_domain
81+
#quota_rule = *:storage=102400
82+
#quota2_rule = *:storage=1048576
83+
}
84+

0 commit comments

Comments
 (0)