-
-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error when deactivating an account (#7899)
The RA's DeactivateAccount method expects the account provided to it by the WFE to still have status Valid. The new WFE deactivation code was hardcoding the status to Deactivated. Fix the WFE to pass the account's current status instead. Add an integration test to confirm both the breakage and the fix. Also leave behind some TODOs to simplify this codepath further, and not require the status to be provided at all. Part of #5554
- Loading branch information
1 parent
5c34d05
commit 0c658f2
Showing
5 changed files
with
63 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//go:build integration | ||
|
||
package integration | ||
|
||
import ( | ||
"crypto/ecdsa" | ||
"crypto/elliptic" | ||
"crypto/rand" | ||
"testing" | ||
|
||
"github.com/eggsampler/acme/v3" | ||
|
||
"github.com/letsencrypt/boulder/core" | ||
) | ||
|
||
// TestAccountDeactivate tests that account deactivation works. It does not test | ||
// that we reject requests for other account statuses, because eggsampler/acme | ||
// wisely does not allow us to construct such malformed requests. | ||
func TestAccountDeactivate(t *testing.T) { | ||
t.Parallel() | ||
|
||
c, err := acme.NewClient("http://boulder.service.consul:4001/directory") | ||
if err != nil { | ||
t.Fatalf("failed to connect to acme directory: %s", err) | ||
} | ||
|
||
acctKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) | ||
if err != nil { | ||
t.Fatalf("failed to generate account key: %s", err) | ||
} | ||
|
||
account, err := c.NewAccount(acctKey, false, true, "mailto:hello@blackhole.net") | ||
if err != nil { | ||
t.Fatalf("failed to create initial account: %s", err) | ||
} | ||
|
||
got, err := c.DeactivateAccount(account) | ||
if err != nil { | ||
t.Errorf("unexpected error while deactivating account: %s", err) | ||
} | ||
|
||
if got.Status != string(core.StatusDeactivated) { | ||
t.Errorf("account deactivation should have set status to %q, instead got %q", core.StatusDeactivated, got.Status) | ||
} | ||
|
||
// TODO(#5554): Check that the contacts have been cleared. We can't do this | ||
// today because eggsampler/acme unmarshals the WFE's response into the same | ||
// account object as it used to make the request, and a wholly missing | ||
// contacts field doesn't overwrite whatever eggsampler was holding in memory. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters