forked from richm/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewchaindb.py
40 lines (33 loc) · 851 Bytes
/
newchaindb.py
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
import os
import sys
import time
import ldap
from dsadmin import DSAdmin, Entry, LEAF_TYPE
host1 = "vmf8i386.testdomain.com"
host2 = "vmf9x8664.testdomain.com"
port1 = 389
port2 = 389
rootdn1 = "cn=directory manager"
rootpw1 = 'secret12'
rootdn2 = "cn=directory manager"
rootpw2 = 'secret12'
mux = DSAdmin(host1, port1, rootdn1, rootpw1)
farm = DSAdmin(host2, port2, rootdn2, rootpw2)
suffix = 'dc=chaintest'
# add the suffix
farm.addSuffix(suffix)
# add the suffix entry
dn = suffix
ent = Entry(dn)
ent.setValues('objectclass', 'domain')
farm.add_s(ent)
# setup chaining
mux.setupChaining(farm, suffix, False)
# add ctuser on farm
dn = 'uid=ctuser,' + suffix
ent = Entry(dn)
ent.setValues('objectclass', 'inetOrgPerson')
ent.setValues('cn', 'Chain Testuser')
ent.setValues('sn', 'Testuser')
ent.setValues('givenName', 'Chain')
farm.add_s(ent)