如何在RubyGems注册表中使用TLS客户端证书?

时间:2019-04-23 18:30:24

标签: ruby ssl bundler

我有一个内部RubyGems注册表,我想从中下载一些Gems。注册表受到保护,并且需要有效的TLS客户端证书。

我能够访问Chrome中的注册表(将证书捆绑导入Chrome中),但是我无法使用Bundler做到这一点。

documentationssl_client_cert必须是:

  

指向包含X.509客户端证书和PEM格式的密钥的文件的路径。

使用提供的证书时出现以下错误:

either PUB key nor PRIV key: nested asn1 error

如何组装证书和密钥?

1 个答案:

答案 0 :(得分:0)

我终于找到了如何组装文件:

# Concatenate the key and the certificate
openssl rsa -in key.pem > ruby-bundler-cert.pem 
openssl x509 -in cert.pem >> ruby-bundler-cert.pem
# Tell bundler to use the file 
bundle config ssl_client_cert ~/certs/ruby-bundler-cert.pem

您认为这够了吗?没有!您还需要在其他位置指定此值:在~/.gemrc文件中。

:ssl_client_cert: "/full/path/to/the/certs/ruby-bundler-cert.pem"

希望这对其他人有帮助。

相关问题