1. 程式人生 > >elasticsearch+logstash+kibana5.5.2整合searchguard實現使用者許可權管理(二)

elasticsearch+logstash+kibana5.5.2整合searchguard實現使用者許可權管理(二)

上一篇我們完成了elk整合sg的配置,但是,我們的logstash只能使用一臺es,這是遠遠不夠的,我們要重新制作自己的授信檔案,幸運的是官網給出了一個工具,並且還給出了一個線上製作的網站,支援10個es節點,這裡我們使用線上製作
url: https://floragunn.com/tls-certificate-generator/

填寫表格,提交就可以了,所有的授信檔案,都會發到你的郵箱裡。注意查收,可能會被扔到垃圾箱裡。
檔名是下面這樣,目錄結構如下,我們把每個es節點都拷貝一份
裡面有一個README.txt檔案儲存了具體的操作步驟,和用到的密碼

search-guard-certificates-<UUID>.tar.gz 
│
└─── client-certificates
│        Contains two
client certificates named 'admin' and 'demouser' │ The admin certificate can be used with sgadmin and the REST API. │ The CN of this certificate is 'sgadmin'. The demouser certificate can be used │ for HTTPS client authentication. └─── node-certificates │ Contains the
certificates in jks, p12 and pem format to be used │ on your Elasticsearch nodes. You will find certificates for all │ hostnames you specified when submitting the form. └─── root-ca │ Contains the root CA certificate and private key. └─── config │ Same as above, but for
the signing CA └─── truststore.jks │ The truststore containing the certificate chain │ of the root and signing CA. Can be used on all nodes.

先把叢集都停止了
1.拷貝truststore.jks和CN=[hostname]-keystore.jks檔案(每個節點)

* Copy the file 'truststore.jks' to the config directory of your node(替換掉原來的即可)
* Copy the file 'node-certificates/CN=[hostname]-keystore.jks' to the config directory of your node, where [hostname] is the hostname of your Elasticsearch node(es主機名叫什麼,拷貝相應的keystore檔案)

2.重新配置es。更改原來預設的配置為下(每個節點)

######## Start Search Guard Demo Configuration ########
searchguard.ssl.transport.keystore_filepath: CN=[hostname]-keystore.jks
searchguard.ssl.transport.keystore_password: [keystore password for this node]
searchguard.ssl.transport.truststore_filepath: truststore.jks
searchguard.ssl.transport.truststore_password: 62ef1c559f6ba96e4ca1
searchguard.ssl.transport.enforce_hostname_verification: false
searchguard.ssl.http.enabled: true
searchguard.ssl.http.keystore_filepath: CN=[hostname]-keystore.jks
searchguard.ssl.http.keystore_password: [keystore password for this node]
searchguard.ssl.http.truststore_filepath: truststore.jks
searchguard.ssl.http.truststore_password: 62ef1c559f6ba96e4ca1

searchguard.authcz.admin_dn:                                
  - CN=sgadmin  
######## End Search Guard Demo Configuration ########

3.啟動es,拷貝證書檔案到tools資料夾下(任意一臺es)

* Copy the file 'truststore.jks' to the directory 'plugins/search-guard-5/tools'
* Copy the file 'client-certificates/CN=sgadmin-keystore.jks' to the directory 'plugins/search-guard-5/tools'

4.重新初始化sg(用到的密碼都在README檔案下面,請改成自己的)
./sgadmin.sh -ts truststore.jks -tspass 62ef1c559f6ba96e4ca1 -ks CN=sgadmin-keystore.jks -kspass f0fbad3ec91139f75136 -nhnv -icl -cd ../sgconfig/

至此es上面的配置就完成了,如果我們更改sg_config的使用者的許可權,要重新初始化sg,我們之前說過了,再強調一下。

我們更改es的truststore檔案,相應的logstash也要重新配置。

    elasticsearch {
        user => admin
        password => admin
        ssl => true
        ssl_certificate_verification => true
        truststore => "/etc/logstash/truststore.jks"
        truststore_password => "62ef1c559f6ba96e4ca1"
        hosts => [ "node1:9200","node2:9200","node3:9200" ]
        index => "mysql-%{+YYYY.MM.dd}"
     }

別忘了在/etc/hosts檔案中做好主機名解析工作

貼一個truststore 配置錯誤的報錯

[2017-09-13T15:14:24,265][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"https://admin:[email protected]:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [https://admin:[email protected]:9200/][Manticore::ClientProtocolException] PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"}

相關推薦

elasticsearch+logstash+kibana5.5.2整合searchguard實現使用者許可權管理

本文不講elk的安裝,只說如何在現有elk環境下新增searchguard功能。 bin/elasticsearch-plugin install -b com.floragunn:search-guard-5:5.5.2-16 線上安裝可能不成功,可以

elasticsearch+logstash+kibana5.5.2整合searchguard實現使用者許可權管理

上一篇我們完成了elk整合sg的配置,但是,我們的logstash只能使用一臺es,這是遠遠不夠的,我們要重新制作自己的授信檔案,幸運的是官網給出了一個工具,並且還給出了一個線上製作的網站,支援10個es節點,這裡我們使用線上製作 url: https://f

SpringCloud+MyBatis+Redis整合—— 超詳細實例

數據庫 primary pri open nosql html batis urn hub 2、SpringCloud+MyBatis+Redis   redis是一種nosql數據庫,以鍵值對<key,value>的形式存儲數據,其速度相比於MySQL之類的數

Spring整合Struts2和Hibernate+Maven之SSH的配置檔案

上次講到的是maven專案的建立以及pom.xml的配置。 這裡推薦一個網站:maven整合jar包,這裡可以查詢並生成配置檔案中jar包匯入格式的文字,複製貼上到pom.xml中即可由idea自動下載並匯入專案。 resources資料夾 建立ssh的配置檔案至上章圖片中的res

Jenkins+Git+Gitlab+Ansible實現持續整合自動化部署動態網站--技術流ken

  專案前言   在上一篇部落格《Jenkins+Git+Gitlab+Ansible實現持續化整合一鍵部署靜態網站(一)--技術流ken》中已經詳細講解了如何使用這四個工具來持續整合自動化部署一個靜態的網站。 如果大家可以熟練掌握以上內容,勢必會在工作中減輕不小的工作量。 本篇

shiro許可權框架-與Springboot整合

首先引入shiro與Spring的依賴。 Shiro和Spring整合的依賴 <dependency> <groupId>org.apache.shiro<

vue 2.0 實戰 移動音樂appjsonp的應用+輪播圖資料的抓取

1.在recommend.vue中,created時進行資料抓取 <script> import {getRecommend} from 'api/recommend' import {ERR_OK} from 'api/config' export defa

2.gson-plugin基礎原始碼分析

二、Gson解析核心類 1.ArrayTypeAdapter.JAVA 用於解析陣列型別的資料 public Object read(JsonReader in) throws IOException { if(in.peek() == JsonT

Android2.2平臺上支援多camera

static jint android_hardware_Camera_getNumberOfCameras(JNIEnv *env, jobject thiz){return Camera::getNumberOfCameras();}static void android_hardware_Camera_

activiti自定義流程之Spring整合activiti-modeler5.16例項:建立流程模型

1.maven導包,這裡就沒有什麼多的好說了,直接程式碼: <dependencies> <dependency> <groupId>junit</groupId> <artifact

在Android4.2中實現bluetooth A2dp Sink——移植Android5.0藍芽協議棧

    在Android中,藍芽系統的結構如下圖所示:     在這個體系結構中,從下往上依次是模組驅動、藍芽協議棧、Bluetooth.apk、Framework和各種藍芽應用。其中,核心中的驅動是直接和硬體打交道的,一般由模組廠商提供。Android層中,最下面的是處

clusterdata-2011-2 谷歌叢集資料分析--task_usage

先對 task_usage 即任務資源使用表進行一個分析學習。 task_usage 表共有20列,代表20個屬性,具體每一列代表含義即屬性名稱如下:                       

CAS 5.1.x 的搭建和使用—— 通過Overlay搭建服務端-其它配置說明

#STEP 3 在TOMCAT8.5中跑一個模板然後將其war包中解壓出來的的application.properties複製出來,放到手動建立的src下的resources裡面 ## # CAS Server Context Configuration # server.context-path=/cas

Android4.4.2原始碼分析之WiFi模組

接著上一篇繼續對WiFi原始碼的分析 onResume方法中 6>,首先是呼叫WiFiEnabler的resume方法對switch進行管理 接下來註冊廣播 getActivity().registerReceiver(mReceiver, mFilter);

持續整合jenkins+weblogic部署啟動

專案已經可以順利的釋出到linux上指定的目錄了,接下來是我對weblogic部署的思路 有的人認為只要專案放到指定位置,weblogic立即關閉再啟動,他就會載入專案,這個時候載入的就是最新的,專案就是最新的, 這個想法是錯的。這樣專

從零開始構建支援TLS1.2的Web伺服器Linux版 配置Tomcat環境

博文目錄 下載Tomcat安裝包 在下載安裝Tomcat前,請確保已經按 (一) 配置JAVA環境 正確安裝配置好Java環境。 根據自己的需要選擇合適的安裝包,官方下載

OSGI企業應用開發整合Spring和Mybatis框架

上篇文章中,我們完成了在OSGI應用中整合Spring和Mybatis框架的準備工作,本節我們繼續Spring和Mybatis框架的整合。 一、解決OSGI整合Spring中的Placeholder問題 使用Spring框架的朋友應該都知道,我們可以在B

Spring Security 3和CAS 3.5.2整合的完整例項

摘要 使用Spring Security 3與CAS 3.5.2整合,完成單點登入與單點登出。並使用Apache httpd做逆向代理。本實驗可以按照其中的步驟,一步一步的搭建一個稍微複雜的多網站整合系統。只要按照步驟走了,一定能跑起來。 回顧 在上一篇文章,利用S

zigbee 之ZStack-2.5.1a原始碼分析 無線接收控制LED

本文描述ZStack-2.5.1a 模板及無線接收移植相關內容。 main HAL_BOARD_INIT // HAL_TURN_OFF_LED1 InitBoard HalDriverInit HalAdcInit

Yii2整合Elasticsearch

背景知識: 全文搜尋可以簡單地分為兩類,一種是順序掃描,即我們常見的使用 like %keyword% 方式,掃描整張資料表,在每一條記錄中查詢;另一種就是索引掃描。elasticsearch就是後者。 索引掃描分為兩部分:建立索引和搜尋索引。建立索引的主要步驟是:對原資料進行分詞處