source: n4d-ldap/trunk/fuentes/install/usr/share/n4d-ldap/one-shots/ldap-fix-epoptes @ 149

Last change on this file since 149 was 149, checked in by hectorgh, 4 years ago

adding project files

  • Property svn:executable set to *
File size: 843 bytes
Line 
1#!/usr/bin/env python
2
3import xmlrpclib
4import ldap
5import grp
6
7def get_ldap_pass():
8
9        try:
10                f=open("/etc/lliurex-secrets/passgen/ldap.secret")
11                lines=f.readlines()
12                f.close()
13                password=lines[0].replace("\n","")
14                return password
15        except:
16                return None
17               
18
19
20def mod_ldap():
21       
22        c=xmlrpclib.ServerProxy("https://localhost:9779")
23        base_dn=c.get_variable("","VariablesManager","LDAP_BASE_DN")
24        url=c.get_variable("","VariablesManager","CLIENT_LDAP_URI")
25        path="cn=epoptes,ou=System,ou=Groups," + base_dn
26        adm_path="cn=admin,"+base_dn   
27        password=get_ldap_pass()
28        ldp=ldap.initialize(url)
29        ldp.bind_s(adm_path,password)
30        a=ldp.search_s(path,ldap.SCOPE_SUBTREE)
31       
32        mod=( ldap.MOD_REPLACE, 'gidNumber', str(312) )
33                       
34        mod_list=[]
35        mod_list.append(mod)
36        ldp.modify_s(path,mod_list)
37       
38#def mod_ldap
39
40
41try:
42        mod_ldap()
43       
44except Exception as e:
45        pass
Note: See TracBrowser for help on using the repository browser.