Skip to content

RPC Fix and Issue #202: OCSP Update Tool - #247

Merged
jcjones merged 11 commits into
masterfrom
202-periodic-ocsp
May 29, 2015
Merged

jcjones merged 11 commits into
masterfrom
202-periodic-ocsp

Conversation

@jcjones

@jcjones jcjones commented May 28, 2015

Copy link
Copy Markdown
Contributor

This PR primarily resolves an error in the use of our RPC layer, that duplication of reply-to addresses caused indeterminate behavior when using AMQP due to a race condition as to which client would consume the message first. The intention was for the client topics to uniquely identify a particular instance.

Due to this being discovered while writing the OCSP Update Tool (which requires AMQP RPC), the RPC work bled into the OCSP Update Tool's PR. I apologize in advance for the murkiness, but hopefully it's clear what was going on.

Note that there are still outstanding issues with the OCSP Responder in this commit; it requires some additional work before OCSP is complete.

Notes:

  • Moved dbMap construction and type converter into individual files in the sa package.
  • Add DB configuration for the OCSP tool to the boulder config:
    • left to the user if they want to use different boulder-config.json files for different purposes.
  • Added updater to Makefile
  • Fix trailing ',' in the Boulder config
  • Add more panic logging
  • Ignore .pem files produced by the integration test
  • Change RPC to use per-instance named reply-to queues
  • Added an optional Config method to shell.go to modify the cmd.Config object based on custom CLI flags; see cmd/ocsp-updater/main.go for an example.
  • Finish OCSP Updater logic
    • Uses a transfer object due to issues JSON marhsalling x509.Certificate
  • NewPendingAuthorization now uses a core.Authorization object, so
    that foreign key constraints are followed
  • core.Authorization now serializes RegistrationID to JSON, so it has to get
    blanked out in WFE before transmission to client.
  • Remove ParsedCertificate from core.Certificate, as type x509.Certificate cannot
    be marshaled.
  • Added AssertDeepEquals and AssertMarhsaledEquals to test-tools.go
  • Caught several overloaded and misleadingly named errors in WFE
  • Fix: Challenge URIs were incomplete when running in RPC mode.

jsha and others added 2 commits May 27, 2015 22:01
- First steps towards ocsp updater.
- Move the type converter into its own file in "sa" rather than core, to keep
  Gorp from leaking out of the SA package.
- Move dbMap construction and type converter into individual files in the sa package.
- Add DB configuration for the OCSP tool to the boulder config:
  - left to the user if they want to use different boulder-config.json files
    for different purposes.
- Added updater to Makefile
- Fix trailing ',' in the Boulder config, add more panic logging
- Ignore .pem files produced by the integration test
- Change RPC to use per-instance named reply-to queues.
- Finish OCSP Updater logic
- Rework RPC for OCSP to use a transfer object (due to serialization problems of x509.Certificate)
@jcjones jcjones added the bug label May 28, 2015
@jcjones jcjones added this to the Deployment milestone May 28, 2015
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.51%) to 44.06% when pulling af0f844 on 202-periodic-ocsp into 9b951c5 on master.

- Fix a bunch of typos in rpc-wrappers.go
- Unblank `id` in core.Registration JSON:
  - It's not spec, but it's not hurting anything, and we reveal it to clients anyway.
  - We need knowledge of the ID in RPC, so if we don't want to include this in the object, we need to make a transfer object to wrap it.
- Make the RPC logs much clearer as to who's talking to who
- Typo in WFE where we called a registration an authz
@jcjones
jcjones force-pushed the 202-periodic-ocsp branch from 4841920 to e4e52e7 Compare May 28, 2015 06:37
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.51%) to 44.06% when pulling e4e52e7 on 202-periodic-ocsp into 9b951c5 on master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.51%) to 44.06% when pulling e4e52e7 on 202-periodic-ocsp into 9b951c5 on master.

- Implement MethodUpdateRegistration
- Add error logging to a lot of places it was missing
- Consolidate RevokeCertificate; we're doing it elsewhere anyway
- Fix erronous returns on RPC failures in several places
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.07%) to 43.5% when pulling 58d7f46 on 202-periodic-ocsp into 9b951c5 on master.

@jcjones

jcjones commented May 28, 2015

Copy link
Copy Markdown
Contributor Author

Retriggered; Travis' error was that "colors.js" wasn't available to the integration test. Probably a platform issue?

J.C. Jones added 4 commits May 28, 2015 08:19
- NewPendingAuthorization now uses a core.Authorization object, so
  that foreign key constraints are followed
- core.Authorization now serializes RegistrationID to JSON, so it has to get
  blanked out in WFE before transmission to client.
- Remove ParsedCertificate from core.Certificate, as type x509.Certificate cannot
  be marshaled.
- Added AssertDeepEquals and AssertMarhsaledEquals to test-tools.go
- Caught several overloaded and misleadingly named errors in WFE
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.62%) to 42.95% when pulling d1321f2 on 202-periodic-ocsp into 9b951c5 on master.

@jsha

jsha commented May 28, 2015

Copy link
Copy Markdown
Contributor

That "colors.js not available" issue is because I forgot to copy the npm install command from the bash version of the integration test into the Python version. I can add it.

Comment thread cmd/ocsp-updater/main.go Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should be 2015

J.C. Jones and others added 2 commits May 28, 2015 15:02
Issue #239 - Add a build ID method to WFE, and print Info on startup …
Comment thread cmd/ocsp-updater/main.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should really be in NewDbMap, I think, along with all of the other AddTables. Otherwise it's likely that these will drift out of sync in subtle ways.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved the initTables method into database.go and made it always run on a DbMap. This may require some further work when we use a disjoint schema, like that for certificate-authority-data.go.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.58%) to 43.0% when pulling 6a60b4e on 202-periodic-ocsp into 9b951c5 on master.

Comment thread cmd/ocsp-updater/main.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment no longer makes sense in this context.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.58%) to 43.0% when pulling 6a60b4e on 202-periodic-ocsp into 9b951c5 on master.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this line can now be deleted.

@jsha

jsha commented May 29, 2015

Copy link
Copy Markdown
Contributor

Done reviewing. Generally looks great! Nice work.

Comment thread cmd/ocsp-updater/main.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You're going to make way more OCSP responses than you need to with this query. You should only be generating OCSP information for certificates that are not expired. I think we need to add a "notAfter" column to the certificateStatus table, so that we can select on that here. I'm not sure how to add a commit to this PR, but here's a micro-patch in an ad-hoc format:

core/objects.go: type CertificateStatus struct {
+   // notAfter: The notAfter time of the certificate.  This is simply copied
+   // from the certificate itself, but simplifies queries needed to make CSRs
+   // and OCSP responses
+   NotAfter time.Time `db:"notAfter"`

sa/storage-authority.go: AddCertificate(
        Serial:             serial,
+       NotAfter:           parsedCertificate.NotAfter,
        RevokedDate:        time.Time{},

If you make that change, then it seems like you should be able to just add a clause to that SELECT statement of the form:

cs.notAfter > ?

... where the ? is populated with something like time.Now().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let's do this in another patch. I actually want to put that into the Certificates table, as it belongs to the cert, and just join it in.

I actually was thinking that, which is why I went ahead to write the query with an AS cs to prep the join, but I think I fell asleep somewhere around then.

I opened Issue #254 to track this.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.56%) to 43.01% when pulling e14f59c on 202-periodic-ocsp into 9b951c5 on master.

jcjones added a commit that referenced this pull request May 29, 2015
@jcjones
jcjones merged commit 9167fb0 into master May 29, 2015
@jcjones
jcjones deleted the 202-periodic-ocsp branch May 29, 2015 06:10
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.

4 participants