-
-
Notifications
You must be signed in to change notification settings - Fork 615
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
Add Identifiers to Authorization & Order structs #7961
base: main
Are you sure you want to change the base?
Changes from all commits
e8ebb38
a133fb2
9e34394
92b5df2
807f44a
8bddab2
9307f39
66bddc4
f56c456
98538f4
ed7e503
3b659a6
95e473d
a792197
008498a
5c1845b
1bcd9fc
013206b
4f4905c
b5840da
9e70389
e2a3082
4f9700a
9e3c10f
8bbe0f3
d0b7523
b368e44
f8844d3
16a2c10
d4c07a5
79bb748
b65c35a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ import ( | |
"github.com/letsencrypt/boulder/features" | ||
"github.com/letsencrypt/boulder/goodkey" | ||
"github.com/letsencrypt/boulder/goodkey/sagoodkey" | ||
"github.com/letsencrypt/boulder/identifier" | ||
_ "github.com/letsencrypt/boulder/linter" | ||
blog "github.com/letsencrypt/boulder/log" | ||
"github.com/letsencrypt/boulder/policy" | ||
|
@@ -298,8 +299,8 @@ var expectedExtensionContent = map[string][]byte{ | |
// likely valid at the time the certificate was issued. Authorizations with | ||
// status = "deactivated" are counted for this, so long as their validatedAt | ||
// is before the issuance and expiration is after. | ||
func (c *certChecker) checkValidations(ctx context.Context, cert core.Certificate, dnsNames []string) error { | ||
authzs, err := sa.SelectAuthzsMatchingIssuance(ctx, c.dbMap, cert.RegistrationID, cert.Issued, dnsNames) | ||
func (c *certChecker) checkValidations(ctx context.Context, cert core.Certificate, idents []identifier.ACMEIdentifier) error { | ||
authzs, err := sa.SelectAuthzsMatchingIssuance(ctx, c.dbMap, cert.RegistrationID, cert.Issued, idents) | ||
if err != nil { | ||
return fmt.Errorf("error checking authzs for certificate %s: %w", cert.Serial, err) | ||
} | ||
|
@@ -310,16 +311,16 @@ func (c *certChecker) checkValidations(ctx context.Context, cert core.Certificat | |
|
||
// We may get multiple authorizations for the same name, but that's okay. | ||
// Any authorization for a given name is sufficient. | ||
nameToAuthz := make(map[string]*corepb.Authorization) | ||
identToAuthz := make(map[string]*corepb.Authorization) | ||
for _, m := range authzs { | ||
nameToAuthz[m.DnsName] = m | ||
identToAuthz[m.Identifier.Value] = m | ||
} | ||
|
||
var errors []error | ||
for _, name := range dnsNames { | ||
_, ok := nameToAuthz[name] | ||
for _, ident := range idents { | ||
_, ok := identToAuthz[ident.Value] | ||
if !ok { | ||
errors = append(errors, fmt.Errorf("missing authz for %q", name)) | ||
errors = append(errors, fmt.Errorf("missing authz for %q", ident)) | ||
continue | ||
} | ||
} | ||
|
@@ -406,7 +407,7 @@ func (c *certChecker) checkCert(ctx context.Context, cert core.Certificate, igno | |
// We do not check the CommonName here, as (if it exists) we already checked | ||
// that it is identical to one of the DNSNames in the SAN. | ||
for _, name := range parsedCert.DNSNames { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note that we'll need to iterate over parsedCert.IPAddresses as well. Not in this PR, but maybe you want to leave a TODO here because it would be easy to miss. |
||
err = c.pa.WillingToIssue([]string{name}) | ||
err = c.pa.WillingToIssue([]identifier.ACMEIdentifier{identifier.NewDNS(name)}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should be able to use your new |
||
if err != nil { | ||
problems = append(problems, fmt.Sprintf("Policy Authority isn't willing to issue for '%s': %s", name, err)) | ||
} else { | ||
|
@@ -469,7 +470,7 @@ func (c *certChecker) checkCert(ctx context.Context, cert core.Certificate, igno | |
} | ||
|
||
if features.Get().CertCheckerChecksValidations { | ||
err = c.checkValidations(ctx, cert, parsedCert.DNSNames) | ||
err = c.checkValidations(ctx, cert, identifier.SliceNewDNS(parsedCert.DNSNames)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe also leave a TODO for processing .IPAddresses here. |
||
if err != nil { | ||
if features.Get().CertCheckerRequiresValidations { | ||
problems = append(problems, err.Error()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ import ( | |
"github.com/letsencrypt/boulder/db" | ||
"github.com/letsencrypt/boulder/features" | ||
bgrpc "github.com/letsencrypt/boulder/grpc" | ||
"github.com/letsencrypt/boulder/identifier" | ||
blog "github.com/letsencrypt/boulder/log" | ||
bmail "github.com/letsencrypt/boulder/mail" | ||
"github.com/letsencrypt/boulder/metrics" | ||
|
@@ -310,7 +311,7 @@ func (m *mailer) updateLastNagTimestampsChunk(ctx context.Context, certs []*x509 | |
} | ||
|
||
func (m *mailer) certIsRenewed(ctx context.Context, names []string, issued time.Time) (bool, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that this function should take a slice of identifiers instead of a slice of names. |
||
namehash := core.HashNames(names) | ||
namehash := core.HashIdentifiers(identifier.SliceNewDNS(names)) | ||
|
||
var present bool | ||
err := m.dbMap.SelectOne( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identifiers are comparable: they only have two fields, both of which are concrete strings. You should be able to use them directly as map keys, rather than collapsing them into just their values.