I'm creating an application that needs to add a new ldap entry in openDJ.
I can think of two possible solutions currently:
Use template to create ldif file, then File.Write
to place it in a directory. Next, have a cronjob check every 2-5 minutes if there is a new file in the directory. If there is, run ldapmodify
to add new entry
The second option is to also create a file in a directory, but then to run ldapmodify
using exec.Command()
I'm leaning towards the second method as it is simpler, but I'm not sure if it is less secure. I've never been a fan of executing shell commands inside a program. And I don't know if there is a performance hit because of it.
I'm open to any suggestions, but those are the two methods I came up with.
Use this LDAP library, or any of the forks. It does support modify and add. Alternatively you can interface the API provided by openLDAP.