docker - 如何连接到 OpenDJ LDAP 服务器 (Docker)

标签 docker ldap opendj

我正在尝试连接(绑定(bind))到 Docker 中的 OpenDJ 服务器。

(我知道如何连接到常规(不是 Docker)OpenDJ 服务器)

OpenDJ 似乎可以运行,但是当我尝试使用 ldap 浏览器连接它时,它显示“无法连接”

          --- Server Status ---
Server Run Status:        Started
Open Connections:         1

          --- Server Details ---
Host Name:                14e1e92e962e
Administrative Users:     cn=Directory Manager
Installation Path:        /opt/opendj
Instance Path:            /opt/opendj/data
Version:                  OpenDJ Server 4.4.3
Java Version:             1.8.0_111
Administration Connector: Port 4444 (LDAPS)

          --- Connection Handlers ---
Address:Port : Protocol               : State
-------------:------------------------:---------
--           : LDIF                   : Disabled
0.0.0.0:161  : SNMP                   : Disabled
0.0.0.0:1389 : LDAP (allows StartTLS) : Enabled
0.0.0.0:1636 : LDAPS                  : Enabled
0.0.0.0:1689 : JMX                    : Disabled
0.0.0.0:8080 : HTTP                   : Disabled

          --- Data Sources ---
Base DN:     dc=example,dc=com
Backend ID:  userRoot
Entries:     1
Replication:
[root@localhost ~]# docker ps
CONTAINER ID        IMAGE                         COMMAND                CREATED             STATUS              PORTS                          NAMES
14e1e92e962e        openidentityplatform/opendj   "/opt/opendj/run.sh"   18 hours ago        Up 18 hours 
[root@localhost ~]# ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:5ff:fe0f:a03  prefixlen 64  scopeid 0x20<link>
        ether ********  txqueuelen 0  (Ethernet)
        RX packets 5  bytes 254 (254.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7  bytes 647 (647.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.89  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::1db8:91e1:5276:4f9  prefixlen 64  scopeid 0x20<link>
        ether ********  txqueuelen 1000  (Ethernet)
        RX packets 796434  bytes 512206712 (488.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 479946  bytes 41277150 (39.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@localhost ~]# docker run -it 1e03b62c213e /bin/bash
Instance data Directory is empty. Creating new DJ instance
BASE DN is dc=example,dc=com
Password set to password
Running /opt/opendj/bootstrap/setup.sh
Setting up default OpenDJ instance

Configuring Directory Server ..... Done.
Configuring Certificates ..... Done.
Creating Base Entry dc=example,dc=com ..... Done.
Starting Directory Server ...... Done.

To see basic server configuration status and configuration, you can launch
/opt/opendj/bin/status

Server Run Status:        Started

LDAP 服务器在 192.168.0.89 上运行,端口为 1389。所以我尝试使用以下连接。我也无法获取 Base DN。我也尝试手动放置 BaseDN。我尝试了 172.17.0.1,但没有运气。 (好像是一个docker ip。(ifconfig))

问题:
但是使用 docker,我需要不同的主机名吗?还是IP?或者需要额外的配置设置? (顺便说一句,我将IP放入主机名并成功连接了很多次。)

enter image description here

enter image description here

enter image description here

错误消息:

Error while opening connection - Unable to connect java.lang.Exception: Unable to connect at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper$1.run(DirectoryApiConnectionWrapper.java:251) at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.runAndMonitor(DirectoryApiConnectionWrapper.java:1312) at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.doConnect(DirectoryApiConnectionWrapper.java:281) at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.connect(DirectoryApiConnectionWrapper.java:172) at org.apache.directory.studio.connection.core.jobs.OpenConnectionsRunnable.run(OpenConnectionsRunnable.java:111) at org.apache.directory.studio.connection.core.jobs.StudioConnectionJob.run(StudioConnectionJob.java:109) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)

Unable to connect

最佳答案

您需要发布端口 13891636 .

将您的 docker run 命令更改为

docker run -it -p 1389:1389 -p 1636:1636 <image ID> /bin/bash

你也可以运行你的容器是host networking mode不需要的地方port mapping .
docker run -it --net=host <image ID> /bin/bash

希望这可以帮助。

关于docker - 如何连接到 OpenDJ LDAP 服务器 (Docker),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57882403/

相关文章:

c# - web api 无法在 azure 上的 Linux 容器中使用 Net Core 3 Web api 启动

c# - .net C# 中的 LDAP 连接

node.js - Nodejs 上的 ldap auth - 不断收到 32 No Such Object

ldapsearch - 截断结果

java - OpenAM OpenDJ dockerization 问题 : Fails to redeploy using old data source

amazon-web-services - Amazon ECS故障排除任务启动失败

linux - 从 arm32v7 golang 镜像构建 docker 镜像时出现 exec 格式错误

python - 在 amazon/aws-cli docker 镜像上安装 python 3.9

java - 使用 Grails 和 LDAP 自动创建用户详细信息