Kibana中如何使用*.p12文件(Kibana鏈接Https保護的ES集羣)

目前ES配置中,可以使用*.p12文件配置TLS和Https。詳細的配置過程可以參見官方文檔Encrypting communications in Elasticsearch,若英文不想看,也可常見我的博客加密ElasticSearch通信,爲此官方文檔的簡要譯文。

p12文件在ELasticSearc配置中可以使用,但是在Kibana配置中無法使用,此問題已經被ElasticSearch的官方開發人員在論壇中回覆過,詳情可見How use .p12 key for TLS in Kibana

根據Kibana的官方文檔,當我們的ES集羣使用了Https時,需要配置

elasticsearch.ssl.certificateAuthorities: /path/to/your/cacert.pem

由於我們在配置ES時,簽名證書是P12格式,明顯不是.pem或者.crt(以上配置也可使用crt)格式。爲了完成配置,我們可以從P12文件導出crt格式的根簽名公鑰證書文件。在WIN10上操作,需要我們安裝openssl工具,或者在Linux系統上完成,也必須具備openssl工具。

詳細步驟總結如下:

  1. 下載openssl工具並安裝。常見地址https://www.openssl.org/source/或者https://sourceforge.net/projects/gnuwin32/files/openssl/0.9.8h-1/openssl-0.9.8h-1-setup.exe/download?use_mirror=nchc進行下載並安裝;
  2. 從p12文件分離出crt文件。命令行操作代碼openssl pkcs12 -in eastcom-bas-ca.p12 -clcerts -nokeys -out bas-ca.crt。
    紅色字體爲p12文件。分離操作也可參看博客如何分離p12(或pfx)文件中的證書和私鑰
  3. 配置Kibana.yml文件
    server.host: "127.0.0.1"
    elasticsearch.url: "https://10.8.23.90:9250"
    elasticsearch.username: "elastic"
    elasticsearch.password: "elastic"
    #根授權證書
    elasticsearch.ssl.certificateAuthorities: E:\soft\elk\kibana-6.4.3-windows-x86_64\config\certs\bas-ca.crt
    elasticsearch.ssl.verificationMode: certificate

    xpack.monitoring.enabled: true
    xpack.security.enabled: true
    xpack.ml.enabled: true
    xpack.watcher.enabled: true
    xpack.graph.enabled: true
  4. 運行Kibana檢驗,可成功連接上Https保護的ES集羣。
     
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章