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

apt::keyring doesn't validate key id #1175

Open
oOHenry opened this issue Apr 16, 2024 · 4 comments
Open

apt::keyring doesn't validate key id #1175

oOHenry opened this issue Apr 16, 2024 · 4 comments

Comments

@oOHenry
Copy link

oOHenry commented Apr 16, 2024

with the new method apt::keyring we can just pass an url which gets downloaded and stored to file directly without any checks.
In the old world of apt-key we could pass an id of a pub key and only if that id matches the key gets imported: https://github.com/puppetlabs/puppetlabs-apt/blob/main/lib/puppet/provider/apt_key/apt_key.rb#L182

In terms of security, it would be nice to:

  • check the id with the gpg command before importing it
  • support imports via the gpg command directly from keyserver again
@kenyon
Copy link

kenyon commented Apr 16, 2024

How would you acquire the key ID to check against? Typically that is from the same source as the key itself, so I'm not sure this would enhance security very much. Such a check should be optional, at least.

About supporting imports from keyservers, since apt-key will last be available in Debian 12 and Ubuntu 24.04, I suppose we need to rewrite the apt_key provider in this module to manage keys as files, rather than using the apt-key command.

@oOHenry
Copy link
Author

oOHenry commented Apr 22, 2024

The optional check would be completely fine, just give the user the choice to choose if the want to check.

we need to rewrite the apt_key provider in this module to manage keys as files, rather than using the apt-key command.

👍 makes sense, I guess its pretty hard to check the IDs with pure puppet.

How would you acquire the key ID to check against?

often the IDs are mentioned in the docs of the repo, for example elk: https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-key

@kenyon
Copy link

kenyon commented Apr 29, 2024

How would you acquire the key ID to check against?

often the IDs are mentioned in the docs of the repo, for example elk: https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-key

Right, I'm just wondering if the extra verification would be serving a useful purpose. Since those docs and the key are from the same place, do you really gain security by providing the key ID to puppet and having puppet use GPG to check the ID? If someone can compromise the key, wouldn't they also be able to update key ID in the docs?

@oOHenry
Copy link
Author

oOHenry commented May 15, 2024

do you really gain security by providing the key ID to puppet and having puppet use GPG to check the ID?

if someone gained access to the reposerver/keyserver after I added the key and id to our puppet the key doesn't get updated with the infected key automatically. In my opinion a second factor is better than just blindly update the key automatically by puppet.

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

3 participants