36
36
olcTLSCertificateKeyFile: %(serverkey)s
37
37
olcTLSVerifyClient: try
38
38
39
+ # "frontend" config applies to all databases
40
+ dn: olcDatabase={-1}frontend,cn=config
41
+ objectClass: olcDatabaseConfig
42
+ objectClass: olcFrontendConfig
43
+ %(access)s
44
+
39
45
dn: cn=module,cn=config
40
46
objectClass: olcModuleList
41
47
cn: module
@@ -182,7 +188,7 @@ class SlapdObject:
182
188
183
189
.. versionchanged:: UNRELEASED
184
190
185
- Added ldaps_uri attribute
191
+ Added ldaps_uri and access attributes
186
192
"""
187
193
slapd_conf_template = SLAPD_CONF_TEMPLATE
188
194
database = 'mdb'
@@ -247,6 +253,11 @@ def __init__(self):
247
253
self .clientcert = os .path .join (HERE , 'certs/client.pem' )
248
254
self .clientkey = os .path .join (HERE , 'certs/client.key' )
249
255
256
+ self .access = [
257
+ 'to attrs=userPassword by self write by anonymous auth by * none' ,
258
+ 'to * by * read' ,
259
+ ]
260
+
250
261
@property
251
262
def root_dn (self ):
252
263
return 'cn={self.root_cn},{self.suffix}' .format (self = self )
@@ -340,6 +351,15 @@ def _avail_tcp_port(self):
340
351
"""
341
352
return self ._avail_tcp_ports (1 )
342
353
354
+ def gen_access (self ):
355
+ """generate a list of 'olcAccess' lines from the self.access list.
356
+ """
357
+
358
+ ret = []
359
+ for i ,line in enumerate (self .access ):
360
+ ret .append ('olcAccess: {%d}%s' % (i , line ))
361
+ return ret
362
+
343
363
def gen_config (self ):
344
364
"""
345
365
generates a slapd.conf and returns it as one string
@@ -360,6 +380,7 @@ def gen_config(self):
360
380
'cafile' : self .cafile ,
361
381
'servercert' : self .servercert ,
362
382
'serverkey' : self .serverkey ,
383
+ 'access' : '' , # '\n'.join(self.gen_access()),
363
384
}
364
385
return self .slapd_conf_template % config_dict
365
386
0 commit comments