-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Kibana sometimes sends HTTP requests to Elasticsearch without credentials #9583
Comments
The .kibana/config requests without auth will be fixed by #9442 in the next release. Are you seeing this for more endpoints? Looking into it too. |
This is the set of actions I had to explicitly allow to be requested without authentication (for any index) to make Kibana work actions: ["indices:data/read/field_stats", "indices:admin/mappings/fields/get", "indices:admin/get", "indices:data/read/msearch"] |
@jbudz if you have Kibana builds to make me test, I have all set up on the ES side to test and I'm more than happy to help out! |
@sscarduzio awesome, thanks. We have snapshots here. |
Nice, is there already something I can test about this bug in the 5.1.2 snapshot? |
Yeah, #9446 should fix the auth requests to .kibana/config |
Hello! I noticed this is labelled as "neeeds details", do you need more details? |
These endpoints were fixed in 5.1.2. |
@epixa Kibana with x-pack installed has this problem again, cannot load the /app/monitoring (Marvel). I see a |
Oh and when I click on Timelion, I see |
@sscarduzio Can you give some steps to reproduce the issue you're having with monitoring? Monitoring is loading without issue for me, and requests are properly authorized. There are circumstances where Kibana will attempt to query for the config prior to authorization being available, and in those cases it will gracefully handle the authorization error that is returned from Elasticsearch, which is probably what you saw in the latter case. |
Sure, here is a step by step how to reproduce this with screenshots.
xpack.security.enabled: false
xpack.monitoring.enabled: true
xpack.graph.enabled: false
xpack.reporting.enabled: false
elasticsearch.username: "kibana"
elasticsearch.password: "kibanapassword"
|
@epixa the issue still exists with elasticstack 5.2.0, why closed? |
@sscarduzio why the elastic team taking so much time to resolve and fix this important issue? |
@sscarduzio To clarify, the requests that you listed in your last comment that do not include an authorization header do get rejected by Elasticsearch as unauthorized, correct? |
@gitime We're still trying to figure out what the issue even is. We're having no authorization issues in any of our testing, neither in our manual testing nor in our automated testing. As a Kibana end-user, how is this issue affecting you? |
I think I've reproduced the issue, but I'd appreciate it if either of you could confirm on your end. When security is enabled on Elasticsearch and disabled on Kibana, Monitoring fails to work due to access denied errors by default. The search profiler (via dev tools) also fails (as do reporting requests behind the scenes, but that's disabled for this reproduction). In both cases, the authorization headers are not being sent, which is causing the failed requests. If you go to discover or something like that, the requests work and have the authorization header. Now this is where it gets really strange: if you go to discover and then generate a short URL via the "share" menu, you'll see that that request does properly have an authorization header, and the short url is created. Now, if you go to search profiler and execute a search, the authorization header is sent and the request works this time. Also at this time, if you manually navigate to /app/monitoring (to make sure you're bypassing the access denied page), monitoring works and all the requests are sending the authorization header. Edit: And taking that one step further, once the authorization header starts sending for xpack requests, even refreshing the page doesn't stop the requests from working. Starting a new incognito window will get us back into a failing state though. |
@epixa I really appreciate your time for digging into this, and man, I know browsers' "magic" in handling HTTP basic auth is a source of major confusion while dealing with this kind of issues. I just reproduced the additional instance of unauthenticated request when you click on dev tools:
The way I've been detecting these issuesIn hope it will be useful, I can share my initial testing setup (before inspecting with Wireshark). I believe it offers a great framework for pin-pointing rogue unauthenticated requests. My original test involved installing readonlyrest plugin and configuring it to accept only requests carrying HTTP basic auth credentials (user=kibana, pass=kibana). xpack.security.enabled: false
xpack.monitoring.enabled: true
xpack.graph.enabled: false
xpack.watcher.enabled: false
readonlyrest:
enable: true
access_control_rules:
- name: Kibana
auth_key: kibana:kibanapassword
type: allow I then set up Kibana to use those credentials too xpack.security.enabled: false
xpack.monitoring.enabled: true
xpack.graph.enabled: false
xpack.reporting.enabled: false
elasticsearch.username: "kibana"
elasticsearch.password: "kibanapassword" Then I opened my browser and gave the same credentials from the browser too. At this stage I knew:
Tell me if I can help any further. _Simone |
@sscarduzio Thanks for all of that info and your time so far in debugging this. We've figured it out. The problem is that certain requests in Kibana and X-Pack are not returning a 401 when Elasticsearch does. Browsers rely on that 401 error for their basic auth process, even when basic auth has already been completed once on that domain. The thing is, once basic auth credentials for a given realm are stored in the browser, the browser will automatically resend newly-authorized requests that 401 with the same realm that is stored, but browser dev tools merge these requests together and treat them as a single thing. This is convenient in most cases, but it made it particularly hard to track down an issue like this without a lower level tool like wireshark. One thing that's worth mentioning again is that this is not a security vulnerability since the requests are being rejected as they should be, but it is definitely not the behavior we want. To help illustrate the problem for anyone that still doesn't follow, let's talk about what is happening at the request level in the Really Strange™ behavior I described in a previous comment.
The solution here is to go through all authenticated endpoints in Kibana and X-Pack to make sure they are properly returning 401 errors for missing credentials. We're tracking this effort in an internal ticket, but I'm going to open this one so we have a public place to update on status and to which we can link pull requests. |
/cc @spalger @ycombinator |
@epixa any news on this problem? |
Idem, receive same error |
works, added readonlyrest one rule:
Kibana require auth, monitoring (x-pack), works. wow! |
+1 |
We're actively looking into a solution to this problem that will prevent us from chasing down end-points that aren't handling the |
+1 |
We just stumbled upon this. So far we are using the
Being |
This behaviour is observed in Elastic v6.4.2 as well (especially for calls made to update monitoring index by x-pack plugin). The impact is more for use cases where an OSS plugin is used for security on top of ES and basic auth needs is enabled for Kibana. |
I'm using the following hack with nginx as a proxy in front of Kibana to trick the browser to store credentials for the entire hostname: location = / {
# Hack to workaround https://github.com/elastic/kibana/issues/9583
if ($http_authorization !~* "^Basic") {
rewrite .* /app/kibana break;
}
proxy_pass http://localhost:5601;
}
location / {
if ($http_authorization !~* "^Basic") {
return 302 https://$host;
}
proxy_pass http://localhost:5601;
} If a client does not send an Authorization header I force a proxy_pass towards |
This has been resolved via #88850 (shipped in |
Kibana version: 5.1.1
Elasticsearch version: 5.1.1
Server OS version:OSX 10.11.6
Browser version: Chrome 54
Browser OS version: OSX 10.11.6
Original install method (e.g. download page, yum, from source, etc.): unzipped the tarball
Description of the problem including expected versus actual behavior: Kibana server sends some HTTP request without authorization header.
Steps to reproduce:
Errors in browser console (if relevant):
Provide logs and/or server output (if relevant):
The text was updated successfully, but these errors were encountered: