Setting Up Client SSL Certificate Authentication for Rocket.Chat

You may want to add an extra layer of your security to your app. After installing Rocket.Chat following our Deploy with Docker & Docker Compose guide, here are the next steps to follow:

Install Nginx

sudo apt install -y nginx

Install Certbot

Install Certbotarrow-up-right to manage SSL certificates from LetsEncryptarrow-up-right \

sudo snap install --classic certbot
sudo certbot --nginx

You’ll be asked to provide a valid email and the domain set.

Generate Certificate Authority (CA) Certificates

Generate a key for your CA:

openssl genrsa -des3 -out ca.key 4096

Generate a certificate for your CA:

openssl req -new -x509 -days 365 -key ca.key -out ca.crt
circle-info
  • You can omit the email.

  • Avoid using a common name for the certificate.

  • When you renew the certificate, you'll want the Country, State, Locality, and Organization to match what you've input.

Run the same command to renew your certificate. To remember the options you chose, run the following command:

Move CA cert

Move the CA cert to /etc/ssl/private/client-cert-ca.crt directory.

Update Nginx config

Add CA cert, turn on client SSL authentication and add location block.\

Issue Client SSL Certificates for users

You can have your users perform most of these steps if you want. But the following are the steps needed to create a certificate to present as client authentication.

Generate key for user

Generate a CSR

Answer all of the questions, making sure to include your email address and Common Name (CN). The CSR must be sent to the administrator (or to you if you are handling this on behalf of the user).

Sign CSR with CA

As the admin, take the CSR given to you or generated by you and sign the CSR and create a valid certificate:\

You’ll want to increment the serial number with each signing. Once the certificate expires, a new CSR doesn’t need to be recreated; the same one can be signed, which will create a new certificate tied to that public key.

Return Certificate

The signed certificate (user.crt) can now be sent back to the user along with the CA cert(ca.crt).

To be able to use in browsers and mobile generate a pkcs #12 using the user cert and key along with the Ca:\