Kibana、Apache Basic Authentication

本文將分享如何將透過Apache .htpasswd進行kibana首頁保護

Kibana、Apache Basic Authentication

  1. 使用「htpasswd」的指令建立密碼檔
1htpasswd -c .htpasswd elkuser
  1. 將.htpasswd放置/var/ELK/.htpasswd
  2. Apache開啟代理
1LoadModule proxy_module modules/mod_proxy.so
2LoadModule proxy_http_module modules/mod_proxy_http.so
  1. Apche httpd.conf設置反向代理

apache conf

 1<VirtualHost *:80>
 2	ServerName 127.0.0.1
 3    DocumentRoot "C:\WebServer"
 4    #因為是Reverse,因此ProxyRequests要關閉
 5    ProxyRequests off
 6    <Location />
 7        Auth
 8         AuthType Basic
 9        AuthName "Kibana"
10        AuthUserFile "C:/WebServer/.htpasswd"
11        Require valid-user
12        #Reverse Proxy
13        ProxyPass http://127.0.0.1:5601 retry=0
14        ProxyPassReverse http://127.0.0.1:5601
15        	 </Location>
16    <Location /kibana>
17            #Auth
18            AuthType Basic
19            AuthName "Kibana"
20            AuthUserFile "C:/WebServer/.htpasswd"
21            Require valid-user
22            # Reverse Proxy
23        ProxyPass http://127.0.0.1:5601 retry=0
24           ProxyPassReverse http://127.0.0.1:5601
25     </Location>
26</VirtualHost>
27

Run Kibana on Browser

  1. 請在網址輸入以下:
1http://127.0.0.1/kibana