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

(PUP-3534) Deprecate caching certificate authority verify methods #5484

Conversation

MosesMendoza
Copy link
Contributor

This PR deprecates methods in Puppet::SSL::CertificateAuthority that were used by the PE License library (but no longer are). #x509_store (and its callers) in particular is problematic because it can cache the x509_store object once and never refresh it, even if it is no longer valid.

Commit outline:

This commit deprecates Puppet::SSL::CertificateAuthority#list_certificates, as
it is no longer used by anything. The PE License check code that originally
used this been migrated to querying PuppetDB.

To avoid superflous warnings emanating from use of
Puppet::SSL::CertificateAuthority#list, that method is updated to directly do
an indirector search instead of indirectly through #list_certificates. This is
what it originally did, before #list_certificates was added, and is
backwards-compatible.

Puppet::SSL::CertificateAuthority#x509_store is a caching layer for the x509
object that was used by the PE License code. This commit tags it as deprecated,
as the PE License code no longer uses it, and it was questionably advisable
back then to return a potentially stale x509 store anyway.

We also update #verify to call #create_x509_store instead of #x509_store,
skipping the cache layer and always creating a new object - the behavior before
x509_store was introduced. This is semantically API backwards-compatible, and
now we can remove #x509_store at a major version, as its only callers are also
deprecated.

Note #x509_store is API private, so we don't actually do a
Puppet.deprecation_warning. The comment tag should be enough to warn off anyone
trying to use it before it's removed.

Puppet::SSL::CertificateAuthority#certificate_is_alive? was introduced to
leverage the #x509_store cached x509 object for the PE License code. It is no
longer used, and #verify (or the Puppet Server API) should be used instead.

@MosesMendoza
Copy link
Contributor Author

ping @joshcooper for review as you raised this ticket originally

@puppetcla
Copy link

CLA signed by all contributors.

@Iristyle
Copy link
Contributor

Everything here looks good to me. It would be good to note what version of PE (and corresponding PUP version) transitioned away from these code paths for historical reference.

Moses Mendoza added 3 commits January 13, 2017 09:37
This commit deprecates Puppet::SSL::CertificateAuthority#list_certificates, as
it is no longer used by anything. The PE License check code that originally
used this been migrated to querying PuppetDB, and was removed from PE puppet in
the PE 3.1 series.

To avoid superflous warnings emanating from use of
Puppet::SSL::CertificateAuthority#list, that method is updated to directly do
an indirector search instead of indirectly through #list_certificates. This is
what it originally did, before #list_certificates was added, and is
backwards-compatible.
…cate

Puppet::SSL::CertificateAuthority#x509_store is a caching layer for the x509
object that was used by the PE License code. This commit tags it as deprecated,
as the PE License code that used it was removed in the PE 3.1 series, and it
was questionably advisable back then to return a potentially stale x509 store
anyway.

We also update #verify to call #create_x509_store instead of #x509_store,
skipping the cache layer and always creating a new object - the behavior before
x509_store was introduced. This is semantically API backwards-compatible, and
now we can remove #x509_store at a major version, as its only callers are also
deprecated.

Note #x509_store is API private, so we don't actually do a
Puppet.deprecation_warning. The comment tag should be enough to warn off anyone
trying to use it before it's removed.
…_alive?

Puppet::SSL::CertificateAuthority#certificate_is_alive? was introduced to
leverage the #x509_store cached x509 object for the PE License code. It is no
longer used as the code that used it was removed in the PE 3.1 series, and
@MosesMendoza MosesMendoza force-pushed the PUP-3534/master/deprecate_caching_certificate_authority_methods branch from fa5a652 to 113a90d Compare January 13, 2017 17:37
@MosesMendoza
Copy link
Contributor Author

@Iristyle good call - updated commit messages to note that the license code using these methods was removed in the PE 3.1 series.

@MosesMendoza MosesMendoza merged commit 8967972 into puppetlabs:master Jan 17, 2017
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.

None yet

4 participants