elasticsearchelasticsearch-x-pack

how to password protect Elastic search


I have Es version 7.6.2 I saw on website that from version 6.2 onwards x-pack is included by default but i was not able to find or enable x-pack for security. how do i enable password protection in Elastic search.


Solution

  • As per elastic search documentation

    The first thing you have to do is download the default distribution of Elasticsearch and Kibana version 6.8+ or 7.1+. Security was added to the default distribution in 7.1 and 6.8, so if you’re on an older version, you’ll need to upgrade.

    After downloading latest version , you need to enable xpack.security.enabled: true in elasticsearch.yml file

    To generate passwords

    elasticsearch-setup-passwords auto
    

    in command prompt, your cmd path should be elasticsearch/bin. It will auto generate passwords for elasticsearch kibana etc. note them . If you want to provide your own username password instead of auto generated execute

    elasticsearch-setup-passwords interactive
    

    In kibana.yml update below two with user name and password for elastic search you got by executing set up password

    elasticsearch.username: "<elastic>"
    elasticsearch.password: "<password>"
    

    Opening kubana it will prompt for username and password, enter password for "kibana" you got from set-up-password