jenkins-infra / helpdesk

Open your Infrastructure related issues here for the Jenkins project
https://github.com/jenkins-infra/helpdesk/issues/new/choose
16 stars 10 forks source link

Renew SSL certificate for updates.jenkins-ci.org #3500

Closed MarkEWaite closed 1 year ago

MarkEWaite commented 1 year ago

Service(s)

Update center

Summary

The Jenkins update center is available from two different URLs:

The SSL certificate on the first URL https://updates.jenkins.io expires May 9, 2023. That is 31 days from now. If we renew it within the next week, that will be a comfortable margin for renewal

The SSL certificate on the second URL https://updates.jenkins-ci.org expires May 1, 2023. That is 23 days from now. If we renew it within the next week, that will be a comfortable margin for renewal

Since they are the same machine, it is a little surprising that the SSL certificates expire at different times

Reproduction steps

  1. Open a web browser to https://updates.jenkins.io and check the SSL certificate expiration date. My browser reports it as 9 May 2023
  2. Open a web browser to https://updates.jenkins-ci.org and check the SSL certificate expiration date. My browser reports it as 1 May 2023
github-actions[bot] commented 1 year ago

Take a look at these similar issues to see if there isn't already a response to your problem:

  1. 73% #3337
  2. 70% #3091
dduportal commented 1 year ago

Let's check again the Monday 10 of April: the certbot renew command is run once a day, at 06:00am UTC, and is expected to renew certificates 1 month before expiration

MarkEWaite commented 1 year ago

Worth another check Tuesday 11 April 2023. since that will be 29 days before the expiration of the updates.jenkins.io certificate.

As of 22:40 UTC 10 April 2023 the certificate is not renewed.

dduportal commented 1 year ago

Operations done with the help of @smerle33 earlier today, on the VM pkg.origin.jenkins.io (which hosts the 2 updates.jenkins* services):

dduportal commented 1 year ago

Next steps before closing this issue:

smerle33 commented 1 year ago

event in place for the 12th of june (monday)

dduportal commented 1 year ago
dduportal commented 1 year ago
cp -r /etc/letsencrypt /root/bkp-letsencrypt-20230411
apt-get remove --purge certbot
cp -r /root/bkp-letsencrypt-20230411 /etc/letsencrypt
certbot renew
systemctl reload apache2
systemctl restart apache2
dduportal commented 1 year ago

Reopening as the certificate has not renewed, again.

With @smerle33 we diagnosed the following elements:

So we hacked a bit the crontab on the pkg VM:

=> it surfaced in the following error error: unknown command "renew", see 'snap help'. => trying a 28 16 * * * which certbot >/var/log/certbot-debug.log 2>&1 showed that /usr/bin/certbot is used.

We relaized that, on some machines, the /usr/bin/certbot file exists and is a symlink to /usr/bin/snap explaining the error. Most probably a leftover from my tentatives to use snap package for certbot :'(

The symlink was removed from the following machines yesterday, and we'll wait today to see if the certificates are now renewed:

dduportal commented 1 year ago

Checking the renewal today on pkg VM: no renewal.

After another crontab hacking, 34 10 * * * certbot plugins --text > /var/log/certbot-renew.log 2>&1, the following error was surfaced: /bin/sh: 1: certbot: not found

=> we should check that /usr/local/bin is part of the crontab's PATH => and/or we should stop rely on the Puppet module and manage the crontab item ourselve to benefit from:

dduportal commented 1 year ago

New crontab applied, let's wait for tomorrow to check for certificates renewal

dduportal commented 1 year ago

Confirmed that the certificates were renewed successfully and automatically earlier today:

➜  SERVER_NAME=updates.jenkins.io; PORT=443; echo -n Q | openssl s_client -servername {SERVER_NAME} -connect {SERVER_NAME}:{PORT} | openssl x509 -noout -dates
getaddrinfo: nodename nor servname provided, or not known
connect:errno=22
unable to load certificate
8351849984:error:09FFF06C:PEM routines:CRYPTO_internal:no start line:/AppleInternal/Library/BuildRoots/ff32e6fb-db00-11ed-a068-428477786501/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/pem/pem_lib.c:694:Expecting: TRUSTED CERTIFICATE

➜ SERVER_NAME=pkg.origin.jenkins.io; echo -n Q | openssl s_client -servername ${SERVER_NAME} -connect ${SERVER_NAME}:443 | openssl x509 -noout -dates
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = pkg.origin.jenkins.io
verify return:1
DONE
notBefore=Jun 22 05:05:18 2023 GMT
notAfter=Sep 20 05:05:17 2023 GMT

➜ SERVER_NAME=updates.jenkins-ci.org; echo -n Q | openssl s_client -servername ${SERVER_NAME} -connect ${SERVER_NAME}:443 | openssl x509 -noout -dates
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = updates.jenkins-ci.org
verify return:1
DONE
notBefore=Jun 22 05:05:40 2023 GMT
notAfter=Sep 20 05:05:39 2023 GMT

Please note that ci.jenkins.io certificates were also renewed (same reasons, same blockage, same fix):

➜ SERVER_NAME=ci.jenkins.io; echo -n Q | openssl s_client -servername ${SERVER_NAME} -connect ${SERVER_NAME}:443 | openssl x509 -noout -dates
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = ci.jenkins.io
verify return:1
DONE
notBefore=Jun 22 05:00:45 2023 GMT
notAfter=Sep 20 05:00:44 2023 GMT