SSL对等证书或SSH远程密钥不正常(Curl :: Error :: SSL对等证书错误)

时间:2014-07-24 07:20:00

标签: ruby ubuntu curb

我在ubuntu上遇到了错误,但在mac

上工作

但是如果我在ubuntu上运行curl命令,它就可以了。遏制一个小虫宝石?

2.1.0/gems/curb-0.8.6/lib/curl/easy.rb:72:in `perform': SSL peer certificate or SSH remote key was not OK (Curl::Err::SSLPeerCertificateError)

RUBY

resp = Curl::Easy.http_post(server_url, content_to_send) do |curl|
  curl.ssl_verify_peer = false
  curl.headers = header.clone
end

详细

/home/poc/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/curb-0.8.6/lib/curl/easy.rb:72:in `perform': SSL peer certificate or SSH remote key was not OK (Curl::Err::SSLPeerCertificateError)
    from /home/poc/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/curb-0.8.6/lib/curl/easy.rb:398:in `http_post'
    from /home/poc/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/curb-0.8.6/lib/curl/easy.rb:398:in `http_post'
    from curb.rb:12:in `curl_query'
    from curb.rb:21:in `<main>'

1 个答案:

答案 0 :(得分:1)

我遇到了同样的错误,对于你需要的Linux机器ssl_verify_host=0

为了安全起见,我同时使用两者:

resp = Curl::Easy.http_post(server_url, content_to_send) do |curl|
  curl.ssl_verify_peer = false
  curl.ssl_verify_host = 0
  curl.headers = header.clone
end

另外还有一个问题 - 您可能正在使用mac进行开发,但是部署到运行Linux的服务器上,因此即使在Mac上也能更好地使用它们。