I need to authenticate against an external system which is not ldap,
Would it be acceptable to add a new rule type
external_auth(“https://example.com”)
This will send an http get request to the specified url argument along with the Authorization header, and interpret return status 200 as a successful authentication
Yes it would be possible, but I think this is one of those esoteric configuration where proxy_auth rule takes care of bridging the external site’s identities to a ReadonlyREST user or group.
I suggest to use nginx as a reverse proxy with auth_request configured.
Once this is done, follow ReadonlyREST docs about proxy_auth rule.
Thanks for your quick reply and for your amazing plugin.
I have an application server that’s already configured to do all kinds of authentication schemes.
I’d rather use it for auth rather than adding ngninx into my architecture which would be difficult. As a wise developer said “no more proxies! Yay Ponies!”
Even X-Pack accept that there are cases for custom authentication
Having seen the proxy_auth implementation I think I can add external_auth myself (using Java’s URLConnection so no 3rd party dependencies)
I’m just hoping you would be willing to consider the pull request (even as an undocumented feature if that helps in anyway.)
You can certainly PR a new rule, you know I love PRs
But remember ES (and ReadonlyREST) are asynchronous, non-blocking applications based on Netty.
This means URLConnection cannot be used, as it’s a synchronous, blocking API. If you use it, you’ll block one of the few worker threads every time a request needs authentication (kinda always).
@coutoPL has done an excellent work setting up the framework for this kind of things defining a GeneralAuthKeyAsyncRule you could just extend:
I wonder if @CoutoPL could refactor his code to include the caching capability into it, leaving you to implement just the outbound HTTP request using any async client (i.e. we got Netty4 in the classpath already because of SSL) and wrapping the response into a CompletableFuture.
So my idea is that we could have something like GeneralCachedAuthKeyAsyncRule
Ok, I’m going to tell what I’m working on.
I’d like to add external authorization or/and external roles provider. I’d like to use proxy_auth together with new future to do authentication and authorization. So, external authentication could base on this feature.
I thought also about splitting ldap_auth into ldap_authentication and ldap_authorization rules. Then we could compose authentication with authorization rules (eg. authentication by reverse proxy with ldap authorization).
But there is more to do here … IMO it is high time to think about rules order. In my case I have to be sure that authentication rule will be checked before authorization rule - so second rule depends on first.
General cached auth rule is also great idea, because new async auth rule also should have some kind of caching (optional of course). So, ldap caching have to be generalised.
At the moment I’m working on external roles provider. When I finish (next week I’m going to deliver the feature), I can help with rest things I was writing about.
But IMO rules order & theirs dependencies should be discussed before starting development because it’s not so easy task to do it right.
A week ago, I had to build ROR plugin for ES 5.2.2 and backporting is very unpleasant. I thought about it and maybe it’s a good idea to abstract over ES and all ES dependent code move to separate module. Then there will be ror-module, es53x, es52x and so on. Each ES module will depend on ror-module. There will be only one branch and any new added feature will have take into consideration all supported ES versions at once.
I thought about this, sounds really nice, how do you propose this to be?
Two different repos?
Would one depend from the other via maven or as a git submodule?