Add ubuntu self-signed certificate for use with curl

I am developing a program in which I have a virtual development server that works with a self-signed certificate. My program uses curl to connect to the server and retrieve information, but this must be done using SSL. When I try to connect, I get the error "SSL certificate error, make sure the CA certificate is in order." When starting firefox, I can only add the certificate in firefox, but this does not help me with a twist. How to add a certificate for curls to recognize?

curl 7.19.7 (x86_64-pc-linux-gnu) libcurl / 7.19.7 OpenSSL / 0.9.8k zlib / 1.2.3.3 libidn / 1.15 Protocols: tftp ftp telnet dict ldap ldaps http https ftps file Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

Ubuntu 10.04 Lucid Lynx 64bit

+7
source share
3 answers

This is one of the ways that worked for me:

First get the CA certificate from the development domain and save it to a file called "logfile". (Assuming port 443 for SSL)

openssl s_client -connect xxxxx.com:443 |tee logfile

Then use the -cacert curl option to use the saved certificate file.

curl --cacert logfile **THE REST OF YOUR CURL COMMAND**

Source: http://curl.haxx.se/docs/sslcerts.html

+10
source

I would copy the certificate to /usr/local/share/ca-certificates/.

man- update-ca-Certificates:

, .crt, /usr/local/share/ca-Certificates, .

+7

Add your rootCA.pem to the directory /usr/share/ca-certificates.

After that, update your certificates using the command: update-ca-certificates --fresh.

I just did this and it works great.

+5
source

All Articles