LDAP integration with phabricator
24 Jun 2014Where RTFM is no good
This post tells you how to use connect phabricator to your LDAP server for auth credentials
When it comes to code review Gerrit is pretty much unbeatable. Sadly, since it’s git only, and our internal codebase is hosted on Mercurial, this was of no use to us.
Enter phabricator. While the setup is pretty easy (even the manual installation on RHEL 5), the configuration is not as straightforward as I would like, with using LDAP integration for authentication not quite working as expected. Specifically our LDAP server did not support anonymous searches. While there are a few examples floating around the web, I couldn’t really find one that worked. ldapsearch actually proved to be quite helpful here. An easy way to try this out is to run the following command :
Where bar.foodomain.com
is your ldap server, and user
is your ldap login name. The -x
indicates use simple authentication, and -W
prompts for the password for ‘user’. If this command worked for you, then the following configuration should work for LDAP in phabricator
A sample return for ldapsearch looks something similar to this (abbreviated for brevity) :
Username Attributes & Real name attributes were based on this sample return. The phabricator config actually recommends using sn
instead of sAMAccount
, this did not work for me. These values are not case sensitive. You can replace displayName
with givenName,sn
or pretty much any combination of returned attributes.
Note : a lot of places seem to recommend specifying Real Name attributes as ["givenName","sn"]
instead of givenName,sn
but only the format without the brackets & quotes worked for me. You can also use the auth test utility shipped with phabricator to test ldap via phabricator/bin/auth ldap
. It uses ldap settings set in phabricator > auth > ldap.
Simple LDAP configuration only allows you to login via ldap, you still need to import ldap users into phabricator for it to work correctly. To do this go to phabricator > people > import from ldap. Enter any useable username/password combo, and an ldap query to search for users to import. Based on the sample return above, a useable query would be (objectClass=person)
. Note: if the root user uses an email address found in ldap search, you won’t be able to add that particular user to phabricator, as phabricator will detect a duplicate entry of the email address.