rafaelcosman
rafaelcosman

Reputation: 2599

SSL handshake failure w/ self-signed certificates

When I run curl -k https://localhost:8080/ from the terminal, I get the following error:

curl: (35) error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

Code: (language is coffeescript)

https = require 'https'

fs = require 'fs'

options = 
  key: fs.readFileSync('server.key')
  cert: fs.readFileSync('server.crt')
  requestCert: false
  rejectUnauthorized: false

server = https.createServer(options, 
  (req, res) =>
    console.log "TEST"
)

server.listen(process.env.PORT, process.env.IP)

Other info: I'm running these on Cloud9's UNIX machines. The certificates are free, self-signed things.

Upvotes: 0

Views: 2414

Answers (1)

rafaelcosman
rafaelcosman

Reputation: 2599

From: http://www.akadia.com/services/ssh_test_certificate.html,

"During the generation of the CSR, you will be prompted for several pieces of information. These are the X.509 attributes of the certificate. One of the prompts will be for "Common Name (e.g., YOUR name)". It is important that this field be filled in with the fully qualified domain name of the server to be protected by SSL. If the website to be protected will be https://public.akadia.com, then enter public.akadia.com at this prompt."

A mismatch between the "Common Name" in the certificate and the URL that you are curling will cause exactly the issue that you're encountering! Try regenerating your certificate with "Common Name" as your fully specified URL.

Upvotes: 1

Related Questions