🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

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: 269 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: 269 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 Week's Leaders