Giter Club home page Giter Club logo

Comments (4)

jaymzh avatar jaymzh commented on May 5, 2024

current workaround, in my site_settings:

# https://github.com/facebook/chef-cookbooks/issues/63
node.default['fb_apt']['keyring'] = '/etc/apt/trusted.gpg.d/fb_keyring.gpg'
node.default['fb_apt']['keys'] = {}

from chef-cookbooks.

jaymzh avatar jaymzh commented on May 5, 2024

That didn't work... even with a fix I had to make, I had to make keyring be nil to avoid it touching keys at all.

from chef-cookbooks.

jaymzh avatar jaymzh commented on May 5, 2024

OK so it gets a bit worse:

  • fb_apt isn't passing --keyring #{keyring} into apt-key add... but even if you do, it's totally ignored
  • As such, specifying a key will always give you an asymmetric bug - so the only sane way to do things is to never specify a keyring. This means we will see all loaded keys, and never try to load a key that's loaded. But it ALSO means all keys we want to mess with are loaded into /etc/apt/trusted.gpg, which is probably fine.
  • Debian has stopped putting any official keys in the main keyring - they are all in files in /etc/apt/trusted.gpg.d/, the keys I have on the main keyring are all from other repos I have - dropbox, bjn, etc.

So, I can see two paths forward:

Option 1

  • Drop the node['fb_apt']['keyring'] option
  • Pre-poluate the keys hash (at attribute time) with all keys from "official" files (/etc/apt/trusted.gpg.d/debian-archive-* and /etc/apt/trusted.gpg.d/ubuntu-keyring.*) so that we don't try to delete them (it won't work anyway, it'll try to delete them from the main keyring and fail).
  • Then security-concious people could instead overwrite that as well as make their own rule to nuke /etc/apt/trusted.gpg.d/*, and put whatever keys they wanted trusted in node['fb_apt']['keys'], but for everyone else, everything would "just work" - new keys would get added properly, keys dropped would be removed properly, and "official" keys would stay out of the way.
  • By default cleanup keyrings in /etc/trusted.gpg.d that are not owned by any rpm/deb. If we do this, keyids on files that aren't part of the OS but are part of a package ALSO need to be pre-populated.

Option 2

  • Drop the node['fb_apt']['keyring'] option
  • Not pre-populate keys, but instead have an option like preserve_pkg_owned_keyrings. It defaults to true
    • If it's true then in the provider, we build a hash like of file to keyids from the output of apt-key finger. Any file owned by a package, we preserve, any others we don't. We take the list of preserved keyids, along with any the user specified, and remove any keys still left over.
    • If it's false, we delete every single file in /etc/trusted.gpg.d/, and then hope the user has all necessary keyids in the keys hash. We can pre-populate some, but we're not going to always be on top of everytime debian or ubuntu adds a key (we're already missing ubuntu keys), so there should be big warnings to the user

Option 3

Stop trying to holistically manage keys altogether. Have a list of "keys" and "blacklisted_keys". We add keys if they're not there, and we remove blacklisted keys if they are there and on the main keyring (or if they're the only key on some other keyring).

My preference is option 1...

from chef-cookbooks.

davide125 avatar davide125 commented on May 5, 2024

Fixed in #66

from chef-cookbooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.