alexivkin / ISIM-LDAP-Sifter

A set of ISIM data manipulation tools
Apache License 2.0
8 stars 2 forks source link

ISIM Data tools

Various ISIM data processing tools useful for upgrades, backups, cleanup, performance tuning and encryption changes.

Setup

For the tools to work you first need to dump your exsisting ISIM LDAP into an LDIF format. You can do it in one of the following ways:

The last ldapsearch includes erServiceProfile, erObjectCategory from ou=category,ou=itim,ou=[company],dc=itim,dc=dom, erTemplate from ou=config,ou=itim,ou=[company],dc=itim,dc=dom, erFormTemplate from ou=formTemplates,ou=itim,ou=[company],dc=itim,dc=dom and many others.

Usage

Extract ISIM javascript code, workflows, provisioning policies, ACIs etc - codeextractor.py

Extract ITIM configuration components from an LDIF into readable (base64 decoded) XML files. Provide the name of the ldif, exported per directions above. Creates subfolders in the same folder with the exported components.

Understand ISIM configuration - inspector.py

Analyzes LDIF and produces many stats and an LDAP tree overview. Uses a bunch of memory, close to the size of the original ldif. inspector.py [-c] <name of the ldif> -c to output stats as csv files

Needs PrettyTable sudo apt-get install python-prettytable

Split out data in subfiles - dataextractor.py

Useful for converting Prod data to a subset that is safe and confidential for importing into Dev and QA. dataextractor.py [-a][-d] <name of the ldif> -a to extract all data. If no -a is supplied the data is truncated and modified for non-Prod environments. E.g only 10 random people are exported, services are disabled by modifying erurl, service supporting data (groups etc) is skipped. -d to create removal ldifs, so data can be replaced. It uses DNs from the input LDIF. The side effect is that any DNs that are in the LDAP, but not in input LDIF will not be removed. To clean all of the existing entries run dataextractor on the ldapdump from the current LDAP or just use the build-cleaner-from-ldif.sh script

This code assumes the base DN is dn=com. Recycle bin is always skipped.

Convert TIM 5.x encryption to SIM 6/7 encryption - reencrypter.py

Go over an ldap extract and convert it from PBEWithMD5AndDES to AES (AES/ECB/PKCS5Padding). reencrypter.py [-x] <name of the ldif> <PBE encryption password> <AES encryption key>

<PBE encryption password> is the TIM 5.x password, either from enRole.properties as enrole.encryption.password or inside encryptionKey.properties as encryption.password.

<AES encryption key> is the SIM 6 binary encryption key. It comes from a JCEKS key store. You might need to extract it first from {ITIM}/data/keystore/itimKeystore.jceks using JCEKStractor from the ITIM Crypto Seer repo. It should be base64 encoded.

-x will cause it to check if the key is already correctly encrypted and thus should not be re-encrypted. Warning - it may cause false positives, for example in the case where last byte of the decrypted value (padding) is 1

Saves to <name of the ldif>-rec.ldif to use with ldif2db and <name of the ldif>-mod.ldif> to use with ldapmodify, depending on what you prefer.

Requires Pycrypto that you could install with apt install python-crypto