Last active
January 27, 2022 22:05
-
-
Save hradec/acebd47ffc3c1fe0bf3994cd75d25123 to your computer and use it in GitHub Desktop.
import an ldif file from openldap into a synology ldap server using ldapadd!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run this in the machine running ldap server to export the db to ldif | |
# slapcat -n 0 -l config.ldif | |
# slapcat -n 1 -l data2.ldif' | |
# this mangles the ldif output so it can be import by synology openldap | |
cat data2.ldif | \ | |
sed 's/dc=atomovfx,dc=lan/dc=ldap/g' | \ | |
sed -e 's/Admin/admin/g' -e 's/Users/users/g' -e 's/ou=Group/cn=groups/g' -e 's/ou=/cn=/g' | \ | |
egrep -v 'shadowExp|entryUUID|structuralObjectClass:|creatorsName|createTimestamp|entryCSN|modifiersName|modifyTimestamp' \ | |
> data.ldif | |
ldapadd -h 192.168.0.80 -D uid=root,cn=users,dc=ldap -w Password -f ./data.ldif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment