当前位置:网站首页>ELK - X-Pack设置用户密码
ELK - X-Pack设置用户密码
2022-06-11 11:27:00 【如锋】
之前记录过怎样使用Nginx代理为Kibana添加登录验证功能,但其实Elastic本身也提供了基本的访问控制功能。
虽然相关功能在X-Pack里,但还是可以免费使用的。
参考官网subscriptions,可以看到在Basic License下的Security项目中包含了Role-based access control。
Enable X-Pack Security
Elasticsearch设置密码命令如下。
$ sudo /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
Unexpected response code [500] from calling GET http://192.168.1.88:9200/_security/_authenticate?pretty
It doesn't look like the X-Pack security feature is enabled on this Elasticsearch node.
Please check if you have enabled X-Pack security in your elasticsearch.yml configuration file.
ERROR: X-Pack Security is disabled by configuration.
设置前,需要先enable X-Pack security。
sudo vi /etc/elasticsearch/elasticsearch.yml
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
SSL也要同时enable,否则报错。
[2019-10-10T15:11:09,630][ERROR][o.e.b.Bootstrap ] [appserver01] node validation exception
[1] bootstrap checks failed
[1]: 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]
现在可以开始设置密码。
可以看到Elasticsearch预置了许多角色和用户。
$ sudo /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana]:
Reenter password for [kibana]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
重启
sudo systemctl restart elasticsearch.service
需要加密码才能访问。
$ curl localhost:9200
{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}(base)
$ curl localhost:9200 -uelastic:<password>
{
"name" : "appserver01",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "wCDlDy6UTriUSuZuDrqWrw",
"version" : {
"number" : "7.3.2",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "1c1faf1",
"build_date" : "2019-09-06T14:40:30.409026Z",
"build_snapshot" : false,
"lucene_version" : "8.1.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
Update Kibana Configure
After password setup in Elasticsearch, have to update configure for Kibana, Logstash and Beats.
e.g. Kibana
sudo vi /etc/kibana/kibana.yml
# sudo vi /etc/heartbeat/heartbeat.yml
elasticsearch.username: "elastic"
elasticsearch.password: "<password>"
sudo systemctl restart kibana.service
After restart, refresh Kibana and you will be asked for username and password now.
To change the password, can go to Kibana Management -> Security -> Users.

Or change data in Elasticsearch directly.
POST /_security/user/elastic/_password
{
"password": "123456"
}
边栏推荐
- Gerber文件在PCB制造中的作用
- 【C语言】anonymous/unnamed struct&&union
- 收货地址列表展示【项目 商城】
- 2022年最好的年金险产品是什么?
- SpingBoot+Quartrz生产环境的应用支持分布式、自定义corn、反射执行多任务
- Is the securities account opened by qiniu Gang safe and reliable?
- NFT digital collection app system construction
- MYCAT sub database and sub table
- AcWing 1944. 记录保存(哈希,STL)
- 找到自己的优势,才能干活不累,事半功倍!
猜你喜欢

Lifeifei: I am more like a scientist in physics than an engineer

导师转我800块,让我仿真一个电路(电源设计)

JS prototype. The find () method has no effect on the object array. It is urgent...
![[file upload vulnerability 05] server suffix detection and bypass experiment (based on upload-labs-3 shooting range)](/img/f5/52bc5e01bb0607b6ecab828fb70c93.jpg)
[file upload vulnerability 05] server suffix detection and bypass experiment (based on upload-labs-3 shooting range)

使用Yolov3训练自己制作数据集,快速上手
![my.cnf中 [mysql]与[mysqld] 的区别 引起的binlog启动失败的问题](/img/bd/a28e74654c7821b3a9cd9260d2e399.png)
my.cnf中 [mysql]与[mysqld] 的区别 引起的binlog启动失败的问题

Exploration of kangaroo cloud data stack on spark SQL optimization based on CBO

Using domestic MCU (national technology n32g031f8s7) to realize pwm+dma control ws2812

Interpretation of cube technology | past and present life of cube Rendering Design

js中Array.prototype.find() 方法在对象数组上无效果,捉急。。。
随机推荐
使用Yolov5训练好模型调用电脑自带摄像头时出现问题:TypeError: argument of type “int‘ is not iterable的解决方法
CPU负载怎么理解
收货地址列表展示【项目 商城】
Node connects to MySQL database and writes fuzzy query interface
How to solve the problem that high-precision positioning technologies such as ultra wideband UWB, Bluetooth AOA and RTK cannot be widely used due to their high cost? Adopt the idea of integrated deplo
Summary of information of main account of Chia Tai futures on Wednesday in advance
木瓜移动CFO刘凡 释放数字时代女性创新力量
Mongodb usage
[go] interpretation of gin source code
Problems encountered when using nailing intranet to penetrate and upload PHP projects
Interview experience of Xiaomi Android development post~
WordPress用户名修改插件:Username Changer
JS prototype. The find () method has no effect on the object array. It is urgent...
web开发选型,web开发毕业谁
Command mode - attack, secret weapon
AcWing 1944. 记录保存(哈希,STL)
Template engine - thymeleaf
[file upload vulnerability 05] server suffix detection and bypass experiment (based on upload-labs-3 shooting range)
Is it safe for Xiaobai to open an account directly on the flush?
WordPress site link modification plug-in: Velvet Blues update URLs