From af8a89baf8976c199a04fc70464e3ce66c5dd8ca Mon Sep 17 00:00:00 2001
From: Maxim Thomas <maxim.thomas@gmail.com>
Date: Tue, 22 Jul 2025 07:26:06 +0000
Subject: [PATCH] [#530] Fixed error when creating a backend for BASE_DN with OU in Docker (#531)
---
opendj-packages/opendj-docker/bootstrap/setup.sh | 18 ++++++------------
opendj-doc-generated-ref/src/main/asciidoc/admin-guide/chap-import-export.adoc | 22 +++++++++++++++++++++-
2 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/opendj-doc-generated-ref/src/main/asciidoc/admin-guide/chap-import-export.adoc b/opendj-doc-generated-ref/src/main/asciidoc/admin-guide/chap-import-export.adoc
index c96922b..f6d2891 100644
--- a/opendj-doc-generated-ref/src/main/asciidoc/admin-guide/chap-import-export.adoc
+++ b/opendj-doc-generated-ref/src/main/asciidoc/admin-guide/chap-import-export.adoc
@@ -12,7 +12,7 @@
information: "Portions copyright [year] [name of copyright owner]".
Copyright 2017 ForgeRock AS.
- Portions Copyright 2024 3A Systems LLC.
+ Portions Copyright 2025 3A Systems LLC.
////
:figure-caption!:
@@ -348,6 +348,26 @@
index-entry-limit : 4000
writability-mode : enabled
----
+
+If you want to add a base entry, create a template file with the base DN, for example `base.template`:
+[source]
+----
+branch: dc=example,dc=com
+----
+
+And then use the `import-ldif` tool to import a template file as shown in the following example:
+
+[source, console]
+----
+$ /opt/opendj/bin/import-ldif \
+ --templateFile base.template \
+ --backendID myData \
+ --bindDN "cn=Directory Manager" \
+ --bindPassword password
+----
+
+For details see xref:../reference/admin-tools-ref.adoc#import-ldif-1[import-ldif(1)] in the __Reference__.
+
Alternatively, you can create a new backend in OpenDJ control panel (Directory Data > New Base DN > Backend > New Backend: __backend-name__).
When you create a new backend using the `dsconfig` command, OpenDJ directory server creates the following indexes automatically:
[none]
diff --git a/opendj-packages/opendj-docker/bootstrap/setup.sh b/opendj-packages/opendj-docker/bootstrap/setup.sh
index 084fd2b..b409bbd 100755
--- a/opendj-packages/opendj-docker/bootstrap/setup.sh
+++ b/opendj-packages/opendj-docker/bootstrap/setup.sh
@@ -41,18 +41,12 @@
--set enabled:true --no-prompt --trustAll
if [ "$ADD_BASE_ENTRY" = "--addBaseEntry" ]; then
-
- DC=$(echo "$BASE_DN" | awk -F',|=' '{print $2}')
-
- /opt/opendj/bin/ldapmodify --hostname localhost \
- --port 1636 --bindDN "$ROOT_USER_DN" --bindPassword "$ROOT_PASSWORD" \
- --useSsl --trustAll <<EOF
-dn: $BASE_DN
-dc: $DC
-objectClass: domain
-objectClass: top
-EOF
-
+ echo "creating base entry..."
+ BASE_TEMPLATE=$(mktemp)
+ echo "branch: $BASE_DN" > $BASE_TEMPLATE
+ /opt/opendj/bin/import-ldif --templateFile $BASE_TEMPLATE \
+ --backendID=userRoot --bindDN "$ROOT_USER_DN" --bindPassword "$ROOT_PASSWORD"
+ rm $BASE_TEMPLATE
fi
--
Gitblit v1.10.0