Support for Kerberos Authentication/Authorization on JMX Client/Server running on Java 6

拈花ヽ惹草 提交于 2019-11-30 14:34:50

You need to include the unlimited strength cryptography policy file (link is for Java 6, see java.oracle.com for others) in your Java installation. By default Java does not allow you to use strong encryption like AES256 (because of absurd US export laws which consider encryption to be weapons/munition). The policy file will unlock stronger encryption.

Devendra Wani

Managed to fixed above problem. Here are the steps to introduce Kerberos authentication/authorization at your JMX client/server

To enable Kerberos @ JMX server,

  1. Start server with following set of args =>

    -Dcom.sun.management.jmxremote=true
    -Dcom.sun.management.jmxremote.port=<port_no>
    -Dcom.sun.management.jmxremote.authenticate=true
    -Dcom.sun.management.jmxremote.ssl=false
    -Djava.security.auth.login.config=<locatin_of_jaas.conf>
    -Djava.security.krb5.conf=<locatin_of_krb5.conf>
    -Dcom.sun.management.jmxremote.login.config=<name_of_login_config_to_be_used>
    -Djava.net.preferIPv4Stack=true
    
  2. Add access entry in $JAVA_HOME/jre/lib/management/jmxremote.access. Once user get authenticated, read/write access to JMX server will be provided on basis of jmxremote.access. Location of .access file can be provided using following jvm arg at server start up

    -Dcom.sun.management.jmxremote.access.file=<acees_control_file>    
    

To enable Kerberos @ JMX Client (jconsole)

  1. Start jconsole with debug option & connect to server

    jconsole -J-Djava.security.debug=all
    
  2. if requested encryption is AES256, then download unlimited strength cryptography policy jar files, extract and place policy files at $JAVA_HOME/jre/lib/security/. [Thanks to Mark for pointing out policy inclusion.]

Above should make Kerberos work at both JMX client and JMX server side

If you are still facing problem in connection then you can enable verbose debugging for jconsole using logging.properties file =>

handlers = java.util.logging.ConsoleHandler
.level = INFO
java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
// Use FINER or FINEST for javax.management.remote.level - FINEST is very verbose...
javax.management.level = FINEST
javax.management.remote.level = FINER

And start jconsole using

jconsole -J-Djava.util.logging.config.file=<location_of_logging.properties>

I have followed the instructions above and managed to get kerberos authentication working provided I enter my userid and password in jconsole. Inevitably this sends my password over the wire in clear text as I have set com.sun.management.jmxremote.ssl=false on the server.

Have you managed to connect jconsole by using a cached ticket on the client side? For example, if you did:

kinit user
Password for user@REALM:
New ticket is stored in cache file C:\Users\user\krb5cc_user

then tried connecting jconsole to the server without entering your userid/password?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!