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

support marathon basic auth (Bearer) #4074

Closed
adamdecaf opened this Issue Apr 10, 2018 · 12 comments

Comments

Projects
None yet
3 participants
@adamdecaf
Copy link
Contributor

adamdecaf commented Apr 10, 2018

Following from #3090 there's no support for Authorization: Basic ... with marathon, which is what non DC/OS installs use.

Part of the auth_token changes mention this: 2aba238

Existing configuration files that use the bearer token will no longer work. More work is required to make this backwards compatible.

Even before the auth_token[_file] changes this wouldn't have worked.

https://github.com/prometheus/prometheus/blob/v2.2.1/discovery/marathon/marathon.go#L300-L305

@adamdecaf

This comment has been minimized.

Copy link
Contributor Author

adamdecaf commented Apr 10, 2018

FYI, I've already got a local change support both auth types. I'll PR that when it's ready.

cc @plaflamme

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Apr 10, 2018

This was added in #4009.

@plaflamme

This comment has been minimized.

Copy link
Contributor

plaflamme commented Apr 10, 2018

@adamdecaf Can you describe what doesn't work exactly? The changes in #4009 should have added support for all authentication types:

  • basic auth (for vanilla Marathon)
  • auth token (for DC/OS Marathon)
  • bearer token (for future DC/OS Marathon, according to their documentation)
@adamdecaf

This comment has been minimized.

Copy link
Contributor Author

adamdecaf commented Apr 10, 2018

In specific the code here didn't seem to work for me. I need an auth header like Authorization: Basic ....

request.Header.Set("Authorization", "token="+string(rt.authToken))

Is there a pre-release docker image / release with #4009? I can test that out.

@adamdecaf

This comment has been minimized.

Copy link
Contributor Author

adamdecaf commented Apr 10, 2018

What I'm seeing is that the auth plugin we use needs Basic ..., which prometheus doesn't seem to allow.

    public static AuthKey authKeyFromHeaders(HttpRequest request) throws Exception {
        Option<String> header = request.header("Authorization").headOption();
        if (header.isDefined() && header.get().startsWith("Basic ")) {
            String encoded = header.get().replaceFirst("Basic ", "");
            String decoded = new String(Base64.getDecoder().decode(encoded), "UTF-8");
            String[] userPass = decoded.split(":", 2);

            return AuthKey.with(userPass[0], userPass[1]);
        }
        return null;
    }

https://github.com/ContainX/marathon-ldap/blob/master/src/main/java/io/containx/marathon/plugin/auth/util/HTTPHelper.java#L19

@plaflamme

This comment has been minimized.

Copy link
Contributor

plaflamme commented Apr 10, 2018

Ah, ok. That's because you need your config to use a basic_auth block as described in the updated documentation https://github.com/prometheus/prometheus/blob/master/docs/configuration/configuration.md#marathon_sd_config

@adamdecaf

This comment has been minimized.

Copy link
Contributor Author

adamdecaf commented Apr 10, 2018

Oh ok. The commits made it seem like basic/bearer auth were removed. Are they going to be around for a while? We're not going to use DC/OS.

Thanks. I'll try building a docker image from master locally with bearer_token_file.

@plaflamme

This comment has been minimized.

Copy link
Contributor

plaflamme commented Apr 10, 2018

@adamdecaf basic auth was not supported before #4009. Supporting it is what motivated the change.

All authentication methods should be supported in the long run. I suspect the auth_token method will be dropped if / when DC/OS moves to the more standard bearer_token authentication.

@adamdecaf

This comment has been minimized.

Copy link
Contributor Author

adamdecaf commented Apr 10, 2018

Perfect, thanks!

@adamdecaf

This comment has been minimized.

Copy link
Contributor Author

adamdecaf commented Apr 10, 2018

@brian-brazil @plaflamme Would y'all accept a basic_auth_file PR? I want to keep the basic auth params in a kubernetes Secret (mounted into the prometheus container).

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Apr 10, 2018

I wouldn't accept a file that contains basic auth details as that'd make debugging harder by making the username not available in the UI, if we were to accept it it would have to contain no more than the raw password.

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 10, 2018

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 10, 2018

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 11, 2018

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 11, 2018

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 12, 2018

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 12, 2018

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 13, 2018

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 16, 2018

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 17, 2018

support basic_auth.password_file, backport prometheus auth
Issue: prometheus/prometheus#4074

Signed-off-by: Adam Shannon <adamkshannon@gmail.com>

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 17, 2018

support basic_auth.password_file, backport prometheus auth
Issue: prometheus/prometheus#4074

Signed-off-by: Adam Shannon <adamkshannon@gmail.com>

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 17, 2018

support basic_auth.password_file, backport prometheus auth
Issue: prometheus/prometheus#4074

Signed-off-by: Adam Shannon <adamkshannon@gmail.com>

adamdecaf added a commit to adamdecaf/common that referenced this issue Apr 18, 2018

support basic_auth.password_file, backport prometheus auth
Issue: prometheus/prometheus#4074

Signed-off-by: Adam Shannon <adamkshannon@gmail.com>

brian-brazil added a commit to prometheus/common that referenced this issue Apr 23, 2018

support basic_auth.password_file, backport prometheus auth (#129)
Issue: prometheus/prometheus#4074

Signed-off-by: Adam Shannon <adamkshannon@gmail.com>
@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.