mask-password in hornetq-configuration
ozzie100 Apr 28, 2017 11:59 AMI modified the ssl-enabled example from hornet1-2.4.0.Final.
java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
1) I verified it worked - mvn verify = success
2) I modified the hornetq-users.xml file by adding in the mask-password and password-codec elements and changing to the correct masked password (80cf731af62c290)
Output from DefaultSensitiveStringCodec class ( wrote my own driver)
Input value guest
Output value 80cf731af62c290
<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-users.xsd"> <!-- the default user. this is used where username is null--> <mask-password>true</mask-password> <password-codec>org.hornetq.utils.DefaultSensitiveStringCodec</password-codec> <defaultuser name="guest" password="80cf731af62c290"> <role name="guest"/> </defaultuser> </configuration>
mvn verify = success
3) I attempted to mask passwords in the hornetq-configuration.xml file by repeating steps from above:
Output from DefaultSensitiveStringCodec class ( wrote my own driver)
Input value hornetqexample
Output value 69b1cb1b212fdf0286acb468916b5e81
<mask-password>true</mask-password> <password-codec>org.hornetq.utils.DefaultSensitiveStringCodec</password-codec> <cluster-user>donotcare</cluster-user> <cluster-password>69b1cb1b212fdf0286acb468916b5e81</cluster-password> <!-- Connectors --> <connectors> <connector name="netty-ssl-connector"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class> <param key="host" value="localhost"/> <param key="port" value="5500"/> <param key="ssl-enabled" value="true"/> <param key="trust-store-path" value="hornetq/server0/hornetq.example.truststore"/> <param key="trust-store-password" value="69b1cb1b212fdf0286acb468916b5e81"/> </connector> </connectors> <!-- Acceptors --> <acceptors> <acceptor name="netty-ssl-acceptor"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class> <param key="host" value="localhost"/> <param key="port" value="5500"/> <param key="ssl-enabled" value="true"/> <param key="key-store-path" value="hornetq/server0/hornetq.example.keystore"/> <param key="key-store-password" value="69b1cb1b212fdf0286acb468916b5e81"/> </acceptor> </acceptors> <!-- Other config --> <security-settings> <!--security for example queue--> <security-setting match="jms.queue.exampleQueue"> <permission type="createDurableQueue" roles="guest"/> <permission type="deleteDurableQueue" roles="guest"/> <permission type="createNonDurableQueue" roles="guest"/> <permission type="deleteNonDurableQueue" roles="guest"/> <permission type="consume" roles="guest"/> <permission type="send" roles="guest"/> </security-setting> </security-settings> </configuration>
mvn verify - Failure
INFO: HQ221035: Live Server Obtained live lock
Apr 28, 2017 9:15:24 AM org.hornetq.core.server.impl.HornetQServerImpl deployQueue
INFO: HQ221003: trying to deploy queue jms.queue.exampleQueue
Apr 28, 2017 9:15:24 AM org.hornetq.core.remoting.server.impl.RemotingServiceImpl start
WARN: HQ222080: Error instantiating remoting acceptor org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory
java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
at org.hornetq.utils.ConfigurationHelper.getPasswordProperty(ConfigurationHelper.java:223)
at org.hornetq.core.remoting.impl.netty.NettyAcceptor.<init>(NettyAcceptor.java:210)
at org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory.createAcceptor(NettyAcceptorFactory.java:44)
at org.hornetq.core.remoting.server.impl.RemotingServiceImpl.start(RemotingServiceImpl.java:291)
at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1689)
at org.hornetq.core.server.impl.HornetQServerImpl.access$1400(HornetQServerImpl.java:172)
at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation.run(HornetQServerImpl.java:2169)
at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:432)
at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:483)
at org.hornetq.server.HornetQBootstrap.createServer(HornetQBootstrap.java:207)
at org.hornetq.server.HornetQBootstrap.execute(HornetQBootstrap.java:134)
at org.hornetq.maven.HornetQStartPlugin.execute(HornetQStartPlugin.java:204)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Apr 28, 2017 9:15:24 AM org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation run
INFO: HQ221007: Server is now live
Apr 28, 2017 9:15:24 AM org.hornetq.core.server.impl.HornetQServerImpl start
INFO: HQ221001: HornetQ Server version 2.5.0.SNAPSHOT (Wild Hornet, 124) [73314b33-2c22-11e7-a905-a1d2840e714d]
[INFO]
[INFO] --- hornetq-maven-plugin:1.2.0:runClient (runClient) @ hornetq-jms-ssl-enabled-example ---
Apr 28, 2017 9:15:24 AM org.hornetq.common.example.HornetQExample getContext
INFO: using jnp://localhost:1099 for jndi
Apr 28, 2017 9:15:24 AM org.hornetq.core.client.impl.ClientSessionFactoryImpl getConnection
WARN: HQ212007: connector.create or connectorFactory.createConnector should never throw an exception, implementation is badly behaved, but we will deal with it anyway.
java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
at org.hornetq.utils.ConfigurationHelper.getPasswordProperty(ConfigurationHelper.java:223)
at org.hornetq.core.remoting.impl.netty.NettyConnector.<init>(NettyConnector.java:320)
at org.hornetq.core.remoting.impl.netty.NettyConnectorFactory.createConnector(NettyConnectorFactory.java:40)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:1201)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:1072)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:249)
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:885)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:672)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:115)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:110)
at org.hornetq.jms.example.SSLExample.runExample(SSLExample.java:55)
at org.hornetq.common.example.HornetQExample.run(HornetQExample.java:70)
at org.hornetq.jms.example.SSLExample.main(SSLExample.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.hornetq.maven.HornetQClientPlugin.execute(HornetQClientPlugin.java:64)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
javax.jms.JMSException: Failed to create session factory
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:676)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:115)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:110)
at org.hornetq.jms.example.SSLExample.runExample(SSLExample.java:55)
at org.hornetq.common.example.HornetQExample.run(HornetQExample.java:70)
at org.hornetq.jms.example.SSLExample.main(SSLExample.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.hornetq.maven.HornetQClientPlugin.execute(HornetQClientPlugin.java:64)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: HornetQNotConnectedException[errorType=NOT_CONNECTED message=HQ119007: Cannot connect to server(s). Tried with all available servers.]
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:909)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:672)
... 32 more
Any help appreciated!