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

[7.x] Clarify error message when unauthorized Kibana connection (#3753) #3764

Merged
merged 1 commit into from
May 11, 2020

Conversation

jalvz
Copy link
Contributor

@jalvz jalvz commented May 6, 2020

Backports the following commits to 7.x:

@jalvz jalvz added the backport label May 6, 2020
@apmmachine
Copy link
Contributor

apmmachine commented May 6, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview stats

Expand to view the summary

Build stats

  • Build Cause: [Branch indexing]

  • Start Time: 2020-05-08T18:51:52.758+0000

  • Duration: 30 min 26 sec (1825574)

  • Commit: af24a3e

Test stats 🧪

Test Results
Failed 0
Passed 3014
Skipped 142
Total 3156

@jalvz jalvz merged commit 84b88c0 into elastic:7.x May 11, 2020
@axw axw self-assigned this May 12, 2020
@axw
Copy link
Member

axw commented May 12, 2020

Will need to wait for a new BC to test this one.

@axw
Copy link
Member

axw commented May 14, 2020

If I don't have any kind of auth enabled in apm-server, then with invalid/missing kibana auth I get this response when querying agent config:

$ curl http://localhost:8200/config/v1/agents?service.name=foo

{                                       
  "error": "Unauthorized"         
}

I'm not sure that behaviour is quite right, but it's existing behaviour. What I'm not sure about is whether we should be suppressing the error message when the server doesn't have any auth enabled. It certainly makes sense to suppress it when it's enabled but not supplied.

If I enable secret token auth in apm-server, and send a secret token in the query, I see the full message:

$ curl -H "Authorization: Bearer hunter2" http://localhost:8200/config/v1/agents?service.name=foo

{
  "error": "APM Server is not authorized to query Kibana. Please configure apm-server.kibana.username and apm-server.kibana.password, and ensure the user has the necessary privileges."
}

@axw
Copy link
Member

axw commented May 14, 2020

@jalvz is that behaviour expected?

@jalvz
Copy link
Contributor Author

jalvz commented May 14, 2020

Yes, I followed the same logic from other cases:

func extractInternalError(c *request.Context, err error, withAuth bool) {
(authErrMsg)

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

Successfully merging this pull request may close these issues.

3 participants