搭建完ELK平台后,发现kibana没有登录的认证,直接访问就能进去,刚才开始用x-pack插件来加强安全,发现是要收费的
还是老老实实用nginx来转发比较实在
增加kibana的登录安全认证:
这里我在安装之前把5601的端口给绑定在了本地上,让其他机器无法访问,别把5601绑定在了其他ip上,然后在用80转,
安装nginx
这里我的nginx配置文件如下:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream kibana_web {
server 127.0.0.1:5601 weight=1 max_fails=2 fail_timeout=30s;
}
server {
listen 80;
server_name 192.168.3.66;
location / {
root html;
index index.html index.htm;
proxy_set_header Host $host;
proxy_pass http://kibana_web;
auth_basic "The Kibana Monitor Center";
auth_basic_user_file /application/nginx/html/.htpasswd;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
安装生成密码工具:
[root@jhkj66 html]# yum install httpd-tools
生成密码文件:
[root@jhkj66 html]# htpasswd -c /application/nginx/html/.htpasswd admin
New password:
Re-type new password:
重新加载nginx即可
[root@jhkj66 nginx]# ./sbin/nginx -s reload
再次访问kibana首页则需要输入密码了
转载于:https://blog.51cto.com/13520772/2173775