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

autograph is writing different chains to the same s3 location #930

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions signer/contentsignaturepki/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (s *ContentSigner) makeAndUploadChain() (err error) {
// returns the entire chain of certificate, its name (based on the ee cn &
// expiration) and an error.
func (s *ContentSigner) makeChain() (chain string, name string, err error) {
cn := s.domainForLeafCert()
cn := s.commonNameForLeafCert()

// cert is backdated to allow for clock skew tolerance
notBefore := time.Now().UTC().Add(-s.clockSkewTolerance)
Expand Down Expand Up @@ -143,14 +143,18 @@ func (s *ContentSigner) makeChain() (chain string, name string, err error) {

// return a chain with the EE cert first then the issuers
chain = certPem.String() + s.IssuerCert + s.caCert
name = fmt.Sprintf("%s-%s.chain", cert.Subject.CommonName, cert.NotAfter.Format("2006-01-02-15-04-05"))
name = fmt.Sprintf("%s-%s.chain", s.domainForS3Name(), cert.NotAfter.Format("2006-01-02-15-04-05"))
return
}

func (s *ContentSigner) domainForLeafCert() string {
func (s *ContentSigner) commonNameForLeafCert() string {
subdomain := s.ID
if s.subdomainOverride != "" {
subdomain = s.subdomainOverride
}
return subdomain + CSNameSpace
}

func (s *ContentSigner) domainForS3Name() string {
return s.ID + CSNameSpace
}
Loading