Secure Setting (安全设置)
有些设置是敏感的,仅依靠文件系统权限去保护他们的值是不够,Elasticsearch提供了一个秘钥库,并且 elasticsearch-keystore
工具可以管理在秘钥库中的设置项。
![]() |
All commands here should be run as the user which will run elasticsearch. 这里所有的命令都应该被启动elasticsearch的用户来运行 |
![]() |
Only some settings are designed to be read from the keystore. See documentation for each setting to see if it is supported as part of the keystore. 只有一些设置被设计为从密钥库读取。请参阅每个设置的文档,查看是否支持将其作为密钥存储库的一部分。 |
![]() |
All the modifications to the keystore take affect only after restarting Elasticsearch. 所有对秘钥库的修改只有在重启Elasticsearch之后才会生效 |
![]() |
The elasticsearch keystore currently only provides obfuscation. In the future, password protection will be added. 目前Elasticsearch秘钥库只提供模糊处理,以后,将会增加密码保护 |
1. Creating the keystore 创建秘钥库
使用create命令去创建elasticsearch.keystore
./bin/elasticsearch-keystore create
文件elasticsearch-keystore将在elasticsearch.yml旁边被创建。
2. Listing settings in the keystore 列出秘钥库中的设置
秘钥库中的设置列表可通过list命令
./bin/elasticsearch-keystore list
3. Adding string settings 添加字符串设置
敏感的字符串设置,像云插件的身份验证凭证一样,可以使用add命令添加:
bin/elasticsearch-keystore add the.setting.name.to.set
该工具将提示设置的值。要通过stdin传递值,使用——stdin标志:
cat /file/containing/setting/value | bin/elasticsearch-keystore add --stdin the.setting.name.to.set
4. 移除设置项
从秘钥库中移除设置项,可以使用remove命令
bin/elasticsearch-keystore remove the.setting.name.to.remove