ElasticSearch版本: 5.5.1 (最新稳定版为5.5.2),由于用到IK中文分词插件,最新版本没有5.5.2 ,所以使用5.5.1

日期:2017-08-30

第四章:安装 Search Guard

由于x-pack 的 security 部分是收费的,考虑使用其他插件来替代,倾向于两款插件,一个是今天的主角 Search Guard, 另一个是readonlyrest

Search Guard 与 Elasticsearch 的版本对照表

search-guard-docs in github

  一、停止运行elasticsearch,定位到es主目录下,执行下面命令:

 .\bin\elasticsearch-plugin install -b com.floragunn:search-guard-5:5.4.2-15

  执行效果如下图:

如果在服务器上没有网络,可以使用离线安装方式:

离线安装步骤:

1、下载对应版本的Search Guard,版本对照表

2、Search Guard 5 下载地址

3、search-guard-ssl 下载地址 ,后面要用到这个生成证书。

二、配置Search Guard

1、下载search-guard-ssl

git clone https://github.com/floragunncom/search-guard-ssl.git

2、切换到search guard ssl 源码目录,进入example-pki-scripts文件夹,修改example.sh文件,修改之后如下:

#!/bin/bash
OPENSSL_VER="$(openssl version)" if [[ $OPENSSL_VER == *"0.9"* ]]; then
echo "Your OpenSSL version is too old: $OPENSSL_VER"
echo "Please install version 1.0.1 or later"
exit -1
else
echo "Your OpenSSL version is: $OPENSSL_VER"
fi set -e
./clean.sh
./gen_root_ca.sh capass changeit
./gen_node_cert.sh 1 changeit capass
./gen_client_node_cert.sh spock changeit capass
./gen_client_node_cert.sh kirk changeit capass
./gen_client_node_cert.sh kibana changeit capass rm -f ./*tmp*

 3、生成证书:

sh example.sh

 4、将example-pki-scripts文件夹中的node-1-keystore.jkstruststore.jks复制到elasticsearch的配置目录中(%ES_HOME%/config)

5、配置elasticsearch 基于 TLS 加密通讯,在 elasticsearch.yml 中增加以下内容:

searchguard.ssl.transport.keystore_filepath: node-1-keystore.jks
searchguard.ssl.transport.keystore_password: changeit
searchguard.ssl.transport.truststore_filepath: truststore.jks
searchguard.ssl.transport.truststore_password: changeit
searchguard.ssl.transport.enforce_hostname_verification: false

 6、重启后访问:http://localhost:9200,发现会报错,提示没有初始化 Search Guard 索引。

7、初始化 Search Guard 索引,配置帐号,首先将example-pki-scripts文件夹中的kirk-keystore.jkstruststore.jks复制到%ES_HOME%\plugins\search-guard-5\sgconfig 文件夹中

8、在 elasticsearch.yml 中增加以下内容:

searchguard.authcz.admin_dn:
- CN=kirk,OU=client,O=client,L=test, C=de

9、重启elasticsearch,在 \plugins\search-guard-5\ 目录打开终端,执行以下命令:

.\tools\sgadmin.bat -ts .\sgconfig\truststore.jks -tspass changeit -ks .\sgconfig\kirk-keystore.jks -kspass changeit -cd .\sgconfig\ -icl -nhnv -h 0.0.0.0

 显示如下图,则执行成功:

使用浏览器访问:http://localhost:9200 提示输入密码,输入默认用户: admin admin ,可登陆表示正常。

10、配置REST-API 基于https连接,在 elasticsearch.yml 中增加以下内容:

searchguard.ssl.http.enabled: true
searchguard.ssl.http.keystore_filepath: node-1-keystore.jks
searchguard.ssl.http.keystore_password: changeit
searchguard.ssl.http.truststore_filepath: truststore.jks
searchguard.ssl.http.truststore_password: changeit

 重启后 ,使用浏览器访问:https://localhost:9200 提示输入密码,输入默认用户: admin admin ,可登陆表示正常

http://localhost:9200 无加密拒绝访问

参考文章:

http://m.blog.csdn.net/envinfo2012/article/details/76685818

http://blog.csdn.net/lulongzhou_llz/article/details/77099418

http://www.cnblogs.com/Orgliny/p/6168986.html

https://hacpai.com/article/1472803335867?p=1&m=0

http://www.cnblogs.com/ywcz060/p/6950404.html

http://www.cnblogs.com/shifu204/p/6376683.html

Elasticsearch5.X IN Windows 10 系列文章(4)的更多相关文章

  1. Elasticsearch5.X IN Windows 10 系列文章(2)

    ElasticSearch版本: 5.5.1 (最新稳定版为5.5.2),由于用到IK中文分词插件,最新版本没有5.5.2 ,所以使用5.5.1 日期:2017-08-29 第二章:安装Kibana ...

  2. Elasticsearch5.X IN Windows 10 系列文章(1)

    系统类型:windows10  64位家庭版 ElasticSearch版本: 5.5.1 (最新稳定版为5.5.2),由于用到IK中文分词插件,最新版本没有5.5.2 ,所以使用5.5.1 日期:2 ...

  3. Elasticsearch5.X IN Windows 10 系列文章(5)

    ElasticSearch版本: 5.5.1 (最新稳定版为5.5.2),由于用到IK中文分词插件,最新版本没有5.5.2 ,所以使用5.5.1 日期:2017-08-31 第五章:Kibana 安装 ...

  4. Elasticsearch5.X IN Windows 10 系列文章(3)

    系统类型:windows10 64位家庭版 ElasticSearch版本: 5.5.1 (最新稳定版为5.5.2),由于用到IK中文分词插件,最新版本没有5.5.2 ,所以使用5.5.1 日期:20 ...

  5. 不可或缺 Windows Native 系列文章索引

    [源码下载] 不可或缺 Windows Native 系列文章索引 作者:webabcd 1.不可或缺 Windows Native (1) - C 语言: hello c 介绍不可或缺 Window ...

  6. 重新想象 Windows 8 Store Apps 系列文章索引

    [源码下载][重新想象 Windows 8.1 Store Apps 系列文章] 重新想象 Windows 8 Store Apps 系列文章索引 作者:webabcd 1.重新想象 Windows ...

  7. 重新想象 Windows 8.1 Store Apps 系列文章索引

    [源码下载] [重新想象 Windows 8 Store Apps 系列文章] 重新想象 Windows 8.1 Store Apps 系列文章索引 作者:webabcd 1.重新想象 Windows ...

  8. 与众不同 windows phone 8.0 & 8.1 系列文章索引

    [源码下载] [与众不同 windows phone 7.5 (sdk 7.1) 系列文章索引] 与众不同 windows phone 8.0 & 8.1 系列文章索引 作者:webabcd ...

  9. 一步步实现windows版ijkplayer系列文章之四——windows下编译ijkplyer版ffmpeg

    一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...

随机推荐

  1. Metesploit使用随笔

    平时在工作中真正用到metesploit机会不多,偶尔也会用来做漏洞验证,但是每次使用的时候都需要花点时间回忆一下具体是怎么用的,因此索性记下来方便自己,以使用Nessus扫描YS的某个硬件设备发现的 ...

  2. ASP.NET MVC快速开发框架清新简洁界面设计,有兴趣可以模仿参考

    软件的用户体验很重要,要抓住用户的心,这篇博文分享一下最近一个项目的UI设计. 我做UI设计是从用户的角度出发的,要去揣摩用户的习惯. 大部分用户都是使用windows操作系统,所以我这套软件的风格也 ...

  3. verynginx +nginx_upstream_check_module模块,负载均衡检查模块。

    yum -y install git yum -y install patch yum -y install pcre-devel yum install -y zlib-devel   mkdir ...

  4. 反向传播BP为什么高效

    之前有一篇文章讲了反向传播的原理: 下面这篇文章讲了反向传播为什么高效: https://blog.csdn.net/lujiandong1/article/details/52716726 主要通过 ...

  5. android BSP与硬件相关子系统读书笔记(1)android BSP移植综述

    从linux驱动转行至Android驱动开发大半年了,一开始就产生了一个很纠结目标和问题,就是不停的google如何porting android!这个问题得到的结果对于初出茅庐的我,感到迷惘.随着工 ...

  6. J2EE开发工作中遇到的异常问题及解决方法总结

    参考博文:http://blog.csdn.net/rchm8519/article/details/41624381

  7. 经典算法——Jump Game(II)

    Given an array of non-negative integers, you are initially positioned at the first index of the arra ...

  8. ODOO Unable To Find Wkhtmltopdf On This System. Error/Bug ?

    If you are using ODOO version 8 and getting some error like – Unable to find Wkhtmltopdf on this sys ...

  9. 《深入PHP:面向对象、模式与实践》(二)

    第4章 高级特性 本章内容提要: 静态属性和方法:通过类而不是对象来访问数据和功能 抽象类和接口:设计和实现分离 错误处理:异常 Final类和方法:限制继承 拦截器方法:自动委托 析构方法:对象销毁 ...

  10. Swift学习-枚举(Enumerations)的使用方法

    Swift学习-枚举的使用方法 枚举的使用语法: enum someEnumer { // 枚举的成员值 } 以下是方向的一个例子: enum direction { case Up case Dow ...