Renew LetsEncrypt Certificates on Gitlab Pages
In this post, I will enlist the steps followed to renew the Gitlab Pages https certificate for this website. This post assumes that the certifcate has already expired, and hence the certbot verification that is required to generate a new certificate will not work over https, only http.
Prepare for a new certificate
- Edit
config.tomland changehttpstohttp.
This is necessary forcertbotverification. - Under Gitlab project
Settingson the left column, click onPages. Delete the https domain. - Uncheck
Force domains with SSL certificates to use HTTPS - Create a new domain with no certificate values (Cerficate PEM and Key PEM).
- This will create a new TXT record generated by Gitlab for domain verification. Go to your domain provider and add the TXT record. Click ‘Verify’ on the Gitlab TXT domain verification page.
Create the certificate
- If you don’t have
certbotinstalled, install it on your Mac usingbrew install certbot. - Do a
git pullto ensure you have an updated local copy of the repository. - Run
sudo certbot certonly -a manual -d d3vlabs.comto generate new verification links. Keep this window open. You’ll need it in step 7. - Update the repository under
./static/.well-known/acme-challenge. - Do a
git pushto update the Gitlab repository to enable verification. - Ensure that the link generates necessary response by running
curl <http link fromcertbot>. This should return the response expected by thecertbotsession in step 3. - Confirm the
certbotsession open in step 3. This will generatefullchain.pemandprivkey.pem.
Update the certificate on Gitlab
- Under Gitlab project
Settingson the left column, click onPages. Delete the http domain. - Check
Force domains with SSL certificates to use HTTPS - Create a new domain with the new certificate values generated in step 7 from the previous section.
- This will create a new TXT record generated by Gitlab for domain verification. Go to your domain provider and add the TXT record. Click ‘Verify’ on the Gitlab TXT domain verification page.