关于Debian ,使用GitLab ,我的自签名证书遇到了问题。
在网上进行大量搜索后通读代码(我想,这是最后的手段, FOSS 很有帮助),我在 gitlab-shell/lib/gitlab_net.rb< 中找到了以下几行
这让我……很困惑。
if config.http_settings['self_signed_cert']
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
到目前为止,关于我遇到的各种问题的大多数 Stack Overflow 回复都让我相信 VERIFY_NONE 正如您所期望的那样,不会验证任何内容。根据我的阅读,VERIFY_PEER 似乎是自签名的正确设置。
当我阅读它时,感觉就像采取措施使用证书来保护我的连接,然后决定不使用它?这是一个错误,还是我误读了源代码?
最佳答案
gitlab-shell(在 GitLab 服务器上)必须通过 HTTPS 或 SSH URL API 与 GitLab 实例进行通信。
如果它是自签名证书,则在尝试访问这些 GitLab URL 时不希望出现任何错误/警告,因此使用 SSL::VERIFY_NONE
。
但是,客户端(在 GitLab 服务器外部)也使用相同的证书,通过浏览器使用相同的 GitLab HTTPS URL。
对于他们来说,自签名证书很有用,只要他们将其安装在浏览器 keystore 中即可。
对于这些交易(GitLab 的客户端),证书将被“验证”。
OP Kheldar 中的 point's out Mislav's post:
OpenSSL expects to find each certificate in a file named by the certificate subject’s hashed name, plus a number extension that starts with 0.
That means you can’t just drop
My_Awesome_CA_Cert.pem
in the directory and expect it to be picked up automatically.
However, OpenSSL ships with a utility calledc_rehash
which you can invoke on a directory to have all certificates indexed with appropriately named symlinks.
(例如 OpenSSL Verify location )
cd /some/where/certs
c_rehash .
关于ssl - GitLab中的OpenSSL,自签名证书如何验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22274561/