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

Health checks do not seem to take Basic Auth into consideration #274

Closed
jangie opened this issue Apr 27, 2017 · 3 comments
Closed

Health checks do not seem to take Basic Auth into consideration #274

jangie opened this issue Apr 27, 2017 · 3 comments

Comments

@jangie
Copy link
Contributor

jangie commented Apr 27, 2017

From my read of the code, I believe that the health checks against members in a cluster do not take into account the configured HTTPBasicAuthUser and HTTPBasicPassword on performing the health check.

To explain why I believe this is the case, cluster.go's healthCheckNode uses http.Client.Get (https://golang.org/src/net/http/client.go ), which does not allow for the attachment of custom headers in a similar way as http.Client.NewRequest and a following http.Client.Do would, nor does cluster.go seem to have a reference to the credentials at any point. client.go does showcase usage of the credentials as well as utilizing http.Client.NewRequest within buildAPIRequest.

If this is the case, this is problematic for consumers of this library who utilize Marathon's basic auth as basic auth seems to protect the ping endpoint in at least Marathon v1.4.2; once cluster's markDown is called, that member will not be able to be marked as up as it will only receive a 401 from Marathon at the /ping path.

@timoreimann
Copy link
Collaborator

@jangie thanks for filing a bug report.

I believe your analysis is perfectly correct: Credentials are not taken into consideration when doing health checks against unavailable cluster nodes. To me it seems like we should create a custom struct (maybe a custom HTTP client implementation?) holding HTTP-related parameters (including the credentials) and use it whenever we try to make a request against the Marathon API.

WDYT?

@jangie
Copy link
Contributor Author

jangie commented Apr 27, 2017

@timoreimann thank you for validating, and that sounds like a great approach. I will put together a PR to do this and will ensure it has a proper amount of test coverage.

Thanks!

@timoreimann
Copy link
Collaborator

Thanks @jangie, appreciated. 👍

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

No branches or pull requests

2 participants