ICE.ICE|

韩憨

园龄:4年7个月粉丝:42关注:47

elasticsearch设置密码

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下的内容

 

本文作者:韩憨

本文链接:https://www.cnblogs.com/hanby/p/15514470.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   韩憨  阅读(2296)  评论(0编辑  收藏  举报
//看板娘

剑桥

点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起
  1. 1 隔离 (Studio Live Duet) 陈凯咏,林家谦
  2. 2 明知做戏 吴雨霏
  3. 3 残酷游戏 卫兰
  4. 4 你,好不好? 周兴哲
  5. 5 我可以 蔡旻佑
  6. 6 云烟成雨 房东的猫
  7. 7 说散就散 JC 陈咏桐
  8. 8 我配不上你 夏天Alex
  9. 9 不再联系 夏天Alex
  10. 10 等我先说 夏天Alex
  11. 11 我知道他爱你 夏天Alex
  12. 12 多想在平庸的生活拥抱你 隔壁老樊
  13. 13 这一生关于你的风景 隔壁老樊
  14. 14 我曾 隔壁老樊
  15. 15 关于孤独我想说的话 隔壁老樊
  16. 16 过客 周思涵
  17. 17 备爱 周思涵
  18. 18 嚣张 en
  19. 19 海口 后弦
你,好不好? - 周兴哲
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.

作词 : 周兴哲/吴易纬

作曲 : 周兴哲

编曲:陈建骐

是不是 还那么爱迟到

熬夜工作又睡不好

等你完成你的目标

要戒掉逞强的嗜好

都怪我

把自尊放太高

没有把你照顾好

骄傲是脆弱的外表

最怕我的心你不要

能不能继续对我哭

对我笑对我好

继续让我为你想

为你疯陪你老

你好不好好想知道

别急着把回忆都丢掉

我只需要你在身边

陪我吵陪我闹

用好的我

把过去坏的我都换掉

好想听到你坚决说爱我

可惜回不去那一秒

你 好不好

天知道我快要受不了

后悔 钻进心里烧

拥抱 再多一次就好

你要的我都做得到

能不能继续对我哭

对我笑 对我好

继续让我为你想

为你疯 陪你老

给你的好还要不要

答案我却不敢揭晓

我只需要你在身边

陪我吵 陪我闹

别用离开教我

失去的人最重要

别说 你曾经爱过我

让我们回到那一秒

你好不好

能不能继续对我哭

对我笑 对我好

继续让我为你想

为你疯 陪你老

你好不好 我好想知道

别急着把我的爱丢掉

我只需要你在身边

陪我吵 陪我闹

别用离开教我

失去的人最重要

别说 你曾经爱过我

让我们回到那一秒

你 好不好?