Skip to content

Commit f9ffbe6

Browse files
committed
SlapdObject include olcAccess rules
1 parent d23dc6d commit f9ffbe6

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

Lib/slapdtest/_slapdtest.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
olcTLSCertificateKeyFile: %(serverkey)s
3737
olcTLSVerifyClient: try
3838
39+
# "frontend" config applies to all databases
40+
dn: olcDatabase={-1}frontend,cn=config
41+
objectClass: olcDatabaseConfig
42+
objectClass: olcFrontendConfig
43+
%(access)s
44+
3945
dn: cn=module,cn=config
4046
objectClass: olcModuleList
4147
cn: module
@@ -182,7 +188,7 @@ class SlapdObject:
182188
183189
.. versionchanged:: UNRELEASED
184190
185-
Added ldaps_uri attribute
191+
Added ldaps_uri and access attributes
186192
"""
187193
slapd_conf_template = SLAPD_CONF_TEMPLATE
188194
database = 'mdb'
@@ -247,6 +253,11 @@ def __init__(self):
247253
self.clientcert = os.path.join(HERE, 'certs/client.pem')
248254
self.clientkey = os.path.join(HERE, 'certs/client.key')
249255

256+
self.access = [
257+
'to attrs=userPassword by self write by anonymous auth by * none',
258+
'to * by * read',
259+
]
260+
250261
@property
251262
def root_dn(self):
252263
return 'cn={self.root_cn},{self.suffix}'.format(self=self)
@@ -340,6 +351,15 @@ def _avail_tcp_port(self):
340351
"""
341352
return self._avail_tcp_ports(1)
342353

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+
343363
def gen_config(self):
344364
"""
345365
generates a slapd.conf and returns it as one string
@@ -360,6 +380,7 @@ def gen_config(self):
360380
'cafile': self.cafile,
361381
'servercert': self.servercert,
362382
'serverkey': self.serverkey,
383+
'access': '', # '\n'.join(self.gen_access()),
363384
}
364385
return self.slapd_conf_template % config_dict
365386

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy