3.2.2. 安全设置

未匹配的标注

某些参数设置是敏感的,如果仅靠文件系统的权限去保护是远远不够的。对于这些参数设置,Elasticsearch 提供了一个秘钥库和elasticsearch-keystore 工具来管理秘钥库中的设置。

注意:这里所有的命令都以 Elasticsearch 的用户身份运行。

重要:只有一些参数需要在秘钥库里读取,但是秘钥库没有验证是否支持这些参数,如果这些参数不被认证将会导致 Elasticsearch 无法启动。请参阅文档,秘钥库是否支持每个参数。

注意:对秘钥库的任意修改都只有重启 Elasticsearch 才会生效。

注意:Elasticsearch 秘钥库目前只提供混淆操作,之后将会添加密码保护功能。

这些设置就修改elasticsearch.yml 配置文件中的常规设置一样,需要在集群中的每个节点上指定。目前所有安全参数都需要指定节点,且每个节点的参数都需要相同。

Creating the keystore

创建 elasticsearch.keystore, 使用 create 命令:

bin/elasticsearch-keystore create

文件elasticsearch.keystore 将会跟 elasticsearch.yml一起创建。

Listing settings in the keystore

秘钥库中的参数列表可通过 list 命令获得:

bin/elasticsearch-keystore list

Adding string settings

可使用 add命令添加敏感的字符串,例如云插件的身份验证的凭证:

bin/elasticsearch-keystore add the.setting.name.to.set

工具会提示你输入的值,通过 --stdin方法传递数据:

cat /file/containing/setting/value | bin/elasticsearch-keystore add --stdin the.setting.name.to.set

Adding file settings

你可通过 add-file命令添加敏感文件,例如云插件身份验证秘钥文件。请确保文件路径作为参数在参数名之后:

bin/elasticsearch-keystore add-file the.setting.name.to.set  /path/example-file.json

Removing settings

如从秘钥库删除参数,请使用 remove命令:

bin/elasticsearch-keystore remove the.setting.name.to.remove

Upgrading the keystore

有时候,秘钥库里面格式会改变,从包管理安装 Elasticsearch 时,将在升级期间将磁盘上的秘钥库升级到最新版本。在其他情况下, Elasticsearch 将在节点重启期间重启期间执行升级命令。这就要求 Elasticsearch 对包含秘钥库的目录具有写权限。或者你可以使用 upgrade命令手动更新:

bin/elasticsearch-keystore upgrade

Reloadable secure settings

就像elasticsearch.yml里设置的一样,秘钥库参数的更改不会自动更改正在运行的 Elasticsearch 节点上,重新读取参数需要重启这些节点。但是某些设置被标记成“可自动重载”,此类参数更改之后,将会自动更新到正在运行的节点上。

所有安全设置(无论是否会自动加载)的值在所有集群节点上必须相同,进行设置更改后,使用bin/elasticsearch-keystore add命令之后再调用:

POST  _nodes/reload_secure_settings

这个API将解密并且重新读取每个集群节点上的秘钥库,但仅适用reloadable
类型安全设置。对其他设置的更改在下次重启之前不会生效。重新加载成功,意味着依赖这些设置的所有内部数据结构都已更改,所有设置都被重置了一遍。

更改多个reloadable 安全设置时,会每个集群节点上修改所有设置,然后发出reload_secure_settings调用,而不是在每次修改后就重新加载。

下面是重新加载安全参数的插件r:

本文章首发在 LearnKu.com 网站上。

本译文仅用于学习和交流目的,转载请务必注明文章译者、出处、和本文链接
我们的翻译工作遵照 CC 协议,如果我们的工作有侵犯到您的权益,请及时联系我们。

原文地址:https://learnku.com/docs/elasticsearch73...

译文地址:https://learnku.com/docs/elasticsearch73...

上一篇 下一篇
CrazyZard
贡献者:3
讨论数量: 0
发起讨论 只看当前版本


暂无话题~