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

Trust new APT and RPM keys #30

Merged
merged 2 commits into from
Dec 13, 2016
Merged

Conversation

olivielpeau
Copy link
Member

Make the pkg managers trust the new keys in addition to the current keys. Similar approach as what's described in DataDog/chef-datadog#365.

APT

  • Straightforward with the apt_key module
  • Allow customizing the URL with datadog_apt_key_url_new (for users
    with local apt mirrors)

RPM

  • Download the new key through plain HTTP for best compatibility (since
    SSL only works when the managed nodes have a recent version of python)
  • Ensure the integrity of the downloaded file using a sha-256 sum. We use
    the sha256sum option instead of checksum since checksum was only
    added in Ansible 2.0
  • The rpm_key module has a good idempotent behavior so no need to have
    extra steps to check whether the key is already imported.

Testing

Tested manually w/ Ansible 1.9.2 and 2.1.1, against Ubuntu 14.04 and CentOS 6

Allow customizing the URL with `datadog_apt_key_url_new` (for users
with local apt mirrors).
Copy link
Member

@degemer degemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (but I'm far from being an ansible expert).

- name: Download new RPM key
get_url:
url: "http://yum.datadoghq.com/DATADOG_RPM_KEY.public.E09422B3"
dest: /tmp/DATADOG_RPM_KEY.e09422b3.public
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean this file will always be there, even when the rpm key is already imported ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We could avoid this by first checking if the key is already imported and only download/import the new key if it's not. I didn't do it because I didn't think it was worth the added complexity, but let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's probably not worth it given the size of the key.

@olivielpeau olivielpeau added this to the 1.2.0 milestone Sep 28, 2016
Download the new key through plain HTTP for best compatibility (since
SSL only works when the managed nodes have a recent version of python).
Ensure the integrity of the downloaded file using a sha-256 sum. We use
the `sha256sum` option instead of `checksum` since `checksum` was only
added in Ansible 2.0

The `rpm_key` module has a good idempotent behavior so no need to have
extra steps to check whether the key is already imported.
@olivielpeau
Copy link
Member Author

Just updated the URL of the new key to DATADOG_RPM_KEY_E09422B3.public (which will be the actual permanent URL of the key)

@degemer: could you do a quick sanity check of my change? 🙇

Copy link
Member

@degemer degemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awful that Github is not able to show a proper diff. Still LGTM.

@jeffwidman
Copy link
Contributor

Is there a reason this wasn't merged?

@olivielpeau olivielpeau merged commit de8cef4 into master Dec 13, 2016
@olivielpeau olivielpeau deleted the olivielpeau/trust-new-keys branch December 13, 2016 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants