You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Thai Le <ln...@gmail.com> on 2023/03/16 20:10:14 UTC

Artemis operator: broker credential

Hello,
I am trying to configure an credential for a cluster of artemis broker
deployed by operator. Here is my helm chart:

apiVersion: broker.amq.io/v1beta1
kind: ActiveMQArtemis
metadata:
  name: activemq-artemis-broker
spec:
  console:
    expose: true
    sslEnabled: false
  deploymentPlan:
    size: 2
    image: placeholder
  adminUser: admin
  adminPassword: admin
  ingressDomain: 'my-laptop.com'

the adminUser and adminPassword are found in the CRD
https://artemiscloud.io/docs/help/custom-resources/
The chart deployed fine, however when I use java client to talk to the
broker, it does seem to ignore the credential. I basically can use any
username/password. Here is my client code:

public List<String> getAddresses() throws Exception {
    try (ServerLocator locator =
ActiveMQClient.createServerLocator(broker.getUrl());
         ClientSessionFactory factory = locator.createSessionFactory();
         ClientSession session = factory.createSession("randomUser",
"anyPassword", false, true, true,
                 true, 10);) {

        try (ClientRequestor requestor = new ClientRequestor(session,
"activemq.management");) {
            ClientMessage message = session.createMessage(false);
            ManagementHelper.putOperationInvocation(message,
ResourceNames.BROKER, "listAddresses", ", ");

            session.start();

            ClientMessage reply = requestor.request(message);
            Object result = ManagementHelper.getResult(reply);
            if (ManagementHelper.hasOperationSucceeded(reply)) {
                return Arrays.asList(((String) result).split(", "));
            } else {
                throw new RuntimeException("Unexpected reply from
message broker:" + (String) result);
            }
        }
    }
}

Is there an option that i have to put in the chart to force credential
check?

Regards
Thai Le

Re: Artemis operator: broker credential

Posted by Thai Le <ln...@gmail.com>.
Thank you Domenico, I'll ask on the github when I have more questions

Thai Le

On Thu, 16 Mar 2023 at 17:14, Domenico Francesco Bruscino <
bruscinodf@gmail.com> wrote:

> Hi Thai,
>
> this is more a question for ArtemisCloud.io[1] than the Apache ActiveMQ
> Artemis project. To disable the GuestLoginModule you need to set
> spec.requireLogin property to true, for further details related to the
> ArtemisCloud.io[1] operator feel free to ask your question at
> https://github.com/artemiscloud/activemq-artemis-operator/discussions
>
> [1] https://artemiscloud.io/
>
> Regards,
> Domenico
>
> On Thu, 16 Mar 2023 at 21:10, Thai Le <ln...@gmail.com> wrote:
>
> > Hello,
> > I am trying to configure an credential for a cluster of artemis broker
> > deployed by operator. Here is my helm chart:
> >
> > apiVersion: broker.amq.io/v1beta1
> > kind: ActiveMQArtemis
> > metadata:
> >   name: activemq-artemis-broker
> > spec:
> >   console:
> >     expose: true
> >     sslEnabled: false
> >   deploymentPlan:
> >     size: 2
> >     image: placeholder
> >   adminUser: admin
> >   adminPassword: admin
> >   ingressDomain: 'my-laptop.com'
> >
> > the adminUser and adminPassword are found in the CRD
> > https://artemiscloud.io/docs/help/custom-resources/
> > The chart deployed fine, however when I use java client to talk to the
> > broker, it does seem to ignore the credential. I basically can use any
> > username/password. Here is my client code:
> >
> > public List<String> getAddresses() throws Exception {
> >     try (ServerLocator locator =
> > ActiveMQClient.createServerLocator(broker.getUrl());
> >          ClientSessionFactory factory = locator.createSessionFactory();
> >          ClientSession session = factory.createSession("randomUser",
> > "anyPassword", false, true, true,
> >                  true, 10);) {
> >
> >         try (ClientRequestor requestor = new ClientRequestor(session,
> > "activemq.management");) {
> >             ClientMessage message = session.createMessage(false);
> >             ManagementHelper.putOperationInvocation(message,
> > ResourceNames.BROKER, "listAddresses", ", ");
> >
> >             session.start();
> >
> >             ClientMessage reply = requestor.request(message);
> >             Object result = ManagementHelper.getResult(reply);
> >             if (ManagementHelper.hasOperationSucceeded(reply)) {
> >                 return Arrays.asList(((String) result).split(", "));
> >             } else {
> >                 throw new RuntimeException("Unexpected reply from
> > message broker:" + (String) result);
> >             }
> >         }
> >     }
> > }
> >
> > Is there an option that i have to put in the chart to force credential
> > check?
> >
> > Regards
> > Thai Le
> >
>


-- 
Where there is will, there is a way

Re: Artemis operator: broker credential

Posted by Domenico Francesco Bruscino <br...@gmail.com>.
Hi Thai,

this is more a question for ArtemisCloud.io[1] than the Apache ActiveMQ
Artemis project. To disable the GuestLoginModule you need to set
spec.requireLogin property to true, for further details related to the
ArtemisCloud.io[1] operator feel free to ask your question at
https://github.com/artemiscloud/activemq-artemis-operator/discussions

[1] https://artemiscloud.io/

Regards,
Domenico

On Thu, 16 Mar 2023 at 21:10, Thai Le <ln...@gmail.com> wrote:

> Hello,
> I am trying to configure an credential for a cluster of artemis broker
> deployed by operator. Here is my helm chart:
>
> apiVersion: broker.amq.io/v1beta1
> kind: ActiveMQArtemis
> metadata:
>   name: activemq-artemis-broker
> spec:
>   console:
>     expose: true
>     sslEnabled: false
>   deploymentPlan:
>     size: 2
>     image: placeholder
>   adminUser: admin
>   adminPassword: admin
>   ingressDomain: 'my-laptop.com'
>
> the adminUser and adminPassword are found in the CRD
> https://artemiscloud.io/docs/help/custom-resources/
> The chart deployed fine, however when I use java client to talk to the
> broker, it does seem to ignore the credential. I basically can use any
> username/password. Here is my client code:
>
> public List<String> getAddresses() throws Exception {
>     try (ServerLocator locator =
> ActiveMQClient.createServerLocator(broker.getUrl());
>          ClientSessionFactory factory = locator.createSessionFactory();
>          ClientSession session = factory.createSession("randomUser",
> "anyPassword", false, true, true,
>                  true, 10);) {
>
>         try (ClientRequestor requestor = new ClientRequestor(session,
> "activemq.management");) {
>             ClientMessage message = session.createMessage(false);
>             ManagementHelper.putOperationInvocation(message,
> ResourceNames.BROKER, "listAddresses", ", ");
>
>             session.start();
>
>             ClientMessage reply = requestor.request(message);
>             Object result = ManagementHelper.getResult(reply);
>             if (ManagementHelper.hasOperationSucceeded(reply)) {
>                 return Arrays.asList(((String) result).split(", "));
>             } else {
>                 throw new RuntimeException("Unexpected reply from
> message broker:" + (String) result);
>             }
>         }
>     }
> }
>
> Is there an option that i have to put in the chart to force credential
> check?
>
> Regards
> Thai Le
>