Elasticsearch安全策略-开启密码账号访问

关于版本

内容 版本
Elasticsearch版本 7.2.0

Elasticsearch 启用安全策略

根据官方文档,Elasticsearch 启用安全策略需要下面的步骤。

  1. 验证当前版本是否支持安全功能

  2. 是否打开安全设置

  3. 基于FIPS的一些验证

  4. 配置节点间通讯传输的安全性

  5. 配置内置用户的密码

  6. 选择用户验证用户身份的领域类型

  7. 设置角色和用户以控制对Elasticsearch的访问

  8. 启用审核以跟踪与Elasticsearch集群的尝试和成功的交互

上面是所有安全策略需要配置的内容,但是对于仅仅是启用账号密码这种最处理的安全策略我们只需要考虑下面几步。

  1. 验证当前版本是否支持安全功能
  2. 是否打开安全设置
  3. 配置节点间通讯传输的安全性
  4. 配置内置用户的密码
  5. (假如使用了kibana)修改kibana的配置

1. 验证当前版本是否支持安全功能

Elasticsearch的安全策略需要X-Pack插件的支持,不过对于7.X以上版本X-Pack已经内置,所以不需要额外的操作。

而关于安全功能的支持,根据官方的购买说明(https://www.elastic.co/cn/subscriptions) 除了开源版之外其他版本都支持安全策略。

2. 是否打开安全设置

xpack.security.enabled控制安全配置的开启,在默认情况下此参数被设置为false。要想开启安全策略需要在所有集群中讲此参数进行设置

xpack.security.enabled = true

3. 配置节点间通讯传输的安全性

仅仅开启安全设置再启动服务的时候会抛出错误

[2]: Transport SSL must be enabled if security is enabled on a [basic] license. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]

这是因为传输网络层用于集群中节点之间的内部通信。启用安全功能后,必须使用TLS来确保节点之间的通信已加密。为节点间通讯配置安全策略需要两个步骤:

  1. 生成节点间安全策略使用的证书

  2. 修改各个节点的安全配置

3. 1 创建证书颁发机构以及为节点生成证书

在Elasticsearch集群中验证证书真实性的推荐方法是信任签署证书的证书颁发机构(CA)。这样,将节点添加到群集后,它们只需要使用由同一CA签名的证书,即可自动允许该节点加入群集。另外证书中可以包含与节点的IP地址和DNS名称相对应的主题备用名称
,以便可以执行主机名验证。

*为Elasticsearch集群创建发证机构

使用下面的步骤为集群创建一个CA授权证书,

bin/elasticsearch-certutil ca

整个创建过程是这样的。在输入命令后控制台会输出此命令的信息描述,然后你需要先执行{①}的操作然后执行{②}的操作

This tool assists you in the generation of X.509 certificates and certificate
signing requests for use with SSL/TLS in the Elastic stack.

The 'ca' mode generates a new 'certificate authority'
This will create a new X.509 certificate and private key that can be used
to sign certificate when running in 'cert' mode.

Use the 'ca-dn' option if you wish to configure the 'distinguished name'
of the certificate authority

By default the 'ca' mode produces a single PKCS#12 output file which holds:
    * The CA certificate
    * The CA's private key

If you elect to generate PEM format certificates (the -pem option), then the output will
be a zip file containing individual files for the CA certificate and private key

Please enter the desired output file [elastic-stack-ca.p12]:  {
   
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大·风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值