如何在 Dockerfile 中为 LDAPS 向 Jenkins 添加 SSL 自签名证书? [英] How to add a SSL self-signed cert to Jenkins for LDAPS within Dockerfile?
本文介绍了如何在 Dockerfile 中为 LDAPS 向 Jenkins 添加 SSL 自签名证书?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 Jenkins 中安全地启用 LDAPS,但我的 LDAP 服务器有一个自签名 CERT.有没有人这样做过或有一些关于这样做的指示?我必须使用 keytool 吗?
I want to enable LDAPS under security in Jenkins but my LDAP server has a self-signed CERT. Has anyone done this or have some pointers on doing this? Do I have to use keytool?
在我的 Dockerfile 中,我正在尝试以下操作,但这不起作用:
In my Dockerfile I'm trying the following but this won't work:
FROM jenkins
USER root
# Install CA certs
COPY ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
RUN chmod +r /etc/ssl/certs/ca-certificates.crt
# Install the Jenkins plugin
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt
# Expose container port 33838 for Jenkins UDP-based auto-discovery
EXPOSE 33848/udp
ENV JAVA_OPTS -Xmx2048m
推荐答案
原来我只需要在 Dockerfile 中添加这个,其中 ldap.cer 是我的自签名证书的证书链.
It turns out I just need to add this in the Dockerfile where ldap.cer is the cert chain for my self-signed cert.
COPY ldap.cer $JAVA_HOME/jre/lib/security
RUN
cd $JAVA_HOME/jre/lib/security
&& keytool -keystore cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias ldapcert -file ldap.cer
这篇关于如何在 Dockerfile 中为 LDAPS 向 Jenkins 添加 SSL 自签名证书?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文