I am new to Curl and Cacerts world and facing a problem while connecting to a server. Basically, I need to test connectivity over https from one machine to another machine. I have a URL to which I need to connect from Machine A (a linux machine) I tried this on command prompt
cmd> curl https://[my domain or IP address]
and got the following:
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
On going through some articles over internet I did this:
openssl s_client -connect <domain name or Ip address>:443
and got some response including the
server certificate (inside -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----
).
What should I do next from here. I think, I will have to just copy paste the text inside
BEGIN CERTIFICATE & END CERTIFICATE
and save it in a file.
But,
What type of file it should be? .pem
, .crt
?..
What should I be do after that?
I tried this - copied the text inside BEGIN CERTIFICATE & END CERTIFICATE
and saved it in a .crt
file - named it as my-ca.crt
(also tried the same thing by naming it as my-ca.pem
file)
and then did this:
cmd>curl --cacert my-ca.crt https://[my domain or IP address]
But got the same error.
use
--cacert
to specify a.crt
file.ca-root-nss.crt
for example.Simple solution
That's my everyday script:
Output:
having dignosed the problem I was able to use the existing system default CA file, on debian6 this is:
as root this can be done like:
then re-start the web-server.
you could use this
curl_setopt($curl->curl, CURLOPT_SSL_VERIFYPEER, false);