Skip to content
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
Merged

Add XPack authentication support #39

merged 1 commit into from
Dec 18, 2017

Conversation

srilumpa
Copy link
Contributor

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 December 18, 2017 09:50
@nadouani
Copy link
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.

@srilumpa
Copy link
Contributor Author

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
Copy link
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 ;)

@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants