Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Istio CA should return a cert chain instead of a single cert #59

Merged
merged 2 commits into from
Mar 18, 2017

Conversation

lookuptable
Copy link
Member

Fix #56


return NewIstioCA(cert, key)
opts := &IstioCAOptions{
CertChainBytes: pemCert,
Copy link

Choose a reason for hiding this comment

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

In self-signed root certificate case, you don't need to include the root cert here.

Basically the only certificates needed to be included are the one before root certificate, since the root certificate is already distributed to the other end.

https://tools.ietf.org/html/rfc5246#section-7.4.2

It is just an optimization, it is ok to include, but not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. We are on longer sending root cert in the cert chain in self-signed case.

In non-self-signed case we have no control over what's in the chain file. So we'll blindly send over what's in the file.

// Pass in unmatched chain and cert to make sure the `verify` method yeilds an error.
func TestInvalidIstioCAOptions(t *testing.T) {
rootCert := `
-----BEGIN CERTIFICATE-----
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any timestamp in the cert? If so, would it still work when the cert expires?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the timestamps to make the certs long-lived so expiration shouldn't be an issue.

* Fix tests
* Make testing certs long-lived
@wattli
Copy link
Contributor

wattli commented Mar 18, 2017

lgtm

@codecov
Copy link

codecov bot commented Mar 18, 2017

Codecov Report

Merging #59 into master will increase coverage by 2.28%.
The diff coverage is 91.22%.

@@            Coverage Diff             @@
##           master      #59      +/-   ##
==========================================
+ Coverage   68.45%   70.73%   +2.28%     
==========================================
  Files           6        6              
  Lines         317      352      +35     
==========================================
+ Hits          217      249      +32     
- Misses         81       84       +3     
  Partials       19       19
Impacted Files Coverage Δ
certmanager/generate_cert.go 76% <0%> (-2.09%)
certmanager/ca.go 100% <100%> (ø)
controller/secret.go 78.46% <100%> (+0.33%)
certmanager/util.go 50% <80%> (+2.17%)

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 a904257...42ab687. Read the comment docs.

@lookuptable lookuptable merged commit ed482bf into istio:master Mar 18, 2017
@lookuptable lookuptable deleted the cert-chain branch March 18, 2017 00:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants