Skip to content

Commit 5b64707

Browse files
authored
Perform remote validation after primary validation (#7522)
Change the VA to perform remote validation wholly after local validation and CAA checks, and to do so only if those local checks pass. This will likely increase the latency of our successful validations, by making them less parallel. However, it will reduce the amount of work we do on unsuccessful validations, and reduce their latency, by not kicking off and waiting for remote results. Fixes #7509
1 parent e198d35 commit 5b64707

File tree

4 files changed

+183
-247
lines changed

4 files changed

+183
-247
lines changed

va/caa_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -959,19 +959,18 @@ func TestMultiCAARechecking(t *testing.T) {
959959
}
960960

961961
func TestCAAFailure(t *testing.T) {
962-
chall := createChallenge(core.ChallengeTypeHTTP01)
963-
hs := httpSrv(t, chall.Token)
962+
hs := httpSrv(t, expectedToken)
964963
defer hs.Close()
965964

966965
va, _ := setup(hs, 0, "", nil, caaMockDNS{})
967966

968-
_, err := va.validate(ctx, dnsi("reserved.com"), 1, chall, expectedKeyAuthorization)
967+
err := va.checkCAA(ctx, dnsi("reserved.com"), &caaParams{1, core.ChallengeTypeHTTP01})
969968
if err == nil {
970969
t.Fatalf("Expected CAA rejection for reserved.com, got success")
971970
}
972971
test.AssertErrorIs(t, err, berrors.CAA)
973972

974-
_, err = va.validate(ctx, dnsi("example.gonetld"), 1, chall, expectedKeyAuthorization)
973+
err = va.checkCAA(ctx, dnsi("example.gonetld"), &caaParams{1, core.ChallengeTypeHTTP01})
975974
if err == nil {
976975
t.Fatalf("Expected CAA rejection for gonetld, got success")
977976
}

va/dns_test.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"net"
7-
"strings"
87
"testing"
98
"time"
109

@@ -91,44 +90,6 @@ func TestDNSValidationInvalid(t *testing.T) {
9190
test.AssertEquals(t, prob.Type, probs.MalformedProblem)
9291
}
9392

94-
func TestDNSValidationNotSane(t *testing.T) {
95-
va, _ := setup(nil, 0, "", nil, nil)
96-
97-
chall := createChallenge(core.ChallengeTypeDNS01)
98-
chall.Token = ""
99-
_, err := va.validateChallenge(ctx, dnsi("localhost"), chall, expectedKeyAuthorization)
100-
prob := detailedError(err)
101-
if prob.Type != probs.MalformedProblem {
102-
t.Errorf("Got wrong error type: expected %s, got %s",
103-
prob.Type, probs.MalformedProblem)
104-
}
105-
if !strings.Contains(prob.Error(), "Challenge failed consistency check:") {
106-
t.Errorf("Got wrong error: %s", prob.Error())
107-
}
108-
109-
chall.Token = "yfCBb-bRTLz8Wd1C0lTUQK3qlKj3-t2tYGwx5Hj7r_"
110-
_, err = va.validateChallenge(ctx, dnsi("localhost"), chall, expectedKeyAuthorization)
111-
prob = detailedError(err)
112-
if prob.Type != probs.MalformedProblem {
113-
t.Errorf("Got wrong error type: expected %s, got %s",
114-
prob.Type, probs.MalformedProblem)
115-
}
116-
if !strings.Contains(prob.Error(), "Challenge failed consistency check:") {
117-
t.Errorf("Got wrong error: %s", prob.Error())
118-
}
119-
120-
_, err = va.validateChallenge(ctx, dnsi("localhost"), chall, "a")
121-
prob = detailedError(err)
122-
if prob.Type != probs.MalformedProblem {
123-
t.Errorf("Got wrong error type: expected %s, got %s",
124-
prob.Type, probs.MalformedProblem)
125-
}
126-
if !strings.Contains(prob.Error(), "Challenge failed consistency check:") {
127-
t.Errorf("Got wrong error: %s", prob.Error())
128-
}
129-
130-
}
131-
13293
func TestDNSValidationServFail(t *testing.T) {
13394
va, _ := setup(nil, 0, "", nil, nil)
13495

0 commit comments

Comments
 (0)