Lines 204-352
def _ldap_addlist(self):
|
Link Here
|
---|
|
204 |
('objectClass', ['top', 'domain', 'sambaDomain', 'univentionDomain', 'univentionBase']) |
204 |
('objectClass', ['top', 'domain', 'sambaDomain', 'univentionDomain', 'univentionBase']) |
205 |
] |
205 |
] |
206 |
|
206 |
|
207 |
def _ldap_post_create(self): |
|
|
208 |
dnsname = self.position.getPrintable() |
209 |
self.lo.add('cn=users,' + self.dn, [('objectClass', ['top', 'organizationalRole']), ('cn', ['users'])]) |
210 |
self.lo.add('cn=groups,' + self.dn, [('objectClass', ['top', 'organizationalRole']), ('cn', ['groups'])]) |
211 |
self.lo.add('cn=computers,' + self.dn, [('objectClass', ['top', 'organizationalRole']), ('cn', ['computers'])]) |
212 |
self.lo.add('cn=univention,' + self.dn, [('objectClass', ['top', 'organizationalRole']), ('cn', ['univention'])]) |
213 |
self.lo.add('cn=dns,' + self.dn, [('objectClass', ['top', 'organizationalRole']), ('cn', ['dns'])]) |
214 |
self.lo.add('cn=dhcp,' + self.dn, [('objectClass', ['top', 'organizationalRole']), ('cn', ['dhcp'])]) |
215 |
self.lo.add('cn=policies,' + self.dn, [('objectClass', ['top', 'organizationalRole']), ('cn', ['policies'])]) |
216 |
|
217 |
tmpPosition = univention.admin.uldap.position(self.position.getBase()) |
218 |
tmpPosition.setDn(self.dn) |
219 |
|
220 |
directoryObject = univention.admin.objects.default('settings/directory', self.co, self.lo, tmpPosition) |
221 |
directoryObject['policy'] = 'cn=policies,%s' % self.dn |
222 |
directoryObject['dns'] = 'cn=dns,%s' % self.dn |
223 |
directoryObject['dhcp'] = 'cn=dhcp,%s' % self.dn |
224 |
directoryObject['users'] = 'cn=users,%s' % self.dn |
225 |
directoryObject['groups'] = 'cn=groups,%s' % self.dn |
226 |
directoryObject['computers'] = 'cn=computers,%s' % self.dn |
227 |
directoryObject.create() |
228 |
|
229 |
rootSambaSID = None |
230 |
while rootSambaSID is None: |
231 |
rootSambaSID = univention.admin.allocators.requestUserSid(self.lo, tmpPosition, '0') |
232 |
# FIXME |
233 |
self.lo.add('uid=root,cn=users,' + self.dn, [ |
234 |
('objectClass', ['top', 'posixAccount', 'sambaSamAccount', 'shadowAccount', 'person', 'organizationalPerson', 'univentionPerson', 'inetOrgPerson']), |
235 |
('cn', ['root']), |
236 |
('uid', ['root']), |
237 |
('uidNumber', ['0']), |
238 |
('gidNumber', ['0']), |
239 |
('homeDirectory', ['/root']), |
240 |
('userPassword', [cryptPassword]), |
241 |
('loginShell', ['/bin/sh']), |
242 |
('sambaLMPassword', lmPassword), |
243 |
('sambaNTPassword', ntPassword), |
244 |
('sambaSID', [rootSambaSID]), |
245 |
('sambaAcctFlags', '[U ]'), |
246 |
('sn', ['root']) |
247 |
]) |
248 |
|
249 |
self.lo.add('cn=default,cn=univention,' + self.dn, [ |
250 |
('objectClass', ['top', 'univentionDefault']), |
251 |
('univentionDefaultGroup', ['cn=Domain Users,cn=groups,' + tmpPosition.getDn()]), |
252 |
('cn', ['default']) |
253 |
]) |
254 |
|
255 |
self.lo.add('cn=temporary,cn=univention,' + self.dn, [ |
256 |
('objectClass', ['top', 'organizationalRole']), |
257 |
('cn', ['temporary']) |
258 |
]) |
259 |
|
260 |
self.lo.add('cn=sid,cn=temporary,cn=univention,' + self.dn, [ |
261 |
('objectClass', ['top', 'organizationalRole']), |
262 |
('cn', ['sid']) |
263 |
]) |
264 |
|
265 |
self.lo.add('cn=uidNumber,cn=temporary,cn=univention,' + self.dn, [ |
266 |
('objectClass', ['top', 'organizationalRole', 'univentionLastUsed']), |
267 |
('univentionLastUsedValue', ['1000']), |
268 |
('cn', ['uidNumber']) |
269 |
]) |
270 |
|
271 |
self.lo.add('cn=gidNumber,cn=temporary,cn=univention,' + self.dn, [ |
272 |
('objectClass', ['top', 'organizationalRole', 'univentionLastUsed']), |
273 |
('univentionLastUsedValue', ['1000']), |
274 |
('cn', ['gidNumber']) |
275 |
]) |
276 |
|
277 |
self.lo.add('cn=uid,cn=temporary,cn=univention,' + self.dn, [ |
278 |
('objectClass', ['top', 'organizationalRole']), |
279 |
('cn', ['uid']) |
280 |
]) |
281 |
|
282 |
self.lo.add('cn=gid,cn=temporary,cn=univention,' + self.dn, [ |
283 |
('objectClass', ['top', 'organizationalRole']), |
284 |
('cn', ['gid']) |
285 |
]) |
286 |
|
287 |
self.lo.add('cn=mail,cn=temporary,cn=univention,' + self.dn, [ |
288 |
('objectClass', ['top', 'organizationalRole']), |
289 |
('cn', ['mail']) |
290 |
]) |
291 |
|
292 |
self.lo.add('cn=aRecord,cn=temporary,cn=univention,' + self.dn, [ |
293 |
('objectClass', ['top', 'organizationalRole']), |
294 |
('cn', ['aRecord']) |
295 |
]) |
296 |
|
297 |
if self['dnsForwardZone']: |
298 |
for i in self['dnsForwardZone']: |
299 |
soa = 'nameserver root.%s.%s 1 28800 7200 604800 10800' % (self['name'], dnsname) |
300 |
self.lo.add('zoneName=' + i + ',cn=dns,' + self.dn, [ |
301 |
('objectClass', ['top', 'dNSZone']), |
302 |
('zoneName', [i]), |
303 |
('dNSTTL', ['10800']), |
304 |
('SOARecord', [soa]), |
305 |
('NSRecord', ['nameserver']), |
306 |
('relativeDomainName', ['@']) |
307 |
]) |
308 |
|
309 |
if self['dnsReverseZone']: |
310 |
for i in self['dnsReverseZone']: |
311 |
|
312 |
ipList = i.split('.') |
313 |
ipList.reverse() |
314 |
c = '.' |
315 |
ipString = c.join(ipList) |
316 |
zoneName = ipString + '.in-addr.arpa' |
317 |
soa = 'nameserver root.%s.%s 1 28800 7200 604800 10800' % (self['name'], dnsname) |
318 |
self.lo.add('zoneName=' + zoneName + ',cn=dns,' + self.dn, [ |
319 |
('objectClass', ['top', 'dNSZone']), |
320 |
('zoneName', [zoneName]), |
321 |
('dNSTTL', ['10800']), |
322 |
('SOARecord', [soa]), |
323 |
('NSRecord', ['nameserver']), |
324 |
('relativeDomainName', ['@']) |
325 |
]) |
326 |
oldPos = tmpPosition.getDn() |
327 |
tmpPosition.setDn('cn=groups,' + tmpPosition.getDn()) |
328 |
groupObject = univention.admin.objects.default('groups/group', self.co, self.lo, tmpPosition) |
329 |
groupObject['name'] = 'Domain Users' |
330 |
groupObject.create() |
331 |
|
332 |
groupObject = univention.admin.objects.default('groups/group', self.co, self.lo, tmpPosition) |
333 |
groupObject['name'] = 'Domain Guests' |
334 |
groupObject.create() |
335 |
|
336 |
groupObject = univention.admin.objects.default('groups/group', self.co, self.lo, tmpPosition) |
337 |
groupObject['name'] = 'Domain Admins' |
338 |
groupObject.create() |
339 |
|
340 |
groupObject = univention.admin.objects.default('groups/group', self.co, self.lo, tmpPosition) |
341 |
groupObject['name'] = 'Account Operators' |
342 |
groupObject.create() |
343 |
|
344 |
groupObject = univention.admin.objects.default('groups/group', self.co, self.lo, tmpPosition) |
345 |
groupObject['name'] = 'Windows Hosts' |
346 |
groupObject.create() |
347 |
|
348 |
tmpPosition.setDn(oldPos) |
349 |
|
350 |
|
207 |
|
351 |
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=False, required=False, timeout=-1, sizelimit=0): |
208 |
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=False, required=False, timeout=-1, sizelimit=0): |
352 |
|
209 |
|