Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a CA (like curl's --cacert) with HTTPie

Tags:

curl

ssl

httpie

In curl I can connect with a private key, client cert, and a ca cert like this

curl --cert cert.pem --key key.pem --cacert ca.pem https://example.org

I can see the --cert and --cert-key options in HTTPie, but how could I use the --cacert option in HTTPie?

I tried combining cert.pem and ca.pem in a new file and using that as my --cert file, but that didn't work.

like image 955
Ahmadster Avatar asked Dec 04 '22 22:12

Ahmadster


2 Answers

Only ca.pem is required. This is correct request:

http --verify /etc/nginx/ssl/myCA.pem https://local.dev                              

Both ssl_certificate - cert.pem (crt) and ssl_certificate_key - key.pem (key) should be indicated in server settings, sho you do not need attach them in query.

enter image description here

like image 32
Daniel Avatar answered Dec 31 '22 13:12

Daniel


I got it. In HTTPie you just pass the ca.pem using --verify like this

http --cert cert.pem --cert-key key.pem --verify ca.pem http://example.org
like image 129
Ahmadster Avatar answered Dec 31 '22 12:12

Ahmadster