ldapbind.pl for LDAP bind testing

A while back I needed to do some testing with LDAP. In that case I wanted to test binds as quickly as possible without having searches take place as well. This happens all the time with various network-based applications that use LDAP as an authentication backend and then do not do a search/modify/add/replace of some object or set of objects. The various command-line LDAP tools do not, as far as I know, let this happen easily though you can tune the ldapsearch command to be fairly bare-bones (search on cn=schema and then request attribute 'doesntExist'). As a result I stole some public code for LDAP and removed all of the searching parts and out came this tool.

Run ldapbind.pl after (preferably) making it executable and putting it into your user's PATH (~/bin or just specify the file explicitly as /path/to/ldapbind.pl) by giving it the server IP or DNS name of the server followed by the LDAP DN of the user with which you would like to authenticate. Specifying a parameter on the end is also possible though if not presented you will be prompted for credentials:

ab@mybox0:~/Desktop> ldapbind.pl ldap.server.here cn=admin,dc=user,dc=system
Please enter a password:

At the end you can see it returns 'Success' if the bind was successful. Throw it into a while loop for some quick testing:

while [ 1 ] ; do ldapbind.pl ldap.server.here cn=admin,dc=user,dc=system novell; done


Comment List