Skip to content

Commit

Permalink
Perform remote validation after primary validation (#7522)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
aarongable authored Jun 10, 2024
1 parent e198d35 commit 5b64707
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 247 deletions.
7 changes: 3 additions & 4 deletions va/caa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -959,19 +959,18 @@ func TestMultiCAARechecking(t *testing.T) {
}

func TestCAAFailure(t *testing.T) {
chall := createChallenge(core.ChallengeTypeHTTP01)
hs := httpSrv(t, chall.Token)
hs := httpSrv(t, expectedToken)
defer hs.Close()

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

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

_, err = va.validate(ctx, dnsi("example.gonetld"), 1, chall, expectedKeyAuthorization)
err = va.checkCAA(ctx, dnsi("example.gonetld"), &caaParams{1, core.ChallengeTypeHTTP01})
if err == nil {
t.Fatalf("Expected CAA rejection for gonetld, got success")
}
Expand Down
39 changes: 0 additions & 39 deletions va/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"net"
"strings"
"testing"
"time"

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

func TestDNSValidationNotSane(t *testing.T) {
va, _ := setup(nil, 0, "", nil, nil)

chall := createChallenge(core.ChallengeTypeDNS01)
chall.Token = ""
_, err := va.validateChallenge(ctx, dnsi("localhost"), chall, expectedKeyAuthorization)
prob := detailedError(err)
if prob.Type != probs.MalformedProblem {
t.Errorf("Got wrong error type: expected %s, got %s",
prob.Type, probs.MalformedProblem)
}
if !strings.Contains(prob.Error(), "Challenge failed consistency check:") {
t.Errorf("Got wrong error: %s", prob.Error())
}

chall.Token = "yfCBb-bRTLz8Wd1C0lTUQK3qlKj3-t2tYGwx5Hj7r_"
_, err = va.validateChallenge(ctx, dnsi("localhost"), chall, expectedKeyAuthorization)
prob = detailedError(err)
if prob.Type != probs.MalformedProblem {
t.Errorf("Got wrong error type: expected %s, got %s",
prob.Type, probs.MalformedProblem)
}
if !strings.Contains(prob.Error(), "Challenge failed consistency check:") {
t.Errorf("Got wrong error: %s", prob.Error())
}

_, err = va.validateChallenge(ctx, dnsi("localhost"), chall, "a")
prob = detailedError(err)
if prob.Type != probs.MalformedProblem {
t.Errorf("Got wrong error type: expected %s, got %s",
prob.Type, probs.MalformedProblem)
}
if !strings.Contains(prob.Error(), "Challenge failed consistency check:") {
t.Errorf("Got wrong error: %s", prob.Error())
}

}

func TestDNSValidationServFail(t *testing.T) {
va, _ := setup(nil, 0, "", nil, nil)

Expand Down
Loading

0 comments on commit 5b64707

Please sign in to comment.