Kibana authentication using nginx

Hello Techrunnr Readers, This document deals with enabling authentication for kibana using nginx webserver.


Kibana is opensource visulalization and analytics tools which works with Logstash and Elasticsearch.
By default, kibana doesn’t have any authentication by default.
Running kibana in the local machine without authentication doesn’t make security threat, but when you are setting up kibana publically it’s a major threat.
Here we are going to achieve this by using create an htaccess user and configuring the proxy pass for kibana.

This provides one more layer of security. This protects your analytics system from unauthorized access from hackers.

Prerequisites

* Root access to install packages or sudo access
* Running Kibana

1. Install Nginx in the server.

apt-get install nginx //In Debian or Ubuntu

yum install nginx //In Centos or Redhat

2. Install htttp-tools

yum install http-tools // In Centos or Redhat

apt-get install apache2-utils // In Ubuntu or debian

3. Create Htuser for authentication

htpasswd -c /etc/nginx/ username

4. Configuring Nginx

Here we are going to configure Nginx to act as a proxy, so it will directly authenticated user to “localhost:5601”

Open the Nginx configuration file with the command below:


vi /etc/nginx/nginx.conf

Find the “server” directive and change it like below:

server {
listen *:80;
server_name _;
location / {
proxy_pass http://127.0.0.1:5601;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}

}

5. Testing

Now you have completed kibana authentication configuration using NGINX.

Now goto browser and type IP or hostname, you can see the pop asking the username and password.

Don’t worry if you are using Apache web server. Here is the document for the same with apache web server.

 

© 2018, Techrunnr. All rights reserved.

#1
Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.