Solace Community is getting a facelift!

On March 3rd we will be starting the process of migrating Solace Community to a new platform. As a result, Solace Community will go in to a temporary read-only state. You will still be able to come onto Solace Community and search through posts to find answers, but you won't be able to ask questions, post comments, or react in any way.

We hope to have the migration complete by Wednesday March 5th (or sooner), so please keep an eye out!

How to connect the event broker using ssl connection?

loooool
loooool Member Posts: 3

Hello, solace team

I am a beginner and I want to ask some simple questions.

I have created a PubSub+ Software Event Broker on my local docker following blew tutorial:https://docs.solace.com/Software-Broker/SW-Broker-Set-Up/Containers/Set-Up-Docker-Container-Windows.htm

And I also connected to the broker using the node js tutorial as shown below:

And then I want to connect to the event broker by using SSL, I have uploaded the self-signed certificate and it looks like it's working:

I want to connect to port 8007 using SSL, so I replaced the above command and replaced ws://localhost:8008 with wss://localhost:8007 but it's not working.

So my question is are there any tutorials or tools to connect to? Forgive my stupid question as I don't have any background, thanks for the answer.

Tagged:

Best Answer

  • amackenzie
    amackenzie Member, Employee Posts: 270 Solace Employee
    #2 Answer ✓

    Hi,

    If it's a self-signed certificate, you need to tell the API where the public cert is with the `sslTrustStores` property that points to your local PEM.

    You can find a sample here:

    https://github.com/SolaceSamples/solace-samples-nodejs/blob/master/src/features/SecureSession.js

Answers

  • amackenzie
    amackenzie Member, Employee Posts: 270 Solace Employee
    #3 Answer ✓

    Hi,

    If it's a self-signed certificate, you need to tell the API where the public cert is with the `sslTrustStores` property that points to your local PEM.

    You can find a sample here:

    https://github.com/SolaceSamples/solace-samples-nodejs/blob/master/src/features/SecureSession.js

  • loooool
    loooool Member Posts: 3

    Hello again,

    Following your tip yesterday, I used the scuresession.js file. And I created a Private Certificate Authority using this command:

    openssl req -newkey rsa:2048 -nodes -keyout MyRootCaKey.pem -x509 -days 365 -out MyRootCaCert.pem
    

    Then I created a certificate using blew command:

    openssl genrsa -out client1.pem 2048
    openssl req -new -key client1.pem -out MyClient1.csr
    openssl x509 -req -in MyClient1.csr -CA MyRootCaCert.pem -CAkey MyRootCaKey.pem -CAcreateserial
    

    Knowing that at that time, I created a total of 4 files :

    Then I merged client1.pem and clientCert1.pem and uploaded it. And the port1443 is also not abnormal:

    Next, I pointed to these files in scuresession.js file.

    But when I connect to port1443, it still doesn't work.

    Is there any error in my operation?

    Thank you very much.

This Month's Leaders

This Week's Leaders