
Originally Posted by
bwelnack
I have been trying to secure the JConsole access to my stand-alone Java Server which uses Spring 2.5, but it seems anyone that knows the URL and jmx port can access JConsole without being challenged for login credentials. The Sun docs say that by default authentication is enabled, but it seems not...
Working configuration:
Code:
<util:map id="jmx.environment">
<entry key="com.sun.management.jmxremote.authenticate" value="true"/>
<entry key="jmx.remote.x.password.file" value="[Absolute path to file with 600 permissions] "/>
</util:map>
<bean depends-on="mbeanServer" id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean"
p:objectName="connector:name=slpRMIConnector"
p:serviceUrl="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/myConnector"
p:environmentMap-ref="jmx.environment" />
jmx.remote.x.password.file property is used in javax.management.remote.rmi.RMIServerImpl.doNewCli ent() method as follows:
Code:
RMIConnection doNewClient(Object credentials) throws IOException {
...
Subject subject = null;
JMXAuthenticator authenticator =
(JMXAuthenticator) env.get(JMXConnectorServer.AUTHENTICATOR);
if (authenticator == null) {
/*
* Create the JAAS-based authenticator only if authentication
* has been enabled
*/
if (env.get("jmx.remote.x.password.file") != null ||
env.get("jmx.remote.x.login.config") != null) {
authenticator = new JMXPluggableAuthenticator(env);
}
}
if (authenticator != null) {
if (tracing) logger.trace("newClient","got authenticator: " +
authenticator.getClass().getName());
try {
subject = authenticator.authenticate(credentials);
} catch (SecurityException e) {
logger.trace("newClient", "Authentication failed: " + e);
throw e;
}
}
...
}
Regards,
Maciej