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.toml
and changehttps
tohttp
.
This is necessary forcertbot
verification. - Under Gitlab project
Settings
on 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
certbot
installed, install it on your Mac usingbrew install certbot
. - Do a
git pull
to ensure you have an updated local copy of the repository. - Run
sudo certbot certonly -a manual -d d3vlabs.com
to 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 push
to 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 thecertbot
session in step 3. - Confirm the
certbot
session open in step 3. This will generatefullchain.pem
andprivkey.pem
.
Update the certificate on Gitlab
- Under Gitlab project
Settings
on 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.