Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPG key expires on March the 30th #3457

Closed
NotMyFault opened this issue Mar 17, 2023 · 28 comments
Closed

GPG key expires on March the 30th #3457

NotMyFault opened this issue Mar 17, 2023 · 28 comments

Comments

@NotMyFault
Copy link
Member

NotMyFault commented Mar 17, 2023

Service(s)

pkg.jenkins.io

Summary

➜  ~ curl -s https://pkg.jenkins.io/debian/jenkins.io.key | gpg2 --show-keys
pub   rsa4096 2020-03-30 [SC] [expires: 2023-03-30]
      62A9756BFD780C377CF24BA8FCEF32E745F2C3D5
uid                      Jenkins Project <jenkinsci-board@googlegroups.com>
sub   rsa4096 2020-03-30 [E] [expires: 2023-03-30]

I assume this is not covered by #3323, given the issue covers the code signing certificate only.
Don't hesitate to correct me if I'm wrong :P

Reproduction steps

No response

@dduportal
Copy link
Contributor

dduportal commented Mar 23, 2023

You are correct @NotMyFault : the GPG key expiration is NOT covered by #3323.

Backstory: the current GPG key (3 year valid, ending the 30 March 2023) was generated as part of #1881, to handover the Jenkins releases from Kohsuke's fromer GPG key. Reference here: https://groups.google.com/g/jenkins-infra/c/c7m_72vUTXE/m/37zw9GXhAQAJ.

We can either extend the expiration date or create a new key: both will have the same impact on users who will need to import the new/extended key:

⚠️ How much time for the new key? 3 years? 8 years ? something else ?

@NotMyFault
Copy link
Member Author

NotMyFault commented Mar 23, 2023

⚠️ How much time for the new key? 3 years? 8 years ? something else ?

Extending the existing key's life span by 3 years sounds solid to me. Not too long, but not too short either, to renew keys on the consumer's end too frequently.

The changelogs starting with 2.398 and 2.387.2 onwards have to declare that keys have changed and importing the new ones is mandatory.

@olblak
Copy link
Member

olblak commented Mar 25, 2023

I would also extend the gpg key for three years. If you plan to regenerate a new one then you'll need to communicate about it

@NotMyFault NotMyFault changed the title PGP keys for redhat and debian expire on March the 30th GPG keys for redhat and debian expire on March the 30th Mar 25, 2023
@NotMyFault NotMyFault changed the title GPG keys for redhat and debian expire on March the 30th GPG key expires on March the 30th Mar 25, 2023
@dduportal
Copy link
Contributor

I would also extend the gpg key for three years. If you plan to regenerate a new one then you'll need to communicate about it

Extending the gpg key also requires communication because end users need to reimport it to get extended date alas

@dduportal
Copy link
Contributor

A new GPG key was generated for the Jenkins project with the following attributes:

  • Name: Jenkins Project
  • Email: jenkinsci-board@googlegroups.com
  • Expiration date: 26 March 2026 (3 years)
  • Encoding: ed25519 (Default for GNUPG 2.4.x). ⚠️ We'll fall back to rsa4096 if the package fails to be generated (or maybe upgrade the package tooling...)

This new key has been inserted into the Azure Release Vault, with a secret name jenkins-release-pgp-2023 (Different than the previous secret one so we can shift to one or the other).

Next step:

  • Add the key to pkg.origin.jenkins.io (Puppet)
  • Add a PR to jenkins-infra/release to specify the new key for the Weekly line
  • Share the public key here
  • Prepare the list of communication media (cc @MarkEWaite)
  • Cleanup the old key once expired (next week)

@dduportal
Copy link
Contributor

Adding the new public key (with another name to avoid replacing the current one) to pkg.jenkins.io: jenkins-infra/jenkins-infra#2720

@dduportal
Copy link
Contributor

Adding the new key for the upcoming weekly: jenkins-infra/release#352

@dduportal
Copy link
Contributor

dduportal commented Mar 27, 2023

Communication channels:

@dduportal
Copy link
Contributor

Proposal for a new key comes from the need for clarity for end users. It can be confusing to "only" check the key ID and not a guranatee that the "extended" key is imported and used properly.

As the end users will have to import something one time, ensuring that we have a new key, with a new ID and a new time windows looked clearer: either you got the new key or not.
It was inspired by https://docs.datadoghq.com/agent/guide/linux-agent-2022-key-rotation/?tab=debianubuntu.

However it might be a mistake: please express yourself here with the rationale if you do not agree with this proposal (I do not want to decide alone :) )

@NotMyFault
Copy link
Member Author

+1 for the strategy proposed

@saper
Copy link

saper commented Mar 27, 2023

Will ed25519 work on the current platforms? Just tried to import some dummy ed25519 GPG key on Almalinux 8 (compatible with the current Red Hat Enteprise Linux 8):

$ sudo rpm -vvv --import /tmp/k.asc
ufdio:       1 reads,    17154 total bytes in 0.000010 secs
ufdio:       1 reads,     5442 total bytes in 0.000004 secs
ufdio:       1 reads,    17154 total bytes in 0.000009 secs
ufdio:       1 reads,      393 total bytes in 0.000003 secs
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
D: couldn't find any keys in /var/lib/rpm/pubkeys/*.key
D: loading keyring from rpmdb
D: opening  db environment /var/lib/rpm cdb:0x401
D: opening  db index       /var/lib/rpm/Packages 0x400 mode=0x0
D: locked   db index       /var/lib/rpm/Packages
D: opening  db index       /var/lib/rpm/Name 0x400 mode=0x0
D:  read h#     405 
Header SHA1 digest: OK
D: added key gpg-pubkey-3abb34f8-5ffd890e to keyring
D: added subkey 0 of main key gpg-pubkey-3abb34f8-5ffd890e to keyring
D:  read h#     459 
Header SHA1 digest: OK
D: added key gpg-pubkey-2f86d6a1-5cf7cefb to keyring
D:  read h#     923 
Header SHA1 digest: OK
D: added key gpg-pubkey-37576165-5b22521c to keyring
D: added subkey 0 of main key gpg-pubkey-37576165-5b22521c to keyring
D:  read h#     935 
Header SHA1 digest: OK
D: added key gpg-pubkey-442df0f8-608c8351 to keyring
D:  read h#    2031 
Header SHA1 digest: OK
D: added key gpg-pubkey-8b318951-6418c21b to keyring
D:  read h#    2032 
Header SHA1 digest: OK
D: added key gpg-pubkey-45f2c3d5-5e81efb9 to keyring
D: added subkey 0 of main key gpg-pubkey-45f2c3d5-5e81efb9 to keyring
D: Using legacy gpg-pubkey(s) from rpmdb
error: /tmp/k.asc: key 1 import failed.
D: closed   db index       /var/lib/rpm/Packages
D: closed   db index       /var/lib/rpm/Name
D: closed   db environment /var/lib/rpm

@MarkEWaite
Copy link

MarkEWaite commented Mar 27, 2023

Will ed25519 work on the current platforms? Just tried to import some dummy ed25519 GPG key on Almalinux 8 (compatible with the current Red Hat Enteprise Linux 8):

I think this is a valid concern. CentOS 7 fails to import the key and reports that "key 1 is not an armored public key:

-----BEGIN PGP PUBLIC KEY BLOCK-----

mDMEZCGZwhYJKwYBBAHaRw8BAQdAj+SvDzMg4Tm8uXlPCd9jwlXcSLz+pi9m0lNI
drxWZsi0MkplbmtpbnMgUHJvamVjdCA8amVua2luc2NpLWJvYXJkQGdvb2dsZWdy
b3Vwcy5jb20+iJkEExYKAEEWIQQ3MIGS553OPjgzoyGU/YhtqYdhrAUCZCGZwgIb
AwUJBaOagAULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgAAKCRCU/YhtqYdhrCEU
AP4zrgb6fJ6pRWFlWDVkzZmSA4q92zl888KU/mWsoBEEhgD/ZKcwYndT59Evl/GC
JuTummn9Zo4YysPII0f+bjotzQu4OARkIZnCEgorBgEEAZdVAQUBAQdAjMg9dCFK
7jurd6h1im+P3TRYqC1KJQ41Sgt6t9/g7QQDAQgHiH4EGBYKACYWIQQ3MIGS553O
PjgzoyGU/YhtqYdhrAUCZCGZwgIbDAUJBaOagAAKCRCU/YhtqYdhrDm7AP0UOgZa
N+CnMa2FPO+iwL3C+A65yVb6qxwrnmO9plRoMwEA8yGE7z+iJ1//KTzUHdIkEIfg
m/FHxngbpEuDQ9H1cgQ=
=++Bw
-----END PGP PUBLIC KEY BLOCK----

Same message is reported on Red Hat Enterprise Linux 8 and Rocky Linux 9.

@dduportal I think that we need an RSA key instead of the ED25519 key.

@dduportal
Copy link
Contributor

ack, thanks @MarkEWaite @saper , this is a valid concern!

Updated the key to rsa/4096:

@saper
Copy link

saper commented Mar 27, 2023

There seems to be some disagreement in the OpenPGP working group regarding packet format related to Ed25519 signatures (compare https://www.ietf.org/archive/id/draft-koch-openpgp-2015-rfc4880bis-01.txt vs https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-08.txt).

@MarkEWaite
Copy link

I placed the jenkins.io-2023.key files on pkg.jenkins.io manually with a little bit of shell script. Permissions on the files match the permissions on the jenkins.io.key files. I placed the jenkins.io-2023.key.info files in the same directories that already had jenkins.io.key.info files.

I realize that the automation will probably replace all those files. I think that would be great. I wanted the instructions in the blog post to be workable immediately, without waiting for the automation to run.

Discussion on the blog post will happen in the community.jenkins.io post.

@dduportal dduportal removed this from the infra-team-sync-2023-03-28 milestone Mar 28, 2023
@dduportal dduportal added this to the infra-team-sync-2023-04-04 milestone Mar 28, 2023
@dduportal
Copy link
Contributor

I placed the jenkins.io-2023.key files on pkg.jenkins.io manually with a little bit of shell script. Permissions on the files match the permissions on the jenkins.io.key files. I placed the jenkins.io-2023.key.info files in the same directories that already had jenkins.io.key.info files.

@MarkEWaite , the puppet agent on pkg.origin.jenkins.io VM keeps changing the file jenkins.io.key back to its old values (as specified in the puppet management).

Currently checking the weekly Debian and Redhat repositories contents

@MarkEWaite
Copy link

MarkEWaite commented Mar 29, 2023

I think it is OK that jenkins.io.key is set to the previous value, isn't it?

The first interesting lines of the Debian key that I download from https://pkg.jenkins.io/debian/jenkins.io.key looks like this:

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBF6B77kBEACZoUU41uYVDbagtNQrNQsnbx7UkRdu2rdUZLHryTOKv4InT33Z

The first interesting lines of the jenkins.io-2023.key file are different. They look like this:

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBGQhzisBEAC7yUhIqVCcyCXJWeZZf/BA6/+KguDQpycck0xUomj5ogT1+lwJ

@dduportal
Copy link
Contributor

@MarkEWaite puppet reports

(/Stage[main]/Profile::Pkgrepo/File[/var/www/pkg.jenkins.io/debian/jenkins.io.key]/content) content changed '{md5}294157f3149d77a4d6da166086faea4f' to '{md5}179ce6653d4a3bdfe318d71c6a83d8ea' (corrective)

on each run, while we got the following:

$ md5sum ./dist/profile/files/pkgrepo/*                  
179ce6653d4a3bdfe318d71c6a83d8ea  ./dist/profile/files/pkgrepo/jenkins-ci.org.key
294157f3149d77a4d6da166086faea4f  ./dist/profile/files/pkgrepo/jenkins.io-2023.key

It means that "something" keeps changing the content of the file jenkins-ci.org.key to the "new" GPG key content and I'm not what is doing that so I wondered if it was a crontab or a script you applied earlier this week?

If not, then I'll check the update center scripts

@dduportal
Copy link
Contributor

Ooooh caught the culprit:

It's https://github.com/jenkins-infra/mirror-scripts/blob/49abc7c6272d67450ee4c4c1eb57f9c5dab6fb2a/sync.sh#L67-L69 which runs regularly:

$ /var/www/pkg.jenkins.io.staging# md5sum debian/*.key
294157f3149d77a4d6da166086faea4f  debian/jenkins.io-2023.key
294157f3149d77a4d6da166086faea4f  debian/jenkins.io.key

Gotta fix it tomorrow.

@dduportal
Copy link
Contributor

  • Fixed the keys on pkg.origin's staging directory:
$ md5sum /var/www/pkg.jenkins.io.staging/*/*.key
294157f3149d77a4d6da166086faea4f  /var/www/pkg.jenkins.io.staging/debian/jenkins.io-2023.key
179ce6653d4a3bdfe318d71c6a83d8ea  /var/www/pkg.jenkins.io.staging/debian/jenkins.io.key
294157f3149d77a4d6da166086faea4f  /var/www/pkg.jenkins.io.staging/debian-stable/jenkins.io-2023.key
179ce6653d4a3bdfe318d71c6a83d8ea  /var/www/pkg.jenkins.io.staging/debian-stable/jenkins.io.key
294157f3149d77a4d6da166086faea4f  /var/www/pkg.jenkins.io.staging/redhat/jenkins.io-2023.key
179ce6653d4a3bdfe318d71c6a83d8ea  /var/www/pkg.jenkins.io.staging/redhat/jenkins.io.key
294157f3149d77a4d6da166086faea4f  /var/www/pkg.jenkins.io.staging/redhat-stable/jenkins.io-2023.key
179ce6653d4a3bdfe318d71c6a83d8ea  /var/www/pkg.jenkins.io.staging/redhat-stable/jenkins.io.key

@slide
Copy link

slide commented Mar 30, 2023

The debian-stable repo is not signed correctly, neither the old nor the new keys work

W: GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCEF32E745F2C3D5
E: The repository 'https://pkg.jenkins.io/debian-stable binary/ Release' is not signed.

@NotMyFault
Copy link
Member Author

There is no release of an LTS release (stable repository) yet, which is signed with the new key.

The first one is 2.387.2, released on the 5th of April.

@slide
Copy link

slide commented Mar 30, 2023

So, the stable repo is just going to not work until next Wednesday?

@NotMyFault
Copy link
Member Author

I'd just skip the GPG check for now.

@ghost
Copy link

ghost commented Mar 30, 2023

I am a little bit concerned about that answer since this will cause configuration management systems, that in our case has a formula for installing jenkins, to fail for a week. Similar we have tests for installs of Jenkins slave images that are now failing. Sure we can ignore the failing CM and tests, but we don't as we think that is bad practice.

@MarkEWaite
Copy link

I am a little bit concerned about that answer since this will cause configuration management systems, that in our case has a formula for installing jenkins, to fail for a week.

Yes, it is unfortunate that we didn't prepare far enough in advance so that there would not be a one week window where debian-stable did not have a package available with a valid PGP signature. The last time we made this transition, we planned more thoroughly and the outage was 24 hours or less. We'll host a retrospective to identify the mistakes we made and plan ways to prevent those mistakes for future key expiration.

Similar we have tests for installs of Jenkins slave images that are now failing. Sure we can ignore the failing CM and tests, but we don't as we think that is bad practice.

I'm curious how this would cause Jenkins agent images to fail. Can you explain further how you're configuring Jenkins agents in a way that was disrupted by the expiration of the GPG key that signs the Debian package of the Jenkins controller?

@dduportal
Copy link
Contributor

  • The LTS release 2.387.2 is out, signed with the new GPG key ✅ Tested on a fresh Debian (latest) container:
Click to see the output
$ docker run --rm -ti debian
Unable to find image 'debian:latest' locally
latest: Pulling from library/debian
3e440a704568: Pull complete 
Digest: sha256:7b991788987ad860810df60927e1adbaf8e156520177bd4db82409f81dd3b721
Status: Downloaded newer image for debian:latest

root@394d03e6a42b:/# apt-get install sudo curl gpg -y 
# ...

root@394d03e6a42b:/#   curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
    /usr/share/keyrings/jenkins-keyring.asc > /dev/null

root@394d03e6a42b:/# echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
    https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
    /etc/apt/sources.list.d/jenkins.list > /dev/null
# ...
# Installed 

=> this issue is closable from infra point of view.

dduportal added a commit to jenkins-infra/acceptance-tests that referenced this issue Apr 5, 2023
dduportal added a commit to jenkins-infra/acceptance-tests that referenced this issue Apr 5, 2023
@dduportal
Copy link
Contributor

=> closing the issue. Feel free to reopen with a comment if you see any issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants