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

JVM agent authentication is hardcoded to Mode.ANY #344

Open
wsargent opened this issue Sep 7, 2017 · 1 comment
Open

JVM agent authentication is hardcoded to Mode.ANY #344

wsargent opened this issue Sep 7, 2017 · 1 comment

Comments

@wsargent
Copy link

@wsargent wsargent commented Sep 7, 2017

In JolokiaServerConfig, if HTTPS is on and client certificates are in use, then Jolokia treats this as an authentication of the JAAS subject:

        if (useHttps() && useSslClientAuthentication()) {
            authenticators.add(new ClientCertAuthenticator(this));
        }

https://github.com/rhuss/jolokia/blob/master/agent/jvm/src/main/java/org/jolokia/jvmagent/JolokiaServerConfig.java#L424

and likewise for JAAS (username and password):

else if ("jaas".equalsIgnoreCase(authMode)) {
            authenticators.add(new JaasAuthenticator(realm));
        }

https://github.com/rhuss/jolokia/blob/master/agent/jvm/src/main/java/org/jolokia/jvmagent/JolokiaServerConfig.java#L436

and the MultiAuthenticator is enabled for ANY inside a private method:

            authenticator = new MultiAuthenticator(MultiAuthenticator.Mode.ANY, authenticators);

https://github.com/rhuss/jolokia/blob/master/agent/jvm/src/main/java/org/jolokia/jvmagent/JolokiaServerConfig.java#L454

This is a problem, because I'm trying to get multi-factor authentication working with Jolokia, so I want a JAAS module AND a TLS client certificate, which I can do with JConsole / JMX / RMI with Yubikey JAAS module:

-Dcom.sun.management.jmxremote.registry.ssl=true \
-Dcom.sun.management.jmxremote.ssl=true \
-Dcom.sun.management.jmxremote.authenticate=true \
-Djava.security.auth.login.config=$CONFDIR/yubikey.config \
-Dcom.sun.management.jmxremote.login.config=YubikeyAuth \
-Dcom.sun.management.jmxremote.ssl.need.client.auth=true 

So it's a bit odd not to be able to do it in Jolokia.

@wsargent wsargent changed the title JVM agent JVM agent authentication is hardcoded to Mode.ANY Sep 7, 2017
@rhuss
Copy link
Owner

@rhuss rhuss commented Sep 10, 2017

You are right, this sounds like a valid use case.

I'm currently quite busy these days, but the implementation should be straightforward by introducing a configuration key authPass, with default any (for backwards compatibility) and alternate value every.

I would happily review and integrate any pull request which adds this feature (including doc & changelog update, and unit test if not too involved).

nevenr added a commit to nevenr/jolokia that referenced this issue Jul 1, 2018
nevenr added a commit to nevenr/jolokia that referenced this issue Jul 2, 2018
Applied suggested changes by Roland.
nevenr added a commit to nevenr/jolokia that referenced this issue Jul 2, 2018
Applied suggested changes by Roland.
nevenr added a commit to nevenr/jolokia that referenced this issue Jul 2, 2018
Applied suggested changes by Roland.
nevenr added a commit to nevenr/jolokia that referenced this issue Jul 2, 2018
nevenr added a commit to nevenr/jolokia that referenced this issue Jul 2, 2018
rhuss added a commit that referenced this issue Jul 4, 2018
…ToModeAny-344

 JVM agent authentication is hardcoded to Mode.ANY #344
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants