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

Verify delegated & CA signed OCSP correctly #736

Merged
merged 1 commit into from
Mar 16, 2017
Merged

Verify delegated & CA signed OCSP correctly #736

merged 1 commit into from
Mar 16, 2017

Conversation

vanbroup
Copy link
Contributor

Only check the OCSP response signature from the issuer when no delegated signing certificate is included in the response. When a delegated OCSP signing certificate is present verify this is issued by the same CA.

@lziest
Copy link
Contributor

lziest commented Mar 13, 2017

lgtm, but please rebase on top of the master.

@vanbroup
Copy link
Contributor Author

@lziest, done

@kisom
Copy link
Contributor

kisom commented Mar 14, 2017

@vanbroup I've fixed our tests on master; can you rebase?

@lziest lziest self-requested a review March 14, 2017 21:41
Copy link
Contributor

@lziest lziest left a comment

Choose a reason for hiding this comment

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

If resp.Certificarte is not nil, should it be used to verify the OCSP response as well?

@vanbroup
Copy link
Contributor Author

When resp.Certificarte is present it should contain a delegated signing certificate (not the issuer, you should already have that). When it doesn't contain a delegated signing certificate the response should not be delegated and be signed by the issuer directly.

I started thinking why ParseResponseForCert in "golang.org/x/crypto/ocsp" would not already verify the signature. After verification I concluded that it does already verify the signature. I think it makes more sense to remove the OCSP signature verification from CFSSL as it has no value to do it twice.

https://github.com/golang/crypto/blob/master/ocsp/ocsp.go#L524

Both ParseResponse and ParseResponseForCert in "golang.org/x/crypto/ocsp" do already verify the response and embedded certificates when present. Previous OCSP signature validation in this package was done incorrectly and would only be performed when ParseResponse would have verified the signature with no errors. By using ParseResponseForCert instead of ParseResponse also OCSP responses containing multiple awnsers can be handled successfully.
@codecov-io
Copy link

codecov-io commented Mar 16, 2017

Codecov Report

Merging #736 into master will decrease coverage by 0.05%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #736      +/-   ##
==========================================
- Coverage   57.77%   57.71%   -0.06%     
==========================================
  Files          76       77       +1     
  Lines        6643     6769     +126     
==========================================
+ Hits         3838     3907      +69     
- Misses       2391     2463      +72     
+ Partials      414      399      -15
Impacted Files Coverage Δ
revoke/revoke.go 68.42% <100%> (+0.88%)
config/config.go 62.54% <0%> (-10.71%)
multiroot/config/config.go 76.72% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f27ab50...64bb2e7. Read the comment docs.

@lziest
Copy link
Contributor

lziest commented Mar 16, 2017

Much appreciated.

@lziest lziest merged commit 418d970 into cloudflare:master Mar 16, 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.

4 participants