Visulazing your ldap tree structure.

I made « bla » as a tool for sysadmins. One of the interest of using python as a DSL is being terse.

As previously said, my toy LDAP domain is dc=home.
In |0]: list(map(print,walk(
	"dc=home",
	lambda e:"--".join(
    	map(
        	lambda e:"\"%s\""%e,e.entry_dn.split(",")[::-1])
))))

"dc=home"--"ou=group"
"dc=home"--"ou=group"--"cn=staff"
"dc=home"--"ou=people"
"dc=home"--"ou=people"--"uid=boss"
"dc=home"--"ou=people"--"uid=louis"
"dc=home"--"ou=people"--"uid=manager"
which copy pasted in this graphviz template :
graph toto {
    concentrate=true;
    node [shape=rectangle]
# paste your stuff here
}
gives you a tree representation like this :
And if you load your credentials for the cn=config you will have :
It really is a cheap trick, but cheap tricks are helpful when oversold as a consultant and needing to understand the structure fast.

No comments: