How to enable x-pack security when running elasticsearch locally from source code

I am running the latest Elasticsearch code(taken from the master branch on 17th April 2020) and its running successfully and I was able to start it in debug mode in Intellij by following Failing to run on Intellij in debug mode.

Now I want to debug some x-pack security-related issue and for that, I need to put a breakpoint in org.elasticsearch.xpack.security.authc.esnative.NativeUsersStore class and need to have a .security the index also needs to create some users.

I was able to configure security in my local Elasticsearch node by following the https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-security.html but that required putting below configs in elasticsearch.yml.

xpack.security.enabled : true
xpack.security.transport.ssl.enabled: true

Now, .security index is created and I was also able to create a new user with password, but when I deleted the user or get the user using the API, it's not hitting the breakpoint in methods like

org.elasticsearch.xpack.security.authc.esnative.NativeUsersStore#deleteUser
org.elasticsearch.xpack.security.authc.esnative.NativeUsersStore#getUser

Please advise how can I use the debugger in this case?

Thanks in advance

Hi @amitmbm,

You can set settings by passing them as parameters to your gradle command, prefixed by -Dtests.es.

for instance, to enable security , pass -Dtests.es.xpack.security.enabled=true

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.