aboutsummaryrefslogtreecommitdiffstats
path: root/ldap/acl.ldif
blob: ac2e19d52cb11e184d72f413fdc3696ae5737ae3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# Load this file with
#
#   ldapmodify -Y EXTERNAL -H ldapi:/// -f acl.ldif
#
# It will remove existing ACLs, and add the following instead. Ensure
# that it's indeed the database #1 that you want to amend:
#
#   ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b "cn=config" "olcSuffix=o=mailHosting,dc=fripost,dc=dev" dn
#
#
# /!\ ATTENTION! Every modification made to this file should be
# /!\ implemented in the test suite as well!
#
#
# References:
# - http://www.openldap.org/doc/admin24/access-control.html
# - http://www.openldap.org/faq/data/cache/189.html
# - http://www.openldap.org/faq/data/cache/1140.html
# - http://www.openldap.org/faq/data/cache/1133.html
# - man 5 slapd.access


dn: olcDatabase={1}hdb,cn=config
changetype: modify
replace: olcAccess
#
# Services have read access to the attribute they need. We put this ACL
# first as it's likely to be the most used.
# TODO: for postfix, it'd be more efficient and more secure to SASL-bind
# on a UNIX socket (EXTERNAL mechanism); wait for Postfix 2.8.
# TODO: IMAP & SASLauth
# TODO: if possible, make use GSSAPI for the services.
olcAccess: to dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev"
        attrs=entry,objectClass,fvd,fripostIsStatusActive,fripostIsStatusPending,fripostOptionalMaildrop,fvu,fva,fripostMaildrop,fvl,fvlc,fripostLocalAlias
        filter=(|(objectClass=FripostVirtualDomain)(objectClass=FripostVirtualMailbox)(objectClass=FripostVirtualAlias)(objectClass=FripostVirtualList)(objectClass=FripostVirtualListCommand))
    by dn.exact="cn=SMTP,ou=services,o=mailHosting,dc=fripost,dc=dev" =rsd
    by users none break
#
# Anonymous can authenticate into the services. (But not read or write the password.)
olcAccess: to dn.one="ou=services,o=mailHosting,dc=fripost,dc=dev"
        attrs=userPassword
    by anonymous auth
#
# That's necessary for SASL proxy Authorize the web application.
olcAccess: to dn.one="ou=services,o=mailHosting,dc=fripost,dc=dev"
        attrs=entry,objectClass,authzTo
    by * =x
#
# 1. Managers have read/write access to the "virtual" subtree.
# 2. The list creator needs further access.
# 3. Other services have no access other than the one above.
# 4,5. Other users need further access.
olcAccess: to dn.subtree="ou=virtual,o=mailHosting,dc=fripost,dc=dev"
    by dn.onelevel="ou=managers,o=mailHosting,dc=fripost,dc=dev" write
    by dn.exact="cn=ListCreator,ou=services,o=mailHosting,dc=fripost,dc=dev" none break
    by dn.onelevel="ou=services,o=mailHosting,dc=fripost,dc=dev" none
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" none break
    by anonymous none break
#
# 1. Users can change their password (but not read it).
# 2. Anonymous users can bind.
# 3. Else, we inspect the 2 following ACLs.
olcAccess: to dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev"
        attrs=userPassword
    by self =w
    by anonymous auth
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" none break
#
# The postmaster of a domain can change (replace) his/her users'
# password (but not see it).
olcAccess: to dn.regex="^fvu=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualMailbox)
        attrs=userPassword
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" =w
#
# No permission on the userPassword attribute for other users.
# (That's a catch-all, just to be sure that services, etc. cannot read the passwords).
olcAccess: to dn.subtree="o=mailHosting,dc=fripost,dc=dev"
        attrs=userPassword
    by * none
#
# 1. Users can search (e.g., to list the entries they have created).
# 2. So can the list creator.
olcAccess: to dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev"
        attrs=objectClass
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" =s
    by dn.exact="cn=ListCreator,ou=services,o=mailHosting,dc=fripost,dc=dev" =s
#
# Users can search (e.g., to list the entries they have created).
# Additional permissions may be added later on.
olcAccess: to dn.subtree="ou=virtual,o=mailHosting,dc=fripost,dc=dev"
        attrs=entry,creatorsName,fripostOwner,fripostPostmaster,fripostCanCreateAlias,fripostCanCreateList
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" =s break
    by dn.onelevel="ou=services,o=mailHosting,dc=fripost,dc=dev" none break
#
# Everyone can delete domains. (Provided s/he has +d access to the "entry"
# attribute of the domains s/he wants to delete.)
olcAccess: to dn.base="ou=virtual,o=mailHosting,dc=fripost,dc=dev"
        attrs=children
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" =z
#
# Reserved local parts are reserved.
olcAccess: to dn.regex="^(fvu|fva|fvl)=(postmaster|abuse),fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev$"
    by * none
#
# 1. The postmaster of a domain can give (or take back) people the right to create
# aliases.
# 2,3. People that can create aliases can list the members of the group.
olcAccess: to dn.regex="^fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev$"
        filter=(objectClass=FripostVirtualDomain)
        attrs=fripostCanCreateAlias
    by dnattr=fripostPostmaster write
    by dnattr=fripostOwner read
    by set.exact="this/fripostCanCreateAlias & (user | user/-1)" read
#
# 1. The postmaster of a domain can give (or take back) people the right to create lists.
# 2,3. People that can create lists can list the members of the group.
olcAccess: to dn.regex="^fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev$"
        filter=(objectClass=FripostVirtualDomain)
        attrs=fripostCanCreateList
    by dnattr=fripostPostmaster write
    by dnattr=fripostOwner read
    by set.exact="this/fripostCanCreateList & (user | user/-1)" read
#
# 1-3. Noone (but the managers) can appoint domain Owners or Postmasters.
# But people that can create aliases and lists can list the members of their group.
olcAccess: to dn.regex="^(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualDomain)
        attrs=fripostOwner,fripostPostmaster
    by dnattr=fripostOwner read
    by dnattr=fripostPostmaster read
    by set.exact="(this/fripostCanCreateAlias | this/fripostCanCreateList)& (user | user/-1)" read
    by dn.onelevel,expand="$1" +d
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" +0
#
# Every one can add or delete children, but we will be carefull with the
# kid's "entry" attribute, which require +a and +z to add and delete
# respectively.
olcAccess: to dn.regex="^fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev$"
        filter=(objectClass=FripostVirtualDomain)
        attrs=children
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" +w
#
# 1. Domain owners can edit their entry's attributes.
# 2. So can domain postmasters.
# 3. Domain users can read the public domain attributes.
# 4. So can users with "canCreateAlias" or "canCreateList" access.
olcAccess: to dn.regex="^(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualDomain)
        attrs=fvd,fripostIsStatusActive,description
    by dnattr=fripostOwner write
    by dnattr=fripostPostmaster write
    by dn.onelevel,expand="$1" read
    by set.exact="(this/fripostCanCreateAlias | this/fripostCanCreateList) & (user | user/-1)" read
#
# 1. Domain owners can edit their entry's attributes.
# 2. So can domain postmasters.
olcAccess: to dn.regex="^fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev$"
        filter=(objectClass=FripostVirtualDomain)
        attrs=@fripostVirtualDomain
    by dnattr=fripostOwner write
    by dnattr=fripostPostmaster write
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" +0
#
# 1. Domain owners can delete the domain (and read the entry).
# 2. So can domain postmasters.
# 3. Domain users can read the domain entry (but not delete it).
# 4. So can users with "canCreateAlias" or "canCreateList" rights.
olcAccess: to dn.regex="^(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualDomain)
        attrs=entry
    by dnattr=fripostOwner +zrd
    by dnattr=fripostPostmaster +zrd
    by dn.onelevel,expand="$1" +rd
    by set.exact="(this/fripostCanCreateAlias | this/fripostCanCreateList) & (user | user/-1)" +rd
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" +0
#
# Noone (but the managers) can change quotas.
olcAccess: to dn.regex="^fvu=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualMailbox)
        attrs=fripostMailboxQuota
    by self read
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" read
#
# 1. Users can modify their own entry.
# 2. So can their postmasters.
olcAccess: to dn.regex="^fvu=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualMailbox)
        attrs=@FripostVirtualMailbox
    by self write
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" write
#
# 1. Postmasters can create mailboxes (but not delete them).
# (Provided that they have +a access to the parent's "children" attribute.)
# 2. Users can read their entry (but not delete it).
olcAccess: to dn.regex="^fvu=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualMailbox)
        attrs=entry
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" +ard
    by self +rd
#
# 1. The alias owner can list the ownership of the entry.
# 2. The domain owner can add/delete/change the ownership of the entry.
# 3. So can the domain postmasters.
olcAccess: to dn.regex="^fva=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualAlias)
        attrs=fripostOwner
    by dnattr=fripostOwner read continue
    by group/fripostVirtualDomain/fripostOwner.expand="$1" write
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" write
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" +0
#
# 1. The alias owners can edit the rest of their entry's attributes.
# 2. So can the domain owners.
# 3. So can the domain postmasters.
olcAccess: to dn.regex="^fva=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualAlias)
        attrs=@FripostVirtualAlias
    by dnattr=fripostOwner write
    by group/fripostVirtualDomain/fripostOwner.expand="$1" write
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" write
#
# 1. The alias owners can read and delete the entry.
# 2. So can the domain owner.
# 3. So can the domain postmaster.
# 4. Users with "canCreateAlias" access (either explicitely, or as a wildcard) for the domain can create aliases for that domain.
# (But *not* delete them, unless also owner.)
olcAccess: to dn.regex="^fva=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualAlias)
        attrs=entry
    by dnattr=fripostOwner +zrd continue
    by group/fripostVirtualDomain/fripostOwner.expand="$1" +wrd
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" +wrd
    by set.exact="this/-1/fripostCanCreateAlias & (user | user/-1)" +a
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" +0
#
# 1. The list owner can list the ownership of the entry.
# 2. The domain owner can add/delete/change the ownership of the entry.
# 3. So can the domain postmasters.
olcAccess: to dn.regex="^fvl=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualList)
        attrs=fripostOwner
    by dnattr=fripostOwner read continue
    by group/fripostVirtualDomain/fripostOwner.expand="$1" write
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" write
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" +0
#
# 1. The list owner read (but not edit) the transport-related attributes.
# 2. So can the domain ower.
# 3. So can the domain postmaster.
olcAccess: to dn.regex="^fvl=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualList)
        attrs=fripostListManager
    by dnattr=fripostOwner read
    by group/fripostVirtualDomain/fripostOwner.expand="$1" read
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" read
#
# Only the list creator can remove the "pending" flag
olcAccess: to dn.regex="^fvl=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualList)
        attrs=fripostIsStatusPending
    by dnattr=fripostOwner read
    by group/fripostVirtualDomain/fripostOwner.expand="$1" read
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" read
    by dn.exact="cn=ListCreator,ou=services,o=mailHosting,dc=fripost,dc=dev" =zrd
#
# 1. The list owners can edit their entry's attributes.
# 2. So can the domain owners.
# 3. So can the domain postmasters.
olcAccess: to dn.regex="^fvl=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualList)
        attrs=@FripostVirtualList
    by dnattr=fripostOwner write
    by group/fripostVirtualDomain/fripostOwner.expand="$1" write
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" write
#
# 1. The list owners can read the entry.
# 2. So can the domain's Owner.
# 3. So can the domain's Postmaster.
# 4. Users with "canCreateList" capability (either explicitely, or as a wildcard) for the domain can create lists for that domain.
# (But *not* delete them, unless also owner.)
# 6. The list creator can read the entry.
olcAccess: to dn.regex="^fvl=[^,]+,(fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev)$"
        filter=(objectClass=FripostVirtualList)
        attrs=entry
    by dnattr=fripostOwner +rd continue
    by group/fripostVirtualDomain/fripostOwner.expand="$1" +rad
    by group/fripostVirtualDomain/fripostPostmaster.expand="$1" +rad
    by set.exact="this/-1/fripostCanCreateList & (user | user/-1)" +a
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" +0
    by dn.exact="cn=ListCreator,ou=services,o=mailHosting,dc=fripost,dc=dev" =rsd
#
# The List Creator can add list commands.
olcAccess: to dn.regex="^fvl=[^,]+,fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev"
        filter=(objectClass=FripostVirtualList)
        attrs=children
    by dn.exact="cn=ListCreator,ou=services,o=mailHosting,dc=fripost,dc=dev" =a
#
# The List Creator can add list commands.
olcAccess: to dn.regex="^fvlc=[^,]+,fvl=[^,]+,fvd=[^,]+,ou=virtual,o=mailHosting,dc=fripost,dc=dev"
        filter=(objectClass=FripostVirtualListCommand)
        attrs=entry
    by dn.exact="cn=ListCreator,ou=services,o=mailHosting,dc=fripost,dc=dev" =a
#
# Catch the "break" control above.
olcAccess: to dn.subtree="ou=virtual,o=mailHosting,dc=fripost,dc=dev"
    by dn.children="ou=virtual,o=mailHosting,dc=fripost,dc=dev" +0