如何在Dockerfile中为Jenkins for LDAPS添加SSL自签名证书?

时间:2016-02-10 00:14:33

标签: jenkins docker dockerfile

我想在Jenkins的安全性下启用LDAPS,但我的LDAP服务器有一个自签名的CERT。有没有人这样做或有一些指示这样做?我必须使用keytool吗?

在我的Dockerfile中,我正在尝试以下操作,但这不起作用:

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

3 个答案:

答案 0 :(得分:14)

事实证明我只需要在Dockerfile中添加它,其中ldap.cer是我自签名证书的证书链。

get-childitem *  -recurse | select-string  "some string"  | select -expandproperty Path | select -uniq

答案 1 :(得分:0)

运行keytool将CA证书导入java密钥库。

请参阅:

telling java to accept self-signed ssl certificate

答案 2 :(得分:0)

在我们的构建服务器上使用 jenkins nexus sonarqube ,我们在主机上使用提取和准备好的cacerts文件docker run的开始参数。

请参阅Stackoverflow "Importing self-signed cert into Docker's JRE cacert is not recognized by the service"

上的答案