【发布时间】:2015-12-29 14:31:34
【问题描述】:
我有自己的 git 存储库在 jetty-9 下运行。 我想知道如何设置 git 客户端证书,以便我的 git 服务器(码头服务器)能够在 servlet 请求中接收证书,并能够获取 git 客户端证书广告以进行客户端身份验证。
按照我正在尝试运行的命令,
> git -c http.sslcainfo=D:\jetty\punws-sohanba.sigmasys.net.crt -c http.sslCert=D:\jetty\curl-ca-bundle.crt clone "https://punws-sohanba.sigmasys.net:8443/git.ctr-0.0.1-SNAPSHOT/dashboard-portal/.git"
“punws-sohanba.sigmasys.net.crt”是我的服务器证书,以便 git-client 接受自签名证书。
curl-ca-bundle.crt 是 git 全局配置中设置的 git 证书,我也明确尝试通过命令行设置它。 (我不确定我是否以正确的方式这样做)。此 curl-ca-bundle.crt 文件也作为信任库导入到我的 server.jks 文件中。
在服务器上我无法获得证书,
X509Certificate[] certs = (X509Certificate[])req.getAttribute("javax.servlet.request.X509Certificate");
System.out.println("cert name from git client =========>> " + certs[0].getSubjectDN().getName()); //returns null-pointer here
我在命令行上给出以下错误:
fatal: unable to access 'https://punws-sohanba.sigmasys.net:8443/git.ctr-0.0.1-SNAPSHOT/dashboard-portal/.git/': unable to set private key file: 'D:\jetty\curl-ca-bundle.crt' type PEM
请提出建议。
【问题讨论】:
-
如果您完全省略了
-c http.sslCert=D:\jetty\curl-ca-bundle.crt位怎么办?从git help config的输出来看,http.sslCert似乎是用于设置您的 Git 客户端应该为自己使用而不是验证其对等方的证书。 -
如果我省略 http.sslCert ,它会抛出致命的:无法访问
https://punws-sohanba.sigmasys.net:8443/git.ctr-0.0.1-SNAPSHOT/dashboard-portal/.git/': Unknown SSL protocol error in connection to punws-sohanba.sigmasys.net:8443错误
标签: git jetty ssl-certificate pem jetty-9