|
|
@@ -5683,20 +5683,20 @@ func TestDNSPersist01Validate(t *testing.T) {
|
|
|
value: "example.com",
|
|
|
account: &Account{ID: "123", Status: StatusDeactivated, LocationPrefix: "https://ca.example/acct/"},
|
|
|
wantStatus: StatusInvalid,
|
|
|
- wantChErr: NewError(ErrorUnauthorizedType, "account 123 is not valid"),
|
|
|
+ wantChErr: NewDetailedError(ErrorUnauthorizedType, "account 123 is not valid"),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/account-without-location",
|
|
|
value: "example.com",
|
|
|
account: &Account{ID: "123", Status: StatusValid},
|
|
|
wantStatus: StatusInvalid,
|
|
|
- wantChErr: NewError(ErrorUnauthorizedType, "account 123 does not have the stored location required by dns-persist-01 challenges"),
|
|
|
+ wantChErr: NewDetailedError(ErrorUnauthorizedType, "account 123 does not have the stored location required by dns-persist-01 challenges"),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/invalid-domain",
|
|
|
value: "exa mple.com",
|
|
|
wantStatus: StatusInvalid,
|
|
|
- wantChErr: NewError(ErrorMalformedType, "invalid DNS name exa mple.com"),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, "invalid DNS name exa mple.com"),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/lookup-error",
|
|
|
@@ -5710,105 +5710,105 @@ func TestDNSPersist01Validate(t *testing.T) {
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"ca1.example; accounturi=" + accountURI},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorUnauthorizedType, "no TXT record found at _validation-persist.example.com for issuer domain names authority.example, ca.example.net"),
|
|
|
+ wantChErr: NewDetailedError(ErrorUnauthorizedType, "no TXT record found at _validation-persist.example.com for issuer domain names authority.example, ca.example.net"),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/missing-account-uri",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; policy=wildcard"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `TXT record "authority.example; policy=wildcard" is missing the accounturi parameter`),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `TXT record "authority.example; policy=wildcard" is missing the accounturi parameter`),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/missing-parameters",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example;"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `TXT record "authority.example;" is missing the accounturi parameter`),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `TXT record "authority.example;" is missing the accounturi parameter`),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/duplicate-parameter",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + accountURI + "; persistUntil=1; persistuntil=2"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; persistUntil=1; persistuntil=2" has a duplicate parameter "persistuntil"`, accountURI),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; persistUntil=1; persistuntil=2" has a duplicate parameter "persistuntil"`, accountURI),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/parameter-without-value",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + accountURI + "; policy"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; policy" has an invalid parameter " policy"`, accountURI),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; policy" has an invalid parameter " policy"`, accountURI),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/empty-parameter",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + accountURI + ";"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s;" has an invalid parameter ""`, accountURI),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s;" has an invalid parameter ""`, accountURI),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/invalid-tag",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + accountURI + "; -policy=wildcard"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; -policy=wildcard" has an invalid parameter " -policy=wildcard"`, accountURI),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; -policy=wildcard" has an invalid parameter " -policy=wildcard"`, accountURI),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/invalid-value",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + accountURI + "; policy=wild card"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; policy=wild card" has an invalid parameter " policy=wild card"`, accountURI),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; policy=wild card" has an invalid parameter " policy=wild card"`, accountURI),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/account-uri-prefix",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=https://ca.example/acct/123"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `accounturi "https://ca.example/acct/123" does not start with "https://ca.example/account-hash/"`),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `accounturi "https://ca.example/acct/123" does not start with "https://ca.example/account-hash/"`),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/account-uri-algorithm",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + prefix + "sha-512/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk-kw"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `accounturi "https://ca.example/account-hash/sha-512/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk-kw" does not use the sha-256 hash algorithm`),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `accounturi "https://ca.example/account-hash/sha-512/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk-kw" does not use the sha-256 hash algorithm`),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/account-uri-hash",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + prefix + "sha-256/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `accounturi "https://ca.example/account-hash/sha-256/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk" does not contain a valid sha-256 hash value`),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `accounturi "https://ca.example/account-hash/sha-256/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk" does not contain a valid sha-256 hash value`),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/account-uri-mismatch",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + otherAccountURI},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", accountURI, otherAccountURI),
|
|
|
+ wantChErr: NewDetailedError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", accountURI, otherAccountURI),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/account-uri-other-domain",
|
|
|
value: "www.example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + accountURI},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", wwwAccountURI, accountURI),
|
|
|
+ wantChErr: NewDetailedError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", wwwAccountURI, accountURI),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/persist-until-invalid",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + accountURI + "; persistUntil=+1767225600"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; persistUntil=+1767225600" has an invalid persistUntil value "+1767225600"`, accountURI),
|
|
|
+ wantChErr: NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; persistUntil=+1767225600" has an invalid persistUntil value "+1767225600"`, accountURI),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/persist-until-expired",
|
|
|
value: "example.com",
|
|
|
txtRecords: []string{"authority.example; accounturi=" + accountURI + "; persistUntil=1721952000"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorUnauthorizedType, "TXT record expired at 2024-07-26T00:00:00Z"),
|
|
|
+ wantChErr: NewDetailedError(ErrorUnauthorizedType, "TXT record expired at 2024-07-26T00:00:00Z"),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/wildcard-without-policy",
|
|
|
@@ -5816,7 +5816,7 @@ func TestDNSPersist01Validate(t *testing.T) {
|
|
|
wildcard: true,
|
|
|
txtRecords: []string{"authority.example; accounturi=" + accountURI + "; policy=other"},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorUnauthorizedType, "TXT record does not have the policy=wildcard parameter required for *.example.com"),
|
|
|
+ wantChErr: NewDetailedError(ErrorUnauthorizedType, "TXT record does not have the policy=wildcard parameter required for *.example.com"),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/first-error",
|
|
|
@@ -5826,7 +5826,7 @@ func TestDNSPersist01Validate(t *testing.T) {
|
|
|
"ca.example.net; policy=wildcard",
|
|
|
},
|
|
|
wantStatus: StatusPending,
|
|
|
- wantChErr: NewError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", accountURI, otherAccountURI),
|
|
|
+ wantChErr: NewDetailedError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", accountURI, otherAccountURI),
|
|
|
},
|
|
|
{
|
|
|
name: "fail/update-authorization-error",
|
|
|
@@ -5920,6 +5920,7 @@ func TestDNSPersist01Validate(t *testing.T) {
|
|
|
if tt.wantChErr != nil {
|
|
|
if assert.NotNil(t, ch.Error) {
|
|
|
assert.Equal(t, tt.wantChErr.Type, ch.Error.Type)
|
|
|
+ assert.Equal(t, tt.wantChErr.Detail, ch.Error.Detail)
|
|
|
assert.Equal(t, tt.wantChErr.Status, ch.Error.Status)
|
|
|
assert.Equal(t, tt.wantChErr.Err.Error(), ch.Error.Err.Error())
|
|
|
}
|