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

Various cspki improvements #293

Merged
merged 11 commits into from May 30, 2019
Merged

Various cspki improvements #293

merged 11 commits into from May 30, 2019

Conversation

jvehent
Copy link
Contributor

@jvehent jvehent commented May 24, 2019

WIP

@jvehent jvehent requested a review from g-k May 24, 2019 15:18
@g-k
Copy link
Contributor

g-k commented May 24, 2019

@jvehent is this ready for review?

@jvehent
Copy link
Contributor Author

jvehent commented May 24, 2019

yeah let's land this and I'll make other PRs for the following patches. the rewrite of crypto11 means it'll take me a while to get the rest out the door...

@g-k
Copy link
Contributor

g-k commented May 24, 2019

OK I wasn't sure if it was still WIP

g-k
g-k previously approved these changes May 24, 2019
Copy link
Contributor

@g-k g-k left a comment

Choose a reason for hiding this comment

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

r+

}
}
err = s.findAndSetEE(conf, tx)
if err != nil {
if err == nil {
log.Printf("contentsignaturepki %q: reusing existing EE %q", s.ID, s.eeLabel)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

if err == nil {
log.Printf("contentsignaturepki %q: reusing existing EE %q", s.ID, s.eeLabel)
} else {
// No suitable end-entity found, making a new chain
if err == database.ErrNoSuitableEEFound {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could flatten these down to one else if ladder or switch case though I'm not sure if that's idiomatic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

funny enough, I did this a few minutes ago because I thought it looked ugly

Copy link
Contributor

Choose a reason for hiding this comment

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

💯 mind reader

@g-k
Copy link
Contributor

g-k commented May 24, 2019

I think we should stick to crypto11 <1.0 and upgrade later since that'll be a major change.

@coveralls
Copy link

coveralls commented May 24, 2019

Pull Request Test Coverage Report for Build 2853

  • 41 of 72 (56.94%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 70.999%

Changes Missing Coverage Covered Lines Changed/Added Lines %
signer/contentsignaturepki/x509.go 3 5 60.0%
signer/contentsignaturepki/contentsignature.go 36 65 55.38%
Totals Coverage Status
Change from base Build 2846: -0.04%
Covered Lines: 3114
Relevant Lines: 4386

💛 - Coveralls

g-k
g-k previously approved these changes May 24, 2019
Copy link
Contributor

@g-k g-k left a comment

Choose a reason for hiding this comment

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

r+ w/ nit and question

}
s.issuerPriv, s.issuerPub, s.rand, _, err = conf.GetKeysAndRand()
// we need to parse or retrieve from the hsm the issuer private key,
Copy link
Contributor

Choose a reason for hiding this comment

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

A handle for the issuer private key, right? We shouldn't require it to be exportable to the autograph CU.

@@ -76,7 +74,7 @@ func (s *ContentSigner) makeChain() (chain string, name string, err error) {
// valid for longer than that to account for clock skew
notAfter := time.Now().UTC().Add(s.validity + s.clockSkewTolerance)

block, _ := pem.Decode([]byte(s.PublicKey))
block, _ := pem.Decode([]byte(s.IssuerCert))
if block == nil {
err = errors.New("no pem block found in signer public key configuration")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: does this log msg need to be updated?

@g-k
Copy link
Contributor

g-k commented May 24, 2019

Also, is this PR returning the EE pub key in the sig req response now?

@jvehent
Copy link
Contributor Author

jvehent commented May 24, 2019

Alright, I ended up adding 9e335e4 to this PR after all. It's what we discussed yesterday wrt to multiple instances initializing in parallel without blocking, which will be required if we want to initialize signers on-demand rather that at init time.

@jvehent
Copy link
Contributor Author

jvehent commented May 30, 2019

@g-k r?

g-k
g-k previously approved these changes May 30, 2019
Copy link
Contributor

@g-k g-k left a comment

Choose a reason for hiding this comment

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

r+ w/ nits

if err != nil {
return errors.Wrapf(err, "contentsignaturepki %q: failed to generate end entity", s.ID)
}
// make the certificate and upload the chain
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we should log the handle, ID, and label of any keys were generate

err = s.makeAndUploadChain()
if err != nil {
return errors.Wrapf(err, "contentsignaturepki %q: failed to make chain and x5u", s.ID)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: logging the chain and upload location on success would be useful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@g-k g-k merged commit 849960e into master May 30, 2019
@g-k g-k deleted the cspki201905 branch May 30, 2019 18:22
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

3 participants