繁体   English   中英

Keycloak:在 docker 中为 ldaps 设置自签名证书

[英]Keycloak: setting up self-signed certificate for ldaps in docker

我正在使用 docker-compose 运行 keycloak,如下所述: 官方 docker 撰写示例

该实例在作为反向代理的 apache2 后面运行,执行 SSL 终止,效果很好。

我想添加 ldap 作为用户存储提供程序。 ldap 服务器是可访问的(“测试连接”表示成功)但我无法连接,因为 keycloak 需要信任我的自签名证书,这是 ldaps 连接所需的。 错误是:

Error when authenticating to LDAP: Could not negotiate TLS

如何让 keycloak 在 docker-compose 的上下文中信任我的 Active Directory (ldap) 服务器的 CA 证书?

这一切都归结为在 Docker 构建中获取 CA 证书,然后将其导入 java 密钥库:

# JDK8 installation just for reference. You might want to update soon, since it is EOL soon
RUN apt update && apt install -y openjdk-8-jdk

# COPY your root CA cert from the docker build directory to the container
COPY ca.mydomain.com.crt /usr/local/share/ca-certificates/mydomain.com/ca.fs-stuttgart.de.crt

# import the root CA cert from the file location within your container to the java cacerts
RUN keytool -storepass changeit -noprompt -trustcacerts -import -alias mydomain.com -keystore /etc/ssl/certs/java/cacerts -file /usr/local/share/ca-certificates/mydomain.com/ca.mydomain.com.crt

从此时起,keycloak(引用 java cacerts )会将您的根 CA 识别为有效权限

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM