Skip to content

Commit baea2d0

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

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
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: 10 additions & 10 deletions
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
}
@@ -452,55 +452,55 @@ func TestCAALogging(t *testing.T) {
452452
Domain: "reserved.com",
453453
AccountURIID: 12345,
454454
ChallengeType: core.ChallengeTypeHTTP01,
455-
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for reserved.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: false, Found at: \"reserved.com\"] Response=\"foo\"",
455+
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for reserved.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: false, Found at: \"reserved.com\", AD: true] Response=\"foo\"",
456456
},
457457
{
458458
Domain: "reserved.com",
459459
AccountURIID: 12345,
460460
ChallengeType: core.ChallengeTypeDNS01,
461-
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for reserved.com, [Present: true, Account ID: 12345, Challenge: dns-01, Valid for issuance: false, Found at: \"reserved.com\"] Response=\"foo\"",
461+
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for reserved.com, [Present: true, Account ID: 12345, Challenge: dns-01, Valid for issuance: false, Found at: \"reserved.com\", AD: true] Response=\"foo\"",
462462
},
463463
{
464464
Domain: "mixedcase.com",
465465
AccountURIID: 12345,
466466
ChallengeType: core.ChallengeTypeHTTP01,
467-
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for mixedcase.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: false, Found at: \"mixedcase.com\"] Response=\"foo\"",
467+
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for mixedcase.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: false, Found at: \"mixedcase.com\", AD: true] Response=\"foo\"",
468468
},
469469
{
470470
Domain: "critical.com",
471471
AccountURIID: 12345,
472472
ChallengeType: core.ChallengeTypeHTTP01,
473-
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for critical.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: false, Found at: \"critical.com\"] Response=\"foo\"",
473+
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for critical.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: false, Found at: \"critical.com\", AD: true] Response=\"foo\"",
474474
},
475475
{
476476
Domain: "present.com",
477477
AccountURIID: 12345,
478478
ChallengeType: core.ChallengeTypeHTTP01,
479-
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for present.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: true, Found at: \"present.com\"] Response=\"foo\"",
479+
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for present.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: true, Found at: \"present.com\", AD: true] Response=\"foo\"",
480480
},
481481
{
482482
Domain: "not.here.but.still.present.com",
483483
AccountURIID: 12345,
484484
ChallengeType: core.ChallengeTypeHTTP01,
485-
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for not.here.but.still.present.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: true, Found at: \"present.com\"] Response=\"foo\"",
485+
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for not.here.but.still.present.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: true, Found at: \"present.com\", AD: true] Response=\"foo\"",
486486
},
487487
{
488488
Domain: "multi-crit-present.com",
489489
AccountURIID: 12345,
490490
ChallengeType: core.ChallengeTypeHTTP01,
491-
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for multi-crit-present.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: true, Found at: \"multi-crit-present.com\"] Response=\"foo\"",
491+
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for multi-crit-present.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: true, Found at: \"multi-crit-present.com\", AD: true] Response=\"foo\"",
492492
},
493493
{
494494
Domain: "present-with-parameter.com",
495495
AccountURIID: 12345,
496496
ChallengeType: core.ChallengeTypeHTTP01,
497-
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for present-with-parameter.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: true, Found at: \"present-with-parameter.com\"] Response=\"foo\"",
497+
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for present-with-parameter.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: true, Found at: \"present-with-parameter.com\", AD: true] Response=\"foo\"",
498498
},
499499
{
500500
Domain: "satisfiable-wildcard-override.com",
501501
AccountURIID: 12345,
502502
ChallengeType: core.ChallengeTypeHTTP01,
503-
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for satisfiable-wildcard-override.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: false, Found at: \"satisfiable-wildcard-override.com\"] Response=\"foo\"",
503+
ExpectedLogline: "INFO: [AUDIT] Checked CAA records for satisfiable-wildcard-override.com, [Present: true, Account ID: 12345, Challenge: http-01, Valid for issuance: false, Found at: \"satisfiable-wildcard-override.com\", AD: true] Response=\"foo\"",
504504
},
505505
}
506506

0 commit comments

Comments
 (0)