--- old/src/jdk.management.agent/share/classes/sun/management/jmxremote/ConnectorBootstrap.java 2017-10-06 00:40:06.943425886 +0530 +++ new/src/jdk.management.agent/share/classes/sun/management/jmxremote/ConnectorBootstrap.java 2017-10-06 00:40:06.843425579 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,10 +72,9 @@ import javax.rmi.ssl.SslRMIClientSocketFactory; import javax.rmi.ssl.SslRMIServerSocketFactory; import javax.security.auth.Subject; - import com.sun.jmx.remote.internal.rmi.RMIExporter; +import com.sun.jmx.remote.security.HashedPasswordManager; import com.sun.jmx.remote.security.JMXPluggableAuthenticator; - import jdk.internal.agent.Agent; import jdk.internal.agent.AgentConfigurationError; import static jdk.internal.agent.AgentConfigurationError.*; @@ -103,6 +102,7 @@ public static final String USE_REGISTRY_SSL = "false"; public static final String USE_AUTHENTICATION = "true"; public static final String PASSWORD_FILE_NAME = "jmxremote.password"; + public static final String HASH_PASSWORDS = "true"; public static final String ACCESS_FILE_NAME = "jmxremote.access"; public static final String SSL_NEED_CLIENT_AUTH = "false"; } @@ -130,6 +130,8 @@ "com.sun.management.jmxremote.authenticate"; public static final String PASSWORD_FILE_NAME = "com.sun.management.jmxremote.password.file"; + public static final String HASH_PASSWORDS + = "com.sun.management.jmxremote.password.hashpasswords"; public static final String ACCESS_FILE_NAME = "com.sun.management.jmxremote.access.file"; public static final String LOGIN_CONFIG_NAME = @@ -410,6 +412,7 @@ String loginConfigName = null; String passwordFileName = null; + boolean shouldHashPasswords = true; String accessFileName = null; // Initialize settings when authentication is active @@ -424,6 +427,11 @@ passwordFileName = props.getProperty(PropertyNames.PASSWORD_FILE_NAME, getDefaultFileName(DefaultValues.PASSWORD_FILE_NAME)); + String hashPasswords + = props.getProperty(PropertyNames.HASH_PASSWORDS, + DefaultValues.HASH_PASSWORDS); + shouldHashPasswords = Boolean.parseBoolean(hashPasswords); + checkPasswordFile(passwordFileName); } @@ -471,7 +479,7 @@ sslConfigFileName, enabledCipherSuitesList, enabledProtocolsList, sslNeedClientAuth, useAuthentication, loginConfigName, - passwordFileName, accessFileName, bindAddress); + passwordFileName, shouldHashPasswords, accessFileName, bindAddress); cs = data.jmxConnectorServer; url = data.jmxRemoteURL; config("startRemoteConnectorServer", @@ -728,6 +736,7 @@ boolean useAuthentication, String loginConfigName, String passwordFileName, + boolean shouldHashPasswords, String accessFileName, String bindAddress) throws IOException, MalformedURLException { @@ -757,6 +766,9 @@ if (passwordFileName != null) { env.put("jmx.remote.x.password.file", passwordFileName); } + if (shouldHashPasswords) { + env.put("jmx.remote.x.password.hashpasswords", "true"); + } env.put("jmx.remote.x.access.file", accessFileName);