Skip to content

Commit 9cb7334

Browse files
committed
And log it with CAA logs
1 parent acdb058 commit 9cb7334

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

va/caa.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ func (va *ValidationAuthorityImpl) checkCAA(
154154
return errors.New("expected validationMethod or accountURIID not provided to checkCAA")
155155
}
156156

157-
foundAt, valid, response, err := va.checkCAARecords(ctx, ident, params)
157+
foundAt, valid, response, ad, err := va.checkCAARecords(ctx, ident, params)
158158
if err != nil {
159159
return berrors.DNSError("%s", err)
160160
}
161161

162-
va.log.AuditInfof("Checked CAA records for %s, [Present: %t, Account ID: %d, Challenge: %s, Valid for issuance: %t, Found at: %q] Response=%q",
163-
ident.Value, foundAt != "", params.accountURIID, params.validationMethod, valid, foundAt, response)
162+
va.log.AuditInfof("Checked CAA records for %s, [Present: %t, Account ID: %d, Challenge: %s, Valid for issuance: %t, Found at: %q, AD: %t] Response=%q",
163+
ident.Value, foundAt != "", params.accountURIID, params.validationMethod, valid, foundAt, ad, response)
164164
if !valid {
165165
return berrors.CAAError("CAA record for %s prevents issuance", foundAt)
166166
}
@@ -306,7 +306,7 @@ func (va *ValidationAuthorityImpl) getCAA(ctx context.Context, hostname string)
306306
func (va *ValidationAuthorityImpl) checkCAARecords(
307307
ctx context.Context,
308308
ident identifier.ACMEIdentifier,
309-
params *caaParams) (string, bool, string, error) {
309+
params *caaParams) (string, bool, string, bool, error) {
310310
hostname := strings.ToLower(ident.Value)
311311
// If this is a wildcard name, remove the prefix
312312
var wildcard bool
@@ -316,14 +316,16 @@ func (va *ValidationAuthorityImpl) checkCAARecords(
316316
}
317317
caaSet, err := va.getCAA(ctx, hostname)
318318
if err != nil {
319-
return "", false, "", err
319+
return "", false, "", false, err
320320
}
321321
raw := ""
322+
ad := false
322323
if caaSet != nil {
323324
raw = caaSet.dig
325+
ad = caaSet.ad
324326
}
325327
valid, foundAt := va.validateCAA(caaSet, wildcard, params)
326-
return foundAt, valid, raw, nil
328+
return foundAt, valid, raw, ad, nil
327329
}
328330

329331
// validateCAA checks a provided *caaResult. When the wildcard argument is true

va/caa_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ func TestCAAChecking(t *testing.T) {
424424
defer mockLog.Clear()
425425
t.Run(caaTest.Name, func(t *testing.T) {
426426
ident := identifier.NewDNS(caaTest.Domain)
427-
foundAt, valid, _, err := va.checkCAARecords(ctx, ident, params)
427+
foundAt, valid, _, _, err := va.checkCAARecords(ctx, ident, params)
428428
if err != nil {
429429
t.Errorf("checkCAARecords error for %s: %s", caaTest.Domain, err)
430430
}

0 commit comments

Comments
 (0)