New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XPack authentication support #39

Merged
merged 1 commit into from Dec 18, 2017

Conversation

Projects
None yet
3 participants
@srilumpa
Contributor

srilumpa commented Dec 11, 2017

The elastic4play framework does not currently support authentication enabled on the ElasticSearch database enabled through the XPack component (cf TheHive-Project/TheHive#384).

Hopefully, this PR should add the feature. Setting the search.username (at least) and the search.password configuration directives will trigger the use of the XPack client. Otherwise, the current TCP client is used.

Unfortunately, I am not in position to test it thoroughly but executing sbt clean compile ends successfully and executing sbt test throws the same errors as the master branch.

Please let me know if this doesn't match your standards.

@To-om To-om self-assigned this Dec 15, 2017

@nadouani nadouani changed the base branch from master to develop Dec 18, 2017

@nadouani

This comment has been minimized.

Show comment
Hide comment
@nadouani

nadouani Dec 18, 2017

Contributor

@srilumpa This looks working fine for me. I've just tested it by installing x-pack plugin and setting a username/password couple.

If TheHive is not enabled to authenticate agains X-Pack, The "Elasticsearch cluster is unreachable" error is thrown, otherwise everything is OK.

Is this what we should expect?

I'll let @To-om merge it, since he knows more than me what's the next version to be released.

Contributor

nadouani commented Dec 18, 2017

@srilumpa This looks working fine for me. I've just tested it by installing x-pack plugin and setting a username/password couple.

If TheHive is not enabled to authenticate agains X-Pack, The "Elasticsearch cluster is unreachable" error is thrown, otherwise everything is OK.

Is this what we should expect?

I'll let @To-om merge it, since he knows more than me what's the next version to be released.

@srilumpa

This comment has been minimized.

Show comment
Hide comment
@srilumpa

srilumpa Dec 18, 2017

Contributor

This is the error currently thrown when attempting to connect to a cluster with the X-Pack plugin enabled, so I guess keeping this when no credentials are set is OK.

I am not familiar enough with how you handle errors in the elastic4play framework and familiar enough with Scala in general to handle properly the exceptions but I can try something if you want to.

Contributor

srilumpa commented Dec 18, 2017

This is the error currently thrown when attempting to connect to a cluster with the X-Pack plugin enabled, so I guess keeping this when no credentials are set is OK.

I am not familiar enough with how you handle errors in the elastic4play framework and familiar enough with Scala in general to handle properly the exceptions but I can try something if you want to.

@nadouani

This comment has been minimized.

Show comment
Hide comment
@nadouani

nadouani Dec 18, 2017

Contributor

It looks like the errors are handled at https://github.com/CERT-BDF/elastic4play/blob/master/app/org/elastic4play/ErrorHandler.scala, and we could probably add a pattern for org.elasticsearch.ElasticsearchSecurityException to customize the error message ;)

Contributor

nadouani commented Dec 18, 2017

It looks like the errors are handled at https://github.com/CERT-BDF/elastic4play/blob/master/app/org/elastic4play/ErrorHandler.scala, and we could probably add a pattern for org.elasticsearch.ElasticsearchSecurityException to customize the error message ;)

@To-om To-om added this to the 1.4.2 milestone Dec 18, 2017

@To-om To-om merged commit bcf74b3 into TheHive-Project:develop Dec 18, 2017

To-om added a commit that referenced this pull request Dec 18, 2017

To-om added a commit that referenced this pull request Dec 18, 2017

To-om added a commit that referenced this pull request Dec 18, 2017

To-om added a commit that referenced this pull request Dec 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment