Renew website certificate
Jump to navigation
Jump to search
How to update a security certificate for a website
[edit | edit source]If renewing a certificate currently installed, you do not need to generate the csr or key files. Just go to step 4 and renew the certificate and download the .cer file. It will match the already installed .key file. Our current web server (Rodeo-Five) uses Nginx instead of Apache
- Generate the CSR file on the web server
- Log in via SSH
- Enter the following command:
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
- Enter the following details:
- Common name:
ces.fas.harvard.edu
- Organization:
President and Fellows of Harvard College
- Department (OU):
Center for European Studies
- City:
Cambridge
- State:
Massachusetts
- Country:
US
- Common name:
- The new CSR and Key file will generate in the current user /home/ folder
- Copy the CSR to local machine
- From local machine, open a CMD window
scp -r username@host.ip:/home/username/cert_name.csr C:/local_folder
- The
-r
switch will move the whole folder. Do this to create a backup of the key file off server
- From local machine, open a CMD window
- Upload CSR to InCommon
- Log into InCommon with federated login
- Go to certificates tab and select
Renew
orReplace
- Submit the text of the CSR file
- Wait for approval
- Download the new certificate
- On Incommon, select
Details
then by "Download the Certificate," clickSelect
- Select the "Certificate Only" option
- On Incommon, select
- Copy new .cer to server
scp C:/local_folder/cert_name.cer username@host.ip:/home/username
- Move .cer and Key files to correct folders
- This assumes the names are different from the already installed files. They will be overwritten if the same name.
sudo mv cert_name.cer /etc/ssl/certs
sudo mv key_file_name.key /etc/ssl/private
- Rename old .cer and .key files.
- Append with .old. Easiest to do if in the correct directory
sudo mv old_cert_name.cer old_cert_name.cer.old
- To access /private/ to change the .key file name, you must change to root
sudo -i
. Be extremely cautious while doing this and immediately disconnect and reconnect as sudo user after renaming old and new Key files
- Rename new .cer and Key files to match Nginx file
- These will replace the naming of the files just renamed .old
sudo mv ces_fas_harvard_edu.cer ces.fas.harvard.edu.cer
- Repeat for key file as root user
- Confirm filenames are correct in Nginx ssl.conf file
sudo nano /etc/nginx-sp/vhosts.d/ssl.conf
- If the name changes are correct, the ssl.conf file should point straight at them already
- Update the dates on the certificate in the comments
- These will replace the naming of the files just renamed .old
- Restart the Nginx service
sudo systemctl restart nginx-sp
- Should exit without error. If there is an error, the .cer and .key files likely do not match. Confirm that they are named correctly
- Test by going to website.
- Certificate authority on web page should be "Internet2"