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. Web容器(tomcat服务器)处理JSP文件请求的三个阶段

    Web容器(tomcat服务器)处理JSP文件请求的三个阶段 翻译:编写好的jsp文件被web容器中的jsp引擎转换成java源码. 编译:翻译成java源码的jsp文件会被编译成可被计算机执行的字节 ...

  2. 攻击科普:ARP攻击

    目录 一.介绍 二.解决办法 一.介绍 ARP攻击的局限性 ARP攻击仅能在以太网(局域网如:机房.内网.公司网络等)进行. 无法对外网(互联网.非本区域内的局域网)进行攻击. ARP攻击就是通过伪造 ...

  3. 第46篇-signature_handler与result_handler

    在之前介绍为native方法设置解释执行的入口时介绍过,当Method::native_function为空时会调用InterpreterRuntime::prepare_native_call()函 ...

  4. [BUUCTF]PWN——[V&N2020 公开赛]warmup

    [V&N2020 公开赛]warmup 附件 步骤: 例行检查,64位程序,除了canary,其他保护都开 本地运行一下,看看大概的情况 64位ida载入,从main函数开始看程序 看到程序将 ...

  5. LuoguP5139 z小f的函数 题解

    Content 给定 \(T\) 个二次函数 \(y=ax^2+bx+c\),有若干次操作,有一个操作编号 \(p\),保证仅为以下这五种: 操作 \(1\):给定 \(k\),将函数图像向上移动 \ ...

  6. Excel数据导出功能

    HTML代码: <a id="aExportData" hidden><span>Export</span></a> <div ...

  7. Log4j2 消停了,Logback 开始塌房了?

    今天一早,还没起床,拿起手机赫然看到一个头条信息,标题着实让我心理咯噔了一下! 马上起床,直奔官网,看看到底什么问题?塌的有多厉害? 既然是1.2.9版本以下问题,那就直接找到1.2.9版本修复了些啥 ...

  8. JAVA在JDK1.8中Stream流的使用

    Stream流的map使用 转换大写 List<String> list3 = Arrays.asList("zhangSan", "liSi", ...

  9. 【LeetCode】898. Bitwise ORs of Subarrays 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 动态规划 相似题目 参考资料 日期 题目地址:htt ...

  10. 【LeetCode】817. Linked List Components 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...