Skip to content

Commit fe87aed

Browse files
sirainencmouse
authored andcommitted
Convert quota settings
1 parent 11b7476 commit fe87aed

File tree

11 files changed

+653
-395
lines changed

11 files changed

+653
-395
lines changed

data/settings.js

Lines changed: 361 additions & 146 deletions
Large diffs are not rendered by default.

data/updates.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const updates = {
5555
process_title_imap_process: '2.4.0',
5656
process_title_initializing: '2.4.0',
5757
process_title_mail_processes: '2.4.0',
58+
quota_maildir_backend_removed: '2.4.0',
5859
service_auth_listener_type: '2.4.0',
5960
service_dict_expire: '2.4.0',
6061
service_listener_type: '2.4.0',

docs/core/config/auth/databases/ldap.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ other means:
393393
```[dovecot.conf]
394394
fields {
395395
user = %{ldap:mailRoutingAddress}
396-
quota_rule = *:storage=%{ldap:messageQuotaHard}
396+
quota_storage_size = %{ldap:messageQuotaHard}B
397397
}
398398
```
399399
:::
@@ -447,15 +447,15 @@ userdb ldap1 {
447447
result_success = continue-ok
448448
fields {
449449
class = %{ldap:userClass}
450-
quota_rule = *:bytes=%{ldap:quotaBytes}
450+
quota_storage_size = %{ldap:quotaBytes}B
451451
}
452452
}
453453
454454
userdb ldap2 {
455455
driver = ldap
456456
skip = notfound
457457
fields {
458-
quota_rule:default = *:bytes=%{ldap:classQuotaBytes}
458+
quota_storage_size:default = %{ldap:classQuotaBytes}B
459459
}
460460
}
461461
```
@@ -561,12 +561,12 @@ You can mix static text with the value returned from LDAP by using
561561

562562
#### Examples
563563

564-
Create a `quota_rule` field with value `*:bytes=<n>` where `<n>` comes
564+
Create a `quota_storage_size` field with value `<n>B` where `<n>` comes
565565
from "quotaBytes" LDAP attribute:
566566

567567
```
568568
fields {
569-
quota_rule = *:bytes=%{ldap:quotaBytes}
569+
quota_storage_size = %{ldap:quotaBytes}B
570570
}
571571
```
572572

@@ -584,7 +584,7 @@ create a "mail_path" field with value `/var/vmail/%d/%n/Maildir`:
584584

585585
```
586586
fields {
587-
quota_rule = *:bytes=%{ldap:quotaBytes}
587+
quota_storage_size = %{ldap:quotaBytes}B
588588
mail_path = /var/vmail/%d/%n/Maildir
589589
}
590590
```

docs/core/config/auth/userdb.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ These fields can be returned the exact same way as `uid`, `gid`, and `home`
120120
fields.
121121

122122
It's also possible to override settings from `dovecot.conf`. For example the
123-
[[setting,mail_path]] and [[setting,quota_rule]] settings are commonly
123+
[[setting,mail_path]] and [[setting,quota_storage_size]] settings are commonly
124124
overridden to provide per-user mail path or quota limit.
125125

126126
The extra fields are also passed to [[link,post_login_scripting]].
@@ -191,14 +191,12 @@ Import `name=value` to mail user event.
191191

192192
### Overriding Settings
193193

194-
Most commonly settings are overridden from plugin section.
195-
196-
For example if your plugin section has `quota_rule=*:storage=100M` value
197-
and the `userdb` lookup returns `quota_rule=*:storage=200M`, the original
194+
For example if you have `quota_storage_size=100M` in `doveconf.conf` and the
195+
`userdb` lookup returns `quota_storage_size=200M`, the original
198196
quota setting gets overridden. In fact, if the lookup always returns a
199-
`quota_rule` field, there's no point in having [[setting,quota_rule]] in
200-
the `dovecot.conf` plugin section at all, because it always gets overridden
201-
anyway.
197+
`quota_storage_size` field, there's no point in having
198+
[[setting,quota_storage_size]] in `dovecot.conf` at all, because it always gets
199+
overridden anyway.
202200

203201
To understand how imap and pop3 processes see their settings, it may be
204202
helpful to know how Dovecot internally passes them:
@@ -230,7 +228,7 @@ The separator setting can be overridden by returning
230228
::: code-group
231229
```[dovecot.conf]
232230
userdb sql {
233-
query = SELECT home, uid, gid, CONCAT('*:bytes=', quota_bytes) AS quota_rule, separator AS "namespace/default/separator" \
231+
query = SELECT home, uid, gid, CONCAT(quota_bytes, 'B') AS quota_storage_size, separator AS "namespace/default/separator" \
234232
FROM users \
235233
WHERE username = '%n' and domain = '%d'
236234
}
@@ -247,7 +245,7 @@ userdb ldap {
247245
home = %{ldap:homeDirectory}
248246
uid = %{ldap:uidNumber}
249247
gid = %{ldap:gidNumber}
250-
quota_rule = *:bytes=%{ldap:quotaBytes}
248+
quota_storage_size = %{ldap:quotaBytes}B
251249
namespace/default/separator = %{ldap:mailSeparator}
252250
}
253251
}
@@ -263,8 +261,8 @@ Note that all `userdb` extra fields must be prefixed with `userdb_`,
263261
otherwise they're treated as [[link,passdb_extra_fields]].
264262

265263
```
266-
user:{plain}pass:1000:1000::/home/user::userdb_mail_driver=mbox userdb_mail_path=~/mail userdb_quota_rule=*:storage=100M userdb_namespace/default/separator=/
267-
user2:{plain}pass2:1001:1001::/home/user2::userdb_mail_driver=maildir userdb_mail_path=~/Maildir userdb_quota_rule=*:storage=200M
264+
user:{plain}pass:1000:1000::/home/user::userdb_mail_driver=mbox userdb_mail_path=~/mail userdb_quota_storage_size=100M userdb_namespace/default/separator=/
265+
user2:{plain}pass2:1001:1001::/home/user2::userdb_mail_driver=maildir userdb_mail_path=~/Maildir userdb_quota_storage_size=200M
268266
```
269267

270268
## See Also

docs/core/config/mailbox/formats/imapc.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ layout: doc
33
title: imapc
44
dovecotlinks:
55
imapc: imapc
6+
imapc_quota:
7+
hash: quota
8+
text: "Imapc: Quota"
69
---
710

811
# Imapc Mailbox Format
@@ -42,13 +45,12 @@ IMAP server. By default it uses `GETQUOTAROOT INBOX` to retrieve the quota.
4245
There are two parameters that can be used to control how the quota is looked
4346
up:
4447

45-
* `box = <mailbox>`: Use `GETQUOTAROOT <mailbox>`
46-
* `root = <name>`: Use `GETQUOTA <name>`
48+
<SettingsComponent tag="quota-imapc" />
4749

48-
Example:
50+
### Example
4951

5052
```
51-
plugin {
52-
quota = imapc:root=User Quota
53+
quota "User Quota" {
54+
driver = imapc
5355
}
5456
```

docs/core/man/doveadm-user.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ userdb: jane
7878
home : /home/jane
7979
mail_path : ~/sdbox
8080
plugins : sieve
81-
quota_rule: \*:storage=150M
81+
quota_storage_size: 150M
8282
8383
8484
home : /srv/mail/8/70312/79832

docs/core/plugins/lazy_expunge.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,12 @@ acl_driver = vfile
7474
lazy_expunge_mailbox = .EXPUNGED
7575
7676
plugin {
77+
# Define ACL so that user cannot list the .EXPUNGED mailbox
78+
acl = vfile:/etc/dovecot/dovecot.acl
79+
}
80+
mailbox .EXPUNGED {
7781
# Expunged messages most likely don't want to be included in quota:
78-
quota_rule = .EXPUNGED:ignore
82+
quota_ignore = yes
7983
}
8084
```
8185

@@ -113,11 +117,12 @@ is hidden from users via ACL).
113117
Example to exclude expunged storage from the quota:
114118

115119
```[dovecot.conf]
116-
plugin {
117-
quota = count:User quota
118-
quota_rule = *:storage=1GB
119-
# Exclude .EXPUNGED mailbox from the quota
120-
quota_rule2 = .EXPUNGED:ignore
120+
quota "User quota" {
121+
quota_storage_size = 1GB
122+
}
123+
mailbox .EXPUNGED {
124+
# Exclude .EXPUNGED mailbox from the quota
125+
quota_ignore = yes
121126
}
122127
```
123128

0 commit comments

Comments
 (0)