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. ORMLite整合SQLCipher

    Android数据库加密,目前就是SQLCipher对SQLite整体加密,微信也是使用这种方式.开源,且支持很多平台. SQLCipher虽说开源了,但是编译好的jar和so文件,还是要收费的. 但 ...

  2. 【java】java中直接根据Date 获取明天的时间

    展示代码: @Test public void dateTest(){ Date now = new Date(); System.out.println(now); // java.util.Dat ...

  3. virtualenv、virtualenvwrapper安装和使用;Mac os的特殊性

    [sudo] pip install virtualenv 或者[sudo] pip3 install virtualenv [sudo]可用可不用 pip/pip3 install virtuale ...

  4. iOS:二维码的扫描

    iOS 中二维码的扫描借用#import <AVFoundation/AVFoundation.h> 实现,会用到<AVCaptureMetadataOutputObjectsDel ...

  5. Ubuntu16.04安装Pytorch

    一.安装 1. 官方github:https://github.com/pytorch/pytorch Install optional dependencies //安装依赖项 On Linux e ...

  6. DevExpress.Build

    using System.Collections.Generic; using Microsoft.Build.AppxPackage; using Microsoft.Build.Framework ...

  7. oracle调优 浅析有效的游标管理

    浅析有效的游标管理 [思路分析] 能够把游标理解成共享的运行计划,当sql不被共享时.常规的解决思路有两个方向: 1.调整共享池的尺寸(共享池的库缓存区中共享运行计划): 2.sql书写时尽量重用绑定 ...

  8. How to learn a new technology

    是什么?为什么会出现? 这一阶段主要是对该技术有一个整体了解,他所解决的是什么问题,他的整体结构等. 怎么做? 最简单的是找一个上手视频,因为视频是非常直观的展示了技术的使用.先学会用是最根本的,对于 ...

  9. ios 中尝试多次请求

    -(void)tryRun { tryTimes++; id obj = [ASODataManager getAppleAccount]; if (obj) { __block FirstViewC ...

  10. Jenkins2.x Pipeline持续集成交互

    原文地址:http://blog.csdn.net/aixiaoyang168/article/details/72818804 Pipeline的几个基本概念: Stage: 阶段,一个Pipeli ...