ELK - X-Pack设置用户密码

enable X-Pack security

vi elasticsearch.yml

#首先开启x-pack插件

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]

# 进入容器

Docker exec -it id bash

cd bin

elasticsearch-setup-passwords interactive

[root@f18d8bc7b8f5 elasticsearch]# cd bin

[root@f18d8bc7b8f5 bin]# ls

elasticsearch           elasticsearch-croneval       elasticsearch-migrate        elasticsearch-setup-passwords    elasticsearch-syskeygen  x-pack-watcher-env

elasticsearch-certgen   elasticsearch-env            elasticsearch-node           elasticsearch-shard              elasticsearch-users

elasticsearch-certutil  elasticsearch-env-from-file  elasticsearch-plugin         elasticsearch-sql-cli            x-pack-env

elasticsearch-cli       elasticsearch-keystore       elasticsearch-saml-metadata  elasticsearch-sql-cli-7.6.2.jar  x-pack-security-env

[root@f18d8bc7b8f5 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

#在这里设置密码,注意最少六位,下面也一样可以看到Elasticsearch预置了许多角色和用户。

Enter password for [elastic]:

Reenter password for [elastic]:

Passwords do not match.

Try again.

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]

[root@f18d8bc7b8f5 bin]# Ctrl+D 退出容器

重启容器

docker restart ******

默认用户名是elastic

如果用到Kibana ,则做如下设置

sudo vi /etc/kibana/kibana.yml

# sudo vi /etc/heartbeat/heartbeat.yml

elasticsearch.username: "elastic"

elasticsearch.password: "<password>"

sudo systemctl restart kibana.service

Or change data in Elasticsearch directly.

POST /_security/user/elastic/_password

{

"password": "admindev123$%^"

}

如果你要重新修改密码

这里会让你输入旧的密码即可

curl -H "Content-Type:application/json" -XPOST -u elastic 'http://47.254.19.211:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "admindev123$%^" }'

要利用这个漏洞,最重要的就是查看数据,下面是elasticsearch基本的查询方法

2.1 查询所有的 index, type:

$ curl localhost:9200/_search?pretty=true

2.2 查询某个index下所有的type:

$ curl localhost:9200/films/_search

2.3 查询某个index 下, 某个 type下所有的记录:

$ curl localhost:9200/films/md/_search?pretty=true

2.4 带有参数的查询:

$ curl localhost:9200/films/md/_search?q=tag:good

{"took":7,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2,"max_score":1.0,"hits":[{"_index":"film","_type":"md","_id":"2","_score":1.0, "_source" :

{ "name":"hei yi ren", "tag": "good"}},{"_index":"film","_type":"md","_id":"1","_score":0.30685282, "_source" :

{ "name":"ma da jia si jia", "tag": "good"}}]}}

2.5 使用JSON参数的查询: (注意 query 和 term 关键字)

$ curl localhost:9200/film/_search -d '

{"query" : { "term": { "tag":"bad"}}}'

实战记录

1,直接访问该ip的9200端口,如下:

2,http://ip:9200/_cat/indices获取所有的index

3,http://ip:9200/_mapping?pretty=true 获取index下的所有type

4,http://ip:9200/pv_fun_all/school/_search?pretty=true 获取该index下该type下的内容

elasticsearch设置密码的更多相关文章

  1. 【ELK】elasticsearch设置密码访问

    1.需要在配置文件中开启x-pack验证, 修改config目录下面的elasticsearch.yml文件,在里面添加如下内容,并重启. xpack.security.enabled: true x ...

  2. elasticsearch设置密码及Java密码连接

    目录 1. 安装 2. 修改elasticsearch-8.2.2\config\elasticsearch.yml文件里面xpack.security.enabled: false为 3. 重新启动 ...

  3. elasticsearch分别在windows和linux系统安装

    WINDOWS系统安装1.安装JDKElastic Search要求使用较高版本JDK,本文使用D:\DevTools\jdk1.8.0_131,并配置环境变量 2.安装Elastic Search官 ...

  4. Elasticsearch 6.3.1、Head插件 安装及配置

    安装Elasticsearch Elasticsearch下载地址:https://www.elastic.co/cn/downloads/elasticsearch 也可以直接使用wget下载到某目 ...

  5. Elasticsearch教程(一),全程直播(小白级别)

    ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticsearch是用Java开发的,并作为Apach ...

  6. ElasticSearch系列之(一):介绍、安装(Docker、Windows、Linux)

    1.介绍 Elasticsearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticsearch是用Java语言开发的,并 ...

  7. 【安装】ES的安装过程

    1.安装ES 首先我们需要去官网下载安装包  官方下载地址 下载后不需要编译,直接解压 解压后结构是这样的(2.5以上版本会有plugins目录,没有的需要手动创建) 方式一: 创建一个es用户(因为 ...

  8. ElasticSearch版本升级备忘录(1.5.2至2.3.1)

    discovery机制默认为单播,需配置discovery.zen.ping.unicast.hosts:,如果各节点使用默认端口,则只配IP即可(["172.17.4.47", ...

  9. Elasticsearch 5.0 安装 Search Guard 5 插件 (五)

    一.Search Guard 简介 Search Guard  是 Elasticsearch 的安全插件.它为后端系统(如LDAP或Kerberos)提供身份验证和授权,并向Elasticsearc ...

随机推荐

  1. 【Linux】【Web】【Nginx】配置nginx日志到远程syslog服务器

    1. 概述: 主要是用于吧nginx的日志直接传送到远程日志收集的服务器上.远程日志服务器只要能够支持syslog协议都能够收到日志,本文的syslog服务器是IBM的日志收集系统Qradar. 2. ...

  2. Vue中如何书写js来渲染页面填充数据的部分代码

    new Vue({ el:"#app" , data:{ user:{ id:"", username:"", password:" ...

  3. 【HarmonyOS】【Json解析】ZSON 与 HiJson 使用

    HiLog配置 为了方便调试,查看,先设置好Hilog public static final HiLogLabel loglabel = new HiLogLabel(HiLog.LOG_APP,0 ...

  4. 使用matplotlib中的bar函数绘制柱状图

    使用柱状图显示三日电影的票房信息 要显示的数据为2018年12月7日-9日四场电影的票房信息 四场电影分别为:无名之辈,狗十三,毒液:知名守卫者,憨豆特工3 2018年12月7日四场电影票房分别为:[ ...

  5. ciscn_2019_s_6

    例行检查 没有开启nx保护,考虑用shellcode来做这道题 程序放入ida查看 我们可以输入48个字符覆盖0使printf打印出bp的值 继续看这里,buf的大小实际上只有0x38的大小,但是re ...

  6. [BUUCTF]REVERSE——reverse2

    reverse2 附件 例行检查,64位目标 64位ida载入,首先shift+f12检索程序里的字符串 得到了"this is the right flag!" 的提示字符串,还 ...

  7. Docker从入门到精通(七)——容器数据共享

    什么是容器数据共享?简单来说就是容器与容器之间数据共享,容器与宿主机数据共享. 1.为什么需要数据共享? ①.数据持久化 比如我们有一个MySQL集群,通过容器启动,那么项目运行过程中的数据是保存在容 ...

  8. CF1097B Petr and a Combination Lock 题解

    Content 有一个锁,它只有指针再次指到 \(0\) 刻度处才可以开锁(起始状态如图所示,一圈 \(360\) 度). 以下给出 \(n\) 个操作及每次转动度数,如果可以通过逆时针或顺时针再次转 ...

  9. 除了背八股文,Java面试更该这样准备

    我可以这样说,哪怕你背了再多java八股文的答案,过面试也能靠运气,因为很多java面试的答案只限于技术理论说辞.但用我本文给出的方法去准备面试,能在不提升技术的前提下,大大提升你java面试的通过率 ...

  10. 交通运输类文档下载——JT/T 808-2019、JT/T 809-2019文档分享

    JT/T 808-2019.JT/T 809-2019文档分享 网盘:https://pan.baidu.com/s/1vfgenani8WR3in2lua3qWQ提取码:fktd 官网下载808协议 ...