繁体   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