自行生成的证书,启用了https后,es8无法生成口令
./bin/elasticsearch-create-enrollment-token -s kibana --url "https://172.16.8.8:9200"
提示
ERROR: Unable to create an enrollment token. Elasticsearch node HTTP layer SSL configuration Keystore doesn't contain any PrivateKey entries where the associated certificate is a CA certificate
在其他地方看见也有类似的提问没有找到解决办法。
https://discuss.elastic.co/t/...
请教下如何解决?
This Q&A in English:my github pages
错误分析
错误信息中说的是,ES 节点的 HTTP 层 SSL 配置的 Keystore 不包含 PrivateKey 类型的证书,这里你可以用命令去验证一下:
结果大概如下:
其中的
TrustedCertEntry
是在官方文档 Basic Security plus HTTPS 步骤中生成 HTTP PKCS12 Keystore 时,使用在 Basic Security 步骤生成的 Keystore 作为 CA Cert 自动导入的。但 ES 需要的是一个证书颁发机构提供的
PrivateKeyEntry
,也就是说,你需要的是像下面这样的输出:因此我们把上面
TrustedCertEntry
替换为PrivateKeyEntry
即可。解决步骤
Step 1
注意: 这一步一般我们都已经完成了,如果没有后续做什么操作去改变已生成的 Keystore,可以跳过这一步。
按照官方文档 Basic Security 操作会得到一个包含了 CA Cert 的 PKCS12 Keystore,默认文件名是 elastic-stack-ca.p12
通过 Basic Security plus HTTPS 生成 HTTP PKCS12 Keystore,默认会生成一个压缩文件,解压后得到默认文件名是 http.p12 的 Keystore
Step 2
把包含 CA Cert 的 Keystore 作为 PrivateKeyEntry 类型重新导入:
会被问是否覆盖:
验证一下:
如果以上操作没有差错,会出现像下面的结果:
此时之前的
TrustedCertEntry
已经变成PrivateKeyEntry
.此外记得按官方文档,检查/添加 ES 配置中的证书的密码到 ES 的 Keystore 里:
如果有设置 transport 证书,也同样需要添加:
接下来启动 node 之后就可以使用
bin/elasticsearch-create-enrollment-token
生成 token 了:其他
官方已经有一个 issue 来追踪这个问题:issue: Generating enrolment token for Kibana should not require the CA key