簡體   English   中英

如何在 HTTPie 中使用 CA(如 curl 的 --cacert)

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

在 curl 中,我可以像這樣使用私鑰、客戶端證書和 ca 證書進行連接

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

我可以在 HTTPie 中看到 --cert 和 --cert-key 選項,但是如何在 HTTPie 中使用 --cacert 選項?

我嘗試將 cert.pem 和 ca.pem 組合在一個新文件中並將其用作我的 --cert 文件,但這不起作用。

我明白了。 在 HTTPie 中,您只需像這樣使用 --verify 傳遞 ca.pem

http --cert cert.pem --cert-key key.pem --verify ca.pem http://example.org

只需要ca.pem 這是正確的要求:

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

ssl_certificate - cert.pem (crt) 和ssl_certificate_key - key.pem (key) 都應該在服務器設置中指明,你不需要在查詢中附加它們。

在此處輸入圖片說明

另一種選擇是利用HTTPie Configurable 選項為任何http調用自動傳遞--verify標志:

~/.config/httpie/config.json

{
    "default_options": [
        "--verify=/path/to/ssl/custom_ca_bundle.pem"
    ]
}

這樣你就可以繼續調用HTTPie,而無需每次都手動傳遞--verify

http https://local.dev

回復:

HTTP/1.1 200 OK
Content-Type: application/json
Server: nginx

...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM