啟動kibana時會有幾個warning信息,具體如下:
針對xpack這幾個相關的,在kibana.yml文件中新增如下三個配置即可:
# 注意:參數值至少32位,否則啟動會報錯提示
xpack.encryptedSavedObjects.encryptionKey: encryptedSavedObjects12345678909876543210
xpack.security.encryptionKey: encryptionKeysecurity12345678909876543210
xpack.reporting.encryptionKey: encryptionKeyreporting12345678909876543210
關於這個報錯:[warning][config][plugins][security] Session cookies will be transmitted over insecure connections. This is not recommended.
是說明kibana訪問沒有使用https的方式,這個處理可以參考這篇文章:https://www.cnblogs.com/sanduzxcvbnm/p/12046640.html => 使用https方式訪問kibana
關於另一種報錯:[browser-driver][reporting] Enabling the Chromium sandbox provides an additional layer of protection
官網文檔說明如下:
https://www.elastic.co/guide/en/kibana/7.6/reporting-chromium-sandbox.html
翻譯如下:
當X-Pack reporting使用Chromium瀏覽器生成PDF報告時,建議使用沙盒作為額外的安全層。Chromium沙箱使用操作系統提供的機制來確保代碼執行不能對計算機進行持久性更改或訪問機密信息。每個操作系統的特定沙盒技術都不同。
Linux沙盒依賴於3.8Linux內核引入的用戶名稱空間。但是,許多發行版在默認情況下沒有啟用用戶名稱空間,或者它們需要CAP_SYS_ADMIN功能。當沙盒在Debian和CentOS上運行時,X-Pack報告將自動禁用它,因為啟用未授權的用戶名空間需要額外的步驟。在這些情況下,您將在Kibana日志中看到以下消息:啟用Chromium沙箱提供了額外的保護層。
如果您的內核是3.8或更高版本,建議啟用用戶名空間,並在kibana.yml中設置xpack.reporting.capture.browser.chromium.disableSandbox:false以啟用沙盒。
在Docker容器中運行Kibana時,所有容器進程都在一個usernamespace中運行,其中包含seccomp bpf和AppArmor配置文件,這些配置文件防止使用Chromium沙箱。在這些情況下,建議禁用沙盒,因為容器實現類似的安全機制。
對應的操作就是在kibana.yml文件中新增如下配置即可:
xpack.reporting.capture.browser.chromium.disableSandbox: false
不過設置這個后啟動會有如下錯誤提示:
系統內核版本如下:Linux bogon 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
大於所要求的3.8內核版本
大致意思是Error: Failed to launch chrome,錯誤:啟動chrome失敗
難道沙箱使用生成報錯還需要安裝chrome驅動才行,就跟爬蟲那樣的,驅動chrome瀏覽器自動操作?
設置這個試試看,禁用沙箱功能:
xpack.reporting.capture.browser.chromium.disableSandbox: true
禁用的話還是有這個警告
其他關於沙盒的信息:
https://www.ucloud.cn/yun/34216.html
chromium設置
當xpack.reporting.capture.browser.type設置為chromium,還可以指定以下設置。
xpack.reporting.capture.browser.chromium.disableSandbox
Elastic建議你研究啟用非特權用戶命名空間的可行性,有關其他信息,請參閱Chromium Sandbox,除了Debian、Red Hat Linux和CentOS使用true之外,所有操作系統都默認為false。
xpack.reporting.capture.browser.chromium.proxy.enabled
允許Chromium的代理使用,當設置為true,你必須還要指定xpack.reporting.capture.browser.chromium.proxy.server設置,默認為false。
xpack.reporting.capture.browser.chromium.proxy.server
代理服務器的uri,不支持通過uri為代理服務器提供用戶名和密碼。
xpack.reporting.capture.browser.chromium.proxy.bypass
不應該通過代理服務器的主機數組,應該使用直接連接,有效條目的例子是“elastic.co”、“*.elastic.co“、”.elastic.co“、“.elastic.co:5601”。
System dependencies
edit
Reporting launches a "headless" web browser called Chromium on the Kibana server. It is a custom build made by Elastic of an open source project, and it is intended to have minimal dependencies on OS libraries. However, the Kibana server OS might still require additional dependencies to run the Chromium executable.
Make sure Kibana server OS has the appropriate packages installed for the distribution.
If you are using CentOS/RHEL systems, install the following packages:
ipa-gothic-fonts
xorg-x11-fonts-100dpi
xorg-x11-fonts-75dpi
xorg-x11-utils
xorg-x11-fonts-cyrillic
xorg-x11-fonts-Type1
xorg-x11-fonts-misc
fontconfig
freetype
If you are using Ubuntu/Debian systems, install the following packages:
fonts-liberation
libfontconfig1
If the system is missing dependencies, then Reporting will fail in a non-deterministic way. Kibana runs a self-test at server startup, and if it encounters errors, logs them in the Console. Unfortunately, the error message does not include information about why Chromium failed to run. The most common error message is Error: connect ECONNREFUSED, which indicates that Kibana could not connect to the Chromium process.
To troubleshoot the problem, start the Kibana server with environment variables that tell Chromium to print verbose logs. See the Puppeteer debug method for more information.
綜上所述,在kibana.yml中新增如下三個配置就行了,其他的警告以后再處理:
xpack.encryptedSavedObjects.encryptionKey: encryptedSavedObjects12345678909876543210
xpack.security.encryptionKey: encryptionKeysecurity12345678909876543210
xpack.reporting.encryptionKey: encryptionKeyreporting12345678909876543210