Active Directory to OpenLDAP Sync with LSC
By Chris Gilbert
I have recently had to sync accounts and groups from Activc Directory to OpenLDAP, for a requirement for a directory server in the DMZ. A DMZ (De-millitarised zone) is an area of the network open to the internet. It’s supposed to be separate from the rest of your LAN, so you can have services running on the internet without fear that people can break into your LAN from these. There are other options for doing this, including a read-only domain controller (RODC), a AD LDS (Lighweight Directory Server) and so on, but they all require connectivity back from the DMZ to the LAN, which is precisely what we are trying to avoid. If you start from the premise that no traffic at all be allowed to flow into the LAN from the DMZ, then how do you authenticate your user’s accounts? The only real answer is a directory server in the DMZ, and to save our own users having to have multiple logins, clearly some sort of account sync would be required. We looked at a tool called LSC (LDAP Syncronisation Connector) which is designed for syncing various directory sources to and from each other. It’s a very capable product, and now I’ve gone through the learning process, I will have to remember if for similar functions in the future (it can’t read/write from databases, CSV files and so on too). In order to get it set up, there are some gotchas, not least password sync, which requires another method. But I will leave discussion of that until later. First of all, I needed to get our users and groups into OpenLDAP from Active Directory. To set this up required a config file, a modified version of which is below:
I had a few specific requirements - I wanted to sync only some of the groups, as we have hundreds, so I filtered out the security groups related to Confluence and Jira (our customer facing systems). I also wanted to change the distinguished names (DNs) of the objects as I moved them, from mydomain.local to mydomain.co.uk. In LDAP speak that is from dc=mydomain,dc=local to dc=mydomain,dc=co,dc=uk. I won’t go into explaining the config too much, you need to know a bit about LDAP to understand it. I am “lucky” enough to have delved into LDAP search criteria before, so it wasn’t too challenging. However, for everyone else, a good bit of googling and trial and error will hopefully produce something useful. This works for me - use it and modify it if you like. I wasn’t able to find a good example for the 2.0.x series of LSC (with the new XML config files) so hopefully this will help some people. I put it together from some other posts I found on the mailing lists, along with suggestions on how they should be fixed, to come up with something that worked. The second phase of this is making password sync also work. LSC cannot do this by itself, but does come with a perl script which can be hooked in via a third party program called hkpassword, and send the password changes to OpenLDAP as they occur. I got this working fine, with a few modifications. I’ll post this at a later date when I’ve had a chance to write up and document the process.