简体   繁体   中英

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed - rake task to external API

I am trying to build a rake task that accesses the API of viglink, a url affiliating service.

However, when my rake task runs open(url), where url is an https uri, the error I get is:

rake aborted!
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I tried to fix this using this answer, but I get the same error

OpenSSL::SSL::SSLError on Heroku

Is anyone having a similar issue that isn't solved with the above ? I'm running this on a Digital Ocean droplet on Ubuntu 12.04.4 LTS (GNU/Linux 3.8.0-29-generic x86_64)

relevant part of my rake task:

  url = "https://www.viglink.com/service/v1/cuidRevenue?lastDate=2014%2F12%2F23&period=week&secret=0d0dfillerb57acb4"
  response = open(url)

The error happens on the 2nd line.

Happy holidays!

Ran into the same problem when everyone started removing SSLv3 support. Your target site has done the same:

nmap --script ssl-enum-ciphers -p 443 www.viglink.com

Starting Nmap 6.40 ( http://nmap.org ) at 2014-12-25 08:16 EST
Nmap scan report for www.viglink.com (192.155.80.114)
Host is up (0.083s latency).
rDNS record for 192.155.80.114: li566-114.members.linode.com
PORT    STATE SERVICE
443/tcp open  https
| ssl-enum-ciphers:
|   SSLv3: No supported ciphers found
|   TLSv1.0:
|     ciphers:
|       TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA - strong
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA - strong
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA - strong
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA - strong
|       TLS_RSA_WITH_AES_128_CBC_SHA - strong
|       TLS_RSA_WITH_AES_256_CBC_SHA - strong
|     compressors:
|       NULL
|_  least strength: strong

Nmap done: 1 IP address (1 host up) scanned in 4.47 seconds

Solution is to update openssl on your machine.

openssl version
OpenSSL 1.0.1f 6 Jan 2014

My response without error:

require 'open-uri'
url = 'https://www.viglink.com/'
response = open(url)
# => #<Tempfile:/tmp/open-uri20141225-19253-qhcgcg>
puts response.base_uri
# => https://www.viglink.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM