How to perform authentication in kibana?


(Abhisek Mohanty) #1

Hi team ,

Can X-pack authenticate kibana for multiple users ?

As i am new to Kibana, so need assistance to make authentication possible in kibana.


(Mark Walkom) #2

Yes it can.

What do you need assistance with? Have you read https://www.elastic.co/guide/en/x-pack/current/xpack-security.html?


(Abhisek Mohanty) #3

Thanks for the reply

While going through the link ,i figured out that i need to have LDAP, Active Directory, or PKI .
but dont't have any idea that how to make them work.

please help me with that.


(Mark Walkom) #4

If you don't have any of those then use the native realm, it'll be easiest.


(Abhisek Mohanty) #5

@warkolm Can you help me with how to make it work with native relam.

Have gone through link but i'm not clear about how to make it work.


(Mark Walkom) #6

Did you read over https://www.elastic.co/guide/en/x-pack/current/native-realm.html


(Abhisek Mohanty) #7

Yes, gone through the document.

but after i installed X-PACK, i'm not able to see xpack.security.authc.realms namespace in elasticsearch.yml.


(Mark Walkom) #8

You need to add it :slight_smile:


(Abhisek Mohanty) #9

@warkolm Thanks for the reply

I have added xpack.security.authc.realmsnamespace inelasticsearch.yml.

But for Adding User i'm getting error

i'm using command

        curl -XPOST 'localhost:9200/_xpack/security/user/jacknich?pretty' -H 'Content-Type: application/json' -d'
        {
          "password" : "abcd@2017", 
          "roles" : [ "admin", "other_role1" ], 
          "full_name" : "Abhishek Mohanty", 
          "email" : "", 
          "metadata" : { 
            "intelligence" : 7
          },
          "enabled": true 
        }
        '

and i'm getting error

{
  "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "missing authentication token for REST request [/_xpack/security/user/jacknich?pretty]",
        "header" : {
          "WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
        }
      }
    ],
    "type" : "security_exception",
    "reason" : "missing authentication token for REST request [/_xpack/security/user/jacknich?pretty]",
    "header" : {
      "WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
    }
  },
  "status" : 401
}

(Mark Walkom) #10

Did you pass in the default username and password, assuming you are on 5.X?


(Abhisek Mohanty) #11

Yes

No
How should i pass it ?

and i have used default xpack.security.authc.realms namespace

xpack:
  security:
    authc:
      realms:
        native1:
          type: native
          order: 0

is this correct ?


(Mark Walkom) #12

You need to pass it into the curl command.


(Abhisek Mohanty) #13

@warkolm which curl command i need to use ? can you please share me the link that could be useful.

can you give a example for how to define a sample realm in elasticsearch.yml


(Abhisek Mohanty) #14

I'm getting authentication exception error for every curl command..
How should i resolve the issue?


(Mark Walkom) #15

If you are getting errors please post the entire command you are calling as well as the entire output.


(Abhisek Mohanty) #16

Hi warkolm, thanks for the reply

Getting the same error for another command

curl 'localhost:9200/_cat/indices?v'

(Mark Walkom) #17

Right, so you need to pass in -u username:password to curl, where you replace user and password with valid users.


(Abhisek Mohanty) #18

I'm having a doubt, that i need to install X-Pack on elasticsearch and kibana both or installing X-Pack on only elasticsearch will do..?


(Mark Walkom) #19

It needs to be installed on all parts of the stack.


(Abhisek Mohanty) #20

Thanks for the answer

But i have elasticsearch, kibana and logstash all three installed on the same server .

In that case also i need to installed X-Pack on all the stack.