~ubuntu-branches/ubuntu/lucid/dovecot/lucid-security

« back to all changes in this revision

Viewing changes to doc/wiki/Quota.Dict.txt

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Ante Karamatic, Mathias Gug
  • Date: 2009-02-12 21:45:09 UTC
  • mfrom: (1.10.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20090212214509-8fp69kpkzf03j5xg
Tags: 1:1.1.11-0ubuntu1
[ Ante Karamatic ]
  Add new binary pkg dovecot-postfix that integrates postfix and dovecot
  automatically: (LP: #164837)
  - debian/control:
    + add new binary with short description.
  - debian/dovecot-postfix.postinst:
    + create initial certificate symlinks to snakeoil.
    + set up postfix with postconf to:
      - use Maildir/ as the default mailbox.
      - use dovecot as the sasl authentication  server.
      - use dovecot LDA (deliver).
      - use tls for smtp{d} services.
    + restart postfix and dovecot.
  - debian/dovecot-postfix.postrm:
    + remove all dovecot related configuration from postfix.
    + restart postfix and dovecot.
  - debian/dovecot-common.init:
    + check if /etc/dovecot/dovecot-postfix.conf exists and use it
      as the configuration file if so.
  - debian/patches/warning-ubuntu-postfix.dpatch
    + add warning about dovecot-postfix.conf in dovecot default 
      configuration file.
  - debian/patches/dovecot-postfix.conf.diff:
    + Ubuntu server custom changes to the default dovecot configuration for
      better integration with postfix:
      - enable imap, pop3, imaps, pop3s and managesieve by default.
      - enable dovecot LDA (deliver).
      - enable SASL auth socket in postfix private directory.
  - debian/rules:
    + copy, patch and install dovecot-postfix.conf in /etc/dovecot/.
  
[ Mathias Gug ]
* New upstream release:
* Update dovecot-managesieve to 0.10.5. Fixes:
  - check if names of sieve scripts contain '/' (LP: #307291)
* Update dovecot-managesieve patch for 1.1.11 and 0.10.5.
* Update dovecot-sieve plugin to 1.1.6.
* Merge from debian experimental, remaining changes:
  - Use Snakeoil SSL certificates by default.
    + debian/control: Depend on ssl-cert
    + debian/paptches/ssl-cert-snakeoil.dpatch: Change default SSL cert 
      paths to snakeoil.
    + debian/dovecot-common.postinst: Relax grep for SSL_* a bit.
  - Add autopkgtest in debian/tests/*.
  - debian/dovecot-common.init: Check to see if there is an /etc/inetd.conf.
    (LP: #208411)
  - Fast TearDown: Update lsb init header to not stop in level 6.
  - Add status action to the init script:
    + debian/control: Depend on lsb >= 3.2.12ubuntu3.
    + debian/dovecot-common-init: Add the 'status' action (LP: #247096).
  - debian/rules:
    - Copy config.{guess,sub} after running libtoolize.
    - Clean dovecot-managesieve directory.
  - Add ufw integration: 
    - Created debian/dovecot-common.ufw.profile
    - debian/rules:
      + install profile
    - debian/control
      + Suggest ufw
  - debian/{control,rules}: enable PIE hardening.
  - Updated dovecot.common.README.Debian with information on what has changed 
    between 1.0 and 1.1.1. Fixes (LP: #257625) 
  - dovecot-imapd, dovecot-pop3: Replaces dovecot-common (<< 1:1.1). LP: #254721.
  - debian/control:
    + Update Vcs-* headers.
* debian/rules:
  - Create emtpy stamp.h.in files in dovecot-sieve/ and dovecot-managesieve/
    if they're not there since empty files are not included in the diff.gz 
    file.
* Dropped:
  - debian/patches/fix-message-parser.dpatch: Parsing an invalid message
    address like "From: (" caused an assert-crash. (LP: #290901).
    (CVE-2008-4907 - fixed in 1.1.6)
  - debian/patches/login-max-process-count-warning.dpatch: Tell the user 
    that they have reached the maximum number of processes count.
    (LP: #189616) - Different implementation from upstream.
  - debian/patches/fix-dovecot-sieve.dpatch: Fixes assertion error
    when a header string ends with a LF (LP: #264306). Implemented upstream.
  - Don't fail in postinst if dovecot-{sql,ldap} is missing. (LP: #153161)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
================
3
3
 
4
4
The /dictionary/ quota backend supports both *storage* and *messages* quota
5
 
limits. The current quota is kept in a dictionary. Currently the only supported
6
 
dictionary backend is MySQL.
7
 
 
8
 
The plugin parameter format is 'dict:<quota limits> <dictionary URI>'. For
9
 
example:
10
 
 
11
 
---%<-------------------------------------------------------------------------
 
5
limits. The current quota is kept in a dictionary. The available dictionaries
 
6
are:
 
7
 
 
8
 * MySQL (v1.0+)
 
9
 * PostgreSQL (v1.1.2+)
 
10
 * Flat file (v1.2.alpha3+)
 
11
 
 
12
The plugin parameter format is:
 
13
 
 
14
---%<-------------------------------------------------------------------------
 
15
# v1.0:
 
16
quota = dict:<quota limits> <dictionary URI>
 
17
# v1.1+:
 
18
quota = dict:<quota root name>:<user name>:<dictionary URI>
 
19
---%<-------------------------------------------------------------------------
 
20
 
 
21
If user name is left empty, the logged in username is used (this is probably
 
22
what you want).
 
23
 
 
24
v1.0 & v1.1
 
25
-----------
 
26
 
 
27
Example:
 
28
 
 
29
---%<-------------------------------------------------------------------------
 
30
dict {
 
31
  quotadict = mysql:/etc/dovecot-dict-quota.conf
 
32
}
 
33
 
12
34
plugin {
13
35
  # v1.0: 10MB and 1000 messages quota limit
14
 
  quota = dict:storage=10240:messages=1000 mysql:/etc/dovecot-dict-quota.conf
15
 
  # v1.1:
16
 
  quota = dict mysql:/etc/dovecot-dict-quota.conf
 
36
  quota = dict:storage=10240:messages=1000 proxy::quotadict
 
37
 
 
38
  # v1.1 + MySQL:
 
39
  quota = dict:user::proxy::quotadict
17
40
  quota_rule = *:storage=10M:messages=1000
18
41
}
19
42
---%<-------------------------------------------------------------------------
20
43
 
21
 
However, *the above example won't really work*. This is because it would
22
 
require linking all the binaries with MySQL library, which I didn't really want
23
 
to do. Currently you'll have to do this via the dictionary proxy (see below).
24
 
Actually the performance is better that way anyway, and I don't really see a
25
 
reason not to use it.
 
44
The above example uses dictionary proxy process (see below), because SQL
 
45
libraries aren't linked to all Dovecot binaries.
26
46
 
27
47
Example 'dovecot-dict-quota.conf':
28
48
 
29
49
---%<-------------------------------------------------------------------------
 
50
# v1.0 and v1.1 only - v1.2 has different configuration
30
51
connect = host=localhost dbname=mails user=sqluser password=sqlpass
31
52
table = quota
32
53
select_field = current
45
66
);
46
67
---%<-------------------------------------------------------------------------
47
68
 
 
69
v1.2+
 
70
-----
 
71
 
 
72
---%<-------------------------------------------------------------------------
 
73
dict {
 
74
  quotadict = mysql:/etc/dovecot-dict-sql.conf
 
75
}
 
76
 
 
77
plugin {
 
78
  # v1.2 + MySQL:
 
79
  quota = dict:user::proxy::quotadict
 
80
  # v1.2 + file:
 
81
  quota = dict:user::file:%h/Maildir/dovecot-quota
 
82
 
 
83
  quota_rule = *:storage=10M:messages=1000
 
84
}
 
85
---%<-------------------------------------------------------------------------
 
86
 
 
87
The above SQL example uses dictionary proxy process (see below), because SQL
 
88
libraries aren't linked to all Dovecot binaries. The file example accesses the
 
89
file directly.
 
90
 
 
91
Example 'dovecot-dict-sql.conf':
 
92
 
 
93
---%<-------------------------------------------------------------------------
 
94
# v1.2+ only:
 
95
connect = host=localhost dbname=mails user=sqluser password=sqlpass
 
96
map {
 
97
  pattern = priv/quota/storage
 
98
  table = quota
 
99
  username_field = username
 
100
  value_field = bytes
 
101
}
 
102
map {
 
103
  pattern = priv/quota/messages
 
104
  table = quota
 
105
  username_field = username
 
106
  value_field = messages
 
107
}
 
108
---%<-------------------------------------------------------------------------
 
109
 
 
110
Create the table like this:
 
111
 
 
112
---%<-------------------------------------------------------------------------
 
113
CREATE TABLE quota (
 
114
  username varchar(100) not null,
 
115
  bytes bigint not null default 0,
 
116
  messages integer not null default 0,
 
117
  primary key (username)
 
118
);
 
119
---%<-------------------------------------------------------------------------
 
120
 
 
121
If you're using PostgreSQL, you'll need a trigger:
 
122
 
 
123
---%<-------------------------------------------------------------------------
 
124
CREATE OR REPLACE FUNCTION merge_quota() RETURNS TRIGGER AS $$
 
125
BEGIN
 
126
  IF exists(SELECT 1 FROM quota WHERE username = NEW.username) THEN
 
127
    UPDATE quota SET bytes = bytes + NEW.bytes,
 
128
      messages = messages + NEW.messages
 
129
      WHERE username = NEW.username;
 
130
    RETURN NULL;
 
131
  ELSE
 
132
    RETURN NEW;
 
133
  END IF;
 
134
END;
 
135
$$ LANGUAGE plpgsql;
 
136
 
 
137
CREATE TRIGGER mergequota BEFORE INSERT ON quota
 
138
   FOR EACH ROW EXECUTE PROCEDURE merge_quota();
 
139
---%<-------------------------------------------------------------------------
 
140
 
48
141
v1.0 Inaccuracy problems
49
142
------------------------
50
143
 
51
 
With Dovecot v1.1 quota is tracked accurately. With v1.0 you may have a
 
144
With Dovecot v1.1+ quota is tracked accurately. With v1.0 you may have a
52
145
problem:
53
146
 
54
147
If two IMAP clients do an expunge at the same time, the quota is reduced twice
71
164
The dictionary server is referenced with URI 'proxy:<dictionary server socket
72
165
path>:<dictionary name>'. The socket path may be left empty if you haven't
73
166
changed 'base_dir' setting in 'dovecot.conf'. Otherwise set it to
74
 
'<base_dir>/dict-server'. The dictionary names are configured in dovecot.conf.
75
 
For example:
 
167
'<base_dir>/dict-server'. The dictionary names are configured in
 
168
'dovecot.conf'. For example:
76
169
 
77
170
---%<-------------------------------------------------------------------------
78
171
dict {
79
 
  quotadict = mysql:/etc/dovecot-dict-quota.conf
80
 
}
81
 
---%<-------------------------------------------------------------------------
82
 
 
83
 
Example quota plugin configuration for this:
84
 
 
85
 
---%<-------------------------------------------------------------------------
86
 
plugin {
87
 
  # v1.0:
88
 
  quota = dict:storage=10240:messages=1000 proxy::quotadict
89
 
  # v1.1:
90
 
  quota = dict proxy::quotadict
91
 
  quota_rule = *:storage=10M:messages=1000
92
 
}
93
 
---%<-------------------------------------------------------------------------
94
 
 
95
 
(This file was created from the wiki on 2008-06-20 04:42)
 
172
  quota = mysql:/etc/dovecot-dict-quota.conf
 
173
  expire = mysql:/etc/dovecot-dict-expire.conf
 
174
}
 
175
---%<-------------------------------------------------------------------------
 
176
 
 
177
(This file was created from the wiki on 2009-01-05 04:42)