How to Add/Change Nginx SSL Certificates
Purpose
This article provides the steps required to provide your own certifications to your SoftNAS instance.
Symptoms
An SSL certificate is necessary for more than just distributing the public key. If it is signed by a trusted third-party, it verifies the identity of the server so clients know they aren’t sending their information (encrypted or not) to the wrong person.
What is a Self-Signed Certificate?
When could a Self-Signed Certificate prove adequate?
- Apache development server - There is no need to spend extra money buying a trusted certificate when you are just developing or testing an application.
- Intranet - When clients only have to go through a local Intranet to get to the server, there is virtually no chance of a man-in-the-middle attack.
- Personal sites with few visitors - If you have a small personal site that transfers non-critical information, there is very little incentive for someone to attack the connection.
Final Take
In other words, when deploying your SoftNAS server into an enterprise use case, it may be required (or at least strongly recommended) that you switch the default self-signed certifications for your own enterprise certifications.
Resolution
If you want to send or receive messages signed by root authorities and these authorities are not installed on the server, you must add a trusted root certificate manually.
Take a backup of the existing certificate and key files using the following commands:
mv /etc/pki/tls/certs/ca.crt /etc/pki/tls/certs/cat.crt-old mv /etc/pki/tls/private/ca.key /etc/pki/tls/private/ca.key-old
Upload the SSL certificate and key file using any preferred SSH client to the SoftNAS node and copy the newly uploaded certificate and key files to the correct path using the following commands:
cp <new>.crt /etc/pki/tls/certs/ca.crt cp <new>.key /etc/pki/tls/private/ca.key
Ensure that the ca.crt file has the correct permissions of 644 with root ownership using the following commands:
chown root:root /etc/pki/tls/certs/ca.crt chmod 644 /etc/pki/tls/certs/ca.crt
Ensure that the ca.key file has the correct permissions of 600 with root ownership using the following commands:
chown root:root /etc/pki/tls/private/ca.key chmod 600 /etc/pki/tls/private/ca.key
Once the new certificates and keys are in the correct place, check the Nginx configuration file and restart the service using the following commands:
nginx -t systemctl restart nginx
Changing the keys will deactivate replication so it is HIGHLY recommended to add the certificates BEFORE configuring replication to avoid any SnapReplicate™ interruption.
Change Keys after Configuring SnapReplicate™
Erase the SSH fingerprints by using the following command:
sed -I '/<OTHER-NODE-IP-ADDRESS>/d' .ssh/known_hosts
Add a new set of fingerprints by using the following command:
ssh-keyscan <OTHER-NODE-IP-ADDRESS> >> .ssh/known_hosts
- Log into the SoftNAS Web UI (StorageCenter) on both instances and try to activate HA again.
If you continue to experience issues, please contact Buurst Support for further assistance.