ImpEx:LDAP
From Cerberus Helpdesk Wiki
These steps will work for exporting from LDAP to Cerb4.
Contents |
Requirements
- You have an LDAP server.
- You've installed a fresh copy of Cerberus Helpdesk 4.0.
- You've installed the Cerb4 ImpEx tool.
Configuring the LDAP Export
Inside the example-configs/ directory from the Cerb4-ImpEx files you'll find a ldap.cfg template:
You should copy the ldap.cfg template to a new file if you're going to be performing multiple imports.
Options that are 'commented out' will use their defaults.
- To enable an option, uncomment it by removing the leading # character on the line. Then choose the appropriate value for the option.
- To disable an option, comment it out by adding a leading # character to the front of the line.
Below are some notes on the most common configuration options.
- exportEncoding - Set to "UTF-8" or "ISO-8859-1" depending on what your Cerb4 framework.config.php LANG_CHARSET_CODE and DB_CHARSET_CODE are set to. This should also match your Cerb4 MySQL database charset.
- outputDir - This is where your export files will be written for this source. If you're exporting from multiple sources you should give them each a unique outputDir.
- LDAPHost - The hostname of your LDAP Server
- LDAPLoginDN - Your LDAP auth login name
- LDAPPassword - Your LDAP auth password
- LDAPSearchBase - The Base DN to search for objects
- LDAPSearchFilter - The LDAP search filter to use. The default is (objectClass=*)
- exportWorkers - Enable this option to export the objects found as workers.
- dontExportPasswords - If set to true the exporter will skip trying to export passwords. If your ldap server does not store your passwords in plaintext set this to true (because the exporter md5() hashes the value it obtains)
- initialWorkerPassword The exporter will try to set passwords for workers like this:
- Try to pull the password from the userPassword field
- If that doesn't work, set it to a default password if one is specified as initialWorkerPassword
- Otherwise, import blank passwords
- exportContacts - Enable this to export contacts. You cannot export as both workers and contacts so if exportWorkers is set to true it will treat exportContacts as false regardless of what value you fill in.
What LDAP Attributes Are Used?
For Workers or Contacts:
- first name - LDAP Attributes: "givenName". If it doesn't get a value it will attempt to parse it out of "displayName", "name", or "uid"
- last name - LDAP Attributes: "sn". If it doesn't get a value it will attempt to parse it out of "displayName", "name", or "uid"
- email - LDAP Attribute: "mail"
- password - LDAP Attribute: "userPassword" (with fallbacks mentioned in the config setting above)
Only for Contacts:
- phone - LDAP Attribute: "telephoneNumber". If it doesn't get a value it will fall back on "mobile".
- organization - LDAP Attribute: "o"
Running the Export
You can start the export with the following command:
You'll be given feedback about the current progress. When the export is complete, you should have several subdirectories inside your outputDir directory.
Should you happen to run into "out of memory" errors while exporting, you can tell the Java VM to use more memory with the -Xmx argument, like so:
Importing the output into Cerb4
You need to move the subdirectories from your outputDir directory into the /cerb4/storage/import/new directory of your new Cerb4 installation. Only includes the contents of outputDir and not the top-level output directory itself. Also be sure to change the owner of the files to your webserver's user, or otherwise alter the permissions since the importer needs to delete the import files as it imports them.
The final step to begin your automatic import is to enable the Background Importing and Synchronization job in Cerb4 -> Helpdesk Setup-> Scheduler. You should set the Run Every option to something reasonable -- not too slow that it takes a week to import your data, but not so fast that you bombard your database with queries. It's difficult to provide a universal default since the right settings depends on many factors: how powerful your server is, what other services your server is providing, if you need to be considerate to other users on the machine, how much data you're importing, etc. There's no harm in beginning the import manually to find an ideal setting before leaving it unattended.
To manually run the import process, open your browser to: /cerb4/cron/cron.import?loglevel=6&reload=0
You can change the value of the &reload= parameter to a number of seconds to wait after finishing an import before starting another batch.
Dealing with import failures
Occasionally, the Cerb4 import process may reject one of your import items. These files will show up in Cerb4's /cerb4/storage/import/fail/ directory under their original export subdirectory. Once your import is finished, you can move these files into the /cerb4/storage/import/new/ directory and run the import process manually to see detailed error messages.