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

[APM] Authorization exception on Kibana startup #45610

Closed
liza-mae opened this issue Sep 13, 2019 · 7 comments
Closed

[APM] Authorization exception on Kibana startup #45610

liza-mae opened this issue Sep 13, 2019 · 7 comments
Assignees
Labels
blocker bug Fixes for quality problems that affect the customer experience Team:APM All issues that need APM UI Team support v7.4.0

Comments

@liza-mae
Copy link
Contributor

Kibana version: 7.4.0 BC4

Elasticsearch version: 7.4.0 BC4

Server OS version: Linux

Browser version: Chrome Latest

Original install method (e.g. download page, yum, from source, etc.):
staging

Description of the problem including expected versus actual behavior:
Kibana error message on startup, not sure what it means and if it is expected or not.

Steps to reproduce:

  1. Install ES/Kibana default
  2. Check Kibana logs, an error is thrown on apm agent configuration authorization exception

{"type":"error","@timestamp":"2019-09-13T02:10:25Z","tags":["warning","process"],"pid":2033,"level":"error","error":{"message":"Authorization Exception :: {"path":"/.apm-agent-configuration","query":{},"statusCode":403,"response":""}\n at respond (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:315:15)\n at checkRespForFailure (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:274:7)\n at HttpConnector. (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/connectors/http.js:166:7)\n at IncomingMessage.wrapper (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)\n at IncomingMessage.emit (events.js:194:15)\n at endReadableNT (_stream_readable.js:1103:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)","name":"UnhandledPromiseRejectionWarning","stack":"UnhandledPromiseRejectionWarning: Authorization Exception :: {"path":"/.apm-agent-configuration","query":{},"statusCode":403,"response":""}\n at respond (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:315:15)\n at checkRespForFailure (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:274:7)\n at HttpConnector. (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/connectors/http.js:166:7)\n at IncomingMessage.wrapper (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)\n at IncomingMessage.emit (events.js:194:15)\n at endReadableNT (_stream_readable.js:1103:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)\n at emitWarning (internal/process/promises.js:81:15)\n at emitPromiseRejectionWarnings (internal/process/promises.js:120:9)\n at process._tickCallback (internal/process/next_tick.js:69:34)"},"message":"Authorization Exception :: {"path":"/.apm-agent-configuration","query":{},"statusCode":403,"response":""}\n at respond (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:315:15)\n at checkRespForFailure (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:274:7)\n at HttpConnector. (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/connectors/http.js:166:7)\n at IncomingMessage.wrapper (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)\n at IncomingMessage.emit (events.js:194:15)\n at endReadableNT (_stream_readable.js:1103:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)"}
{"type":"error","@timestamp":"2019-09-13T02:10:25Z","tags":["warning","process"],"pid":2033,"level":"error","error":{"message":"Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)","name":"UnhandledPromiseRejectionWarning","stack":"Authorization Exception :: {"path":"/.apm-agent-configuration","query":{},"statusCode":403,"response":""}\n at respond (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:315:15)\n at checkRespForFailure (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:274:7)\n at HttpConnector. (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/connectors/http.js:166:7)\n at IncomingMessage.wrapper (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)\n at IncomingMessage.emit (events.js:194:15)\n at endReadableNT (_stream_readable.js:1103:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)"},"message":"Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)"}

@liza-mae liza-mae added bug Fixes for quality problems that affect the customer experience Team:APM All issues that need APM UI Team support labels Sep 13, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui

@sorenlouv
Copy link
Member

Ouch, this sounds like something we really need fixed before the release.

From the stacktrace I can't see exactly where the error occurs:

Authorization Exception :: {"path":"/.apm-agent-configuration","query":{},"statusCode":403,"response":""}
    at respond (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:315:15)
    at checkRespForFailure (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/transport.js:274:7)
    at HttpConnector. (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/src/lib/connectors/http.js:166:7)
    at IncomingMessage.wrapper (/tmp/kibana-7.4.0-linux-x86_64/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)
    at IncomingMessage.emit (events.js:194:15)
    at endReadableNT (_stream_readable.js:1103:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

But I'd assume it is this line:

const indexExists = await callWithInternalUser('indices.exists', { index });

If that's the case I'm a bit surprised. Because that call uses callWithInternalUser which afaiu should have access to all indices (and be able to create indices).

@ogupte Is this something you are able to repo?

@sorenlouv
Copy link
Member

@ogupte Could it be that you need to give the internal user access to the .apm-agent-configuration index?
https://www.elastic.co/guide/en/kibana/current/development-security-rbac.html

@sorenlouv
Copy link
Member

@liza-mae I was only able to reproduce this problem if I created a new user that didn't have the superuser role, and adding this user's credentials as the "internal user" kibana.yml file. Eg.

elasticsearch.username: myuser
elasticsearch.password: mypassword

With the default user I didn't get any errors. Can you elaborate a bit on which user Kibana is running with, and which roles this user has?

@sorenlouv
Copy link
Member

@ogupte Regardless why this happens we should probably wrap createApmAgentConfigurationIndex in a try/catch so as to not spam the kibana screen with errors in these scenarios.

@sorenlouv
Copy link
Member

sorenlouv commented Sep 16, 2019

@ogupte To handle the errors a bit more gracefully I've created #45764

(This doesn't address why the issue is happening in the first place which we should dig into)

@sorenlouv
Copy link
Member

Turns out that the default kibana user does not have access to the .apm-agent-configuration index. We can fix that in:
https://github.com/elastic/elasticsearch/blob/479ebd18ff365f592b76d158b51a31a3dfb165ed/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStore.java#L111-L129

Additionally we need to add access checks to the endpoints that return agent configuration data:

options: {
tags: ['access:apm']
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Fixes for quality problems that affect the customer experience Team:APM All issues that need APM UI Team support v7.4.0
Projects
None yet
Development

No branches or pull requests

4 participants