Elastic Stack之用户认证

32 篇文章 0 订阅
29 篇文章 2 订阅

You enable the Elasticsearch security features and then create passwords for built-in users.
Elastic Search开启用户认证,包括增加安全配置项【xpack.security.enabled: true】、给内置用户设置密码【elasticsearch-setup-passwords interactive】等,最后使用浏览器等验证效果。

一、新增:安全配置项

文件:安装路径 / config / elasticsearch.yml

xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

config

二、内置用户设置密码

./bin/elasticsearch-setup-passwords interactive

在这里插入图片描述

三、重启服务

重启参数:-d

nohup bin/elasticsearch -d &

四、查看效果

4.1、浏览器

basicauth
ok

4.2、Postman

选择认证方式,填入用户密码:Authorization ——》Type——》Basic Auth
postman

4.3、python程序调用

def get_all_index():
    import requests
    from requests.auth import HTTPBasicAuth
    url = 'http://192.168.0.149:9200/_cat/indices?format=json'
    res = requests.get(url, auth=HTTPBasicAuth('elastic', 'elastic'))
    if res:
        print(res.json())
    else:
        print(res.status_code, res.content)

print

五、官网摘抄

The Elastic Stack authenticates users by identifying the users behind the requests that hit the cluster and verifying that they are who they claim to be. The authentication process is handled by one or more authentication services called realms. A realm is used to resolve and authenticate users based on authentication tokens.
The Elastic Stack security features provide built-in realms such as native,ldap, active_directory, pki, file, saml, and oidc. If none of the built-in realms meet your needs, you can also build your own custom realm and plug it into the Elastic Stack.
The security features provide two services: the token service and the api key service.
官网:User authentication | Elasticsearch Guide [7.15] | Elastic

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值