现在尝试发送与上面相同的请求到服务器:
$ curl --cacert /path/to/ca.crt https://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -v
该请求会被服务器拒绝:
…
routines:SSL3_READ_BYTES:sslv3 alert bad certificate
…
要想请求成功,我们需要将CA签名的客户端证书发送给服务器:
$ curl --cacert /path/to/ca.crt --cert /path/to/client.crt --key /path/to/client.key \
-L https://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -v
输出为:
…
SSLv3, TLS handshake, CERT verify (15):
…
TLS handshake, Finished (20)
还有来自服务器的响应:
{
“action”: “set”,
“node”: {
“createdIndex”: 12,
“key”: “/foo”,
“modifiedIndex”: 12,
“value”: “bar”
}
}
四、集群中的传输安全和客户端证书
对于对等通信,etcd 支持与上述相同的模型,这意味着集群中的 etcd 成员之间的通信。
Assuming we have our ca.crt
and two members with their own