[[python_wiki:freeipa_import_group_memberships]]

Freeipa Import Group Memberships

General Information

Parse a text file dump of 389 LDAP “unique members” and add the group memberships to a FreeIPA server.

Checklist

  • FreeIPA server
  • Unique members LDAP dump

Usage

Place the text file “memberlist-uniqueentry.txt” in the same directory and execute

./import-users-groups_legacy-groups.py

The Code

An example LDAP Unique member list output

# extended LDIF
#
# LDAPv3
# base <ou=groups,ou=MyOrg,dc=example,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: gidNumber uniquemember 
#
 
# users, Groups, Servers, MyOrg, example.com
dn: cn=users,ou=Groups,ou=MyOrg,dc=example,dc=com
gidNumber: 100
uniquemember: uid=lskywalker,ou=Users,ou=MyOrg,dc=example,dc=com
uniquemember: uid=dvadar,ou=Users,ou=MyOrg,dc=example,dc=com
uniquemember: uid=yoda,ou=Users,ou=MyOrg,dc=example,dc=com
 
# developers, Groups, Servers, MyOrg, example.com
dn: cn=developers,ou=Groups,ou=MyOrg,dc=example,dc=com
gidNumber: 103
uniquemember: uid=bert,ou=Users,ou=MyOrg,dc=example,dc=com
uniquemember: uid=ernie,ou=Users,ou=MyOrg,dc=example,dc=com
uniquemember: uid=oscar,ou=Users,ou=MyOrg,dc=example,dc=com
 
 
# operations, Groups, Servers, MyOrg, example.com
dn: cn=operations,ou=Groups,ou=MyOrg,dc=example,dc=com
gidNumber: 777
uniquemember: uid=spock,ou=Users,ou=MyOrg,dc=example,dc=com
 
# web_devel, Groups, Servers, MyOrg, example.com
dn: cn=web_devel,ou=Groups,ou=MyOrg,dc=example,dc=com
gidNumber: 18651
 
# search result
search: 2
result: 0 Success

  • python_wiki/freeipa_import_group_memberships.txt
  • Last modified: 2019/05/26 03:50
  • (external edit)