【发布时间】:2017-05-19 12:22:48
【问题描述】:
我无法将文档中的内容付诸实践。我正在尝试使用证书对保管库服务进行身份验证。 documentation 说:
通过 API
登录的端点是 /login。客户端只需连接 他们的 TLS 证书,当登录端点被命中时,auth 后端将确定是否有匹配的可信证书 验证客户端。或者,您可以指定单个 要进行身份验证的证书角色。
$ curl --cacert ca.pem --cert cert.pem --key key.pem -d name=web \ $VAULT_ADDR/v1/auth/cert/login -XPOST
现在我要验证的节点 IP:Port 是 17.2.24.13:8200
以下是我在远程服务器上所做的事情。
openssl s_client -showcerts -connect 17.2.24.13:8200
这会导致一个巨大的输出,其中包含一个部分 ::
-----BEGIN CERTIFICATE-----
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
-----END CERTIFICATE-----
现在我相信这是 Vault 需要的证书。
所以我把上面的输出写入vault.cer文件
现在我将使用vault.cer 进行身份验证。所以我运行下面的命令。
curl --cert vault.crt https://17.2.24.13:8200/v1/auth/cert/login -XPOST
但我得到的错误是:
curl: (60) Certificate key usage inadequate for attempted operation.
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
如果我添加 -k 标志,我会收到以下错误。
# curl -k --cert vault.crt https://17.2.24.13:8200/v1/auth/cert/login -XPOST
{"errors":["client certificate must be supplied"]}
所以我真的很困惑,在这种情况下我真正错过了什么。
【问题讨论】: