4 Replies Latest reply on May 1, 2017 12:16 PM by Toby Oswald

    mask-password in hornetq-configuration

    Toby Oswald Newbie

      I 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!

        • 1. Re: mask-password in hornetq-configuration
          Justin Bertram Master

          There is a bug here that's breaking this functionality.  It's fixed upstream in the Artemis project via ARTEMIS-1074.

           

          If you weren't aware, the HornetQ code-base was donated to the Apache ActiveMQ community a couple of years ago and is now Apache ActiveMQ Artemis. HornetQ itself is no longer under active development, but development on Artemis is very active.

          • 2. Re: mask-password in hornetq-configuration
            Toby Oswald Newbie

            I was aware that the code had been donated.  Text below is from the notice you referenced, have bugs stopped being fixed on the active branches (2.3 and 2.4)??  When did bug fixes referenced below stop?  I downloaded and ran the same test on Artemis 2.0 and received the same result.  If I fix for my codebase, I shouldn't update anywhere else?

             

             

            "The Artemis project is targeted to house this next generation of message broker, as such any new feature requests or contributions from the HornetQ community should now be placed into the Artemis stream of development. HornetQ will of course have bugs fixed on its active branches (2.3 and 2.4) but will be mostly in maintenance only mode."

            • 3. Re: mask-password in hornetq-configuration
              Justin Bertram Master

              Text below is from the notice you referenced, have bugs stopped being fixed on the active branches (2.3 and 2.4)?? When did bug fixes referenced below stop?

              The HornetQ donation to the Apache ActiveMQ community was made on October 9, 2014.  You can checkout the 2.3.x and 2.4.x HornetQ branches and run 'git log --since=10/9/2014' on each to see what's been fixed since then. In short, small fixes have been made here and there, but most of what's been fixed in Artemis has not been back-ported to HornetQ. At this point the code-bases are fairly different from each other.

               

              I downloaded and ran the same test on Artemis 2.0 and received the same result.

              The fix for ARTEMIS-1074 was committed on March 28, 2017.  Artemis 2.0.0 was tagged on March 10, 2017.  Therefore the fix for ARTEMIS-1074 isn't in Artemis 2.0.0.

               

              If I fix for my codebase, I shouldn't update anywhere else?

              You're certainly free to open JIRAs for HornetQ and send PRs, but there won't be any more releases. I would recommend you move to Apache ActiveMQ Artemis so you can receive the benefit of the last several years of work as well as an active community.

              • 4. Re: mask-password in hornetq-configuration
                Toby Oswald Newbie

                OK, thanks for the help!  We are stuck at this point with Hornetq, but will be evaluating our upgrade path.