-
-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WFE: Check NewOrder rate limits #7201
Merged
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3765ae4
WFE: Check NewOrder rate limits
beautifulentropy ec8e833
Eliminate spend/refund data race.
beautifulentropy 15a7def
Merge branch 'main' into ratelimits-new-order
beautifulentropy fcb227c
Add new limits.
beautifulentropy 49c2930
Merge branch 'main' into ratelimits-new-order
beautifulentropy 3609d28
Check MaxNames at WFE
beautifulentropy 8b34693
Do not refund when error is RateLimit
beautifulentropy 3c1f7a9
Allow default to be used.
beautifulentropy 6fdadc0
Merge branch 'main' into ratelimits-new-order
beautifulentropy e8c169e
Add integration test for CertificatesPerFQDNSet limit
beautifulentropy aaa9745
Address comments.
beautifulentropy 6e2b31d
Merge branch 'main' into ratelimits-new-order
beautifulentropy ffcdcb1
Returning to a simpler approach.
beautifulentropy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,2 +1,24 @@ | ||
NewRegistrationsPerIPAddress: { burst: 10000, count: 10000, period: 168h } | ||
NewRegistrationsPerIPv6Range: { burst: 99999, count: 99999, period: 168h } | ||
NewRegistrationsPerIPAddress: | ||
count: 10000 | ||
burst: 10000 | ||
period: 168h | ||
NewRegistrationsPerIPv6Range: | ||
count: 99999 | ||
burst: 99999 | ||
period: 168h | ||
CertificatesPerDomain: | ||
count: 2 | ||
burst: 2 | ||
period: 2160h | ||
FailedAuthorizationsPerAccount: | ||
count: 3 | ||
burst: 3 | ||
period: 5m | ||
NewOrdersPerAccount: | ||
count: 1500 | ||
burst: 1500 | ||
period: 3h | ||
CertificatesPerFQDNSet: | ||
count: 6 | ||
burst: 6 | ||
period: 168h |
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 |
---|---|---|
|
@@ -3,8 +3,17 @@ | |
package integration | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/jmhodges/clock" | ||
"github.com/letsencrypt/boulder/cmd" | ||
blog "github.com/letsencrypt/boulder/log" | ||
"github.com/letsencrypt/boulder/metrics" | ||
"github.com/letsencrypt/boulder/ratelimits" | ||
bredis "github.com/letsencrypt/boulder/redis" | ||
"github.com/letsencrypt/boulder/test" | ||
) | ||
|
||
|
@@ -20,4 +29,45 @@ func TestDuplicateFQDNRateLimit(t *testing.T) { | |
|
||
_, err = authAndIssue(nil, nil, []string{domain}, true) | ||
test.AssertError(t, err, "Somehow managed to issue third certificate") | ||
|
||
if strings.Contains(os.Getenv("BOULDER_CONFIG_DIR"), "test/config-next") { | ||
// Setup rate limiting. | ||
rc := bredis.Config{ | ||
Username: "unittest-rw", | ||
TLS: cmd.TLSConfig{ | ||
CACertFile: "test/redis-tls/minica.pem", | ||
CertFile: "test/redis-tls/boulder/cert.pem", | ||
KeyFile: "test/redis-tls/boulder/key.pem", | ||
}, | ||
Lookups: []cmd.ServiceDomain{ | ||
{ | ||
Service: "redisratelimits", | ||
Domain: "service.consul", | ||
}, | ||
}, | ||
LookupDNSAuthority: "consul.service.consul", | ||
} | ||
rc.PasswordConfig = cmd.PasswordConfig{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: You could include the
|
||
PasswordFile: "test/secrets/ratelimits_redis_password", | ||
} | ||
|
||
fc := clock.NewFake() | ||
stats := metrics.NoopRegisterer | ||
log := blog.NewMock() | ||
ring, err := bredis.NewRingFromConfig(rc, stats, log) | ||
test.AssertNotError(t, err, "making redis ring client") | ||
source := ratelimits.NewRedisSource(ring.Ring, fc, stats) | ||
test.AssertNotNil(t, source, "source should not be nil") | ||
limiter, err := ratelimits.NewLimiter(fc, source, stats) | ||
test.AssertNotError(t, err, "making limiter") | ||
txnBuilder, err := ratelimits.NewTransactionBuilder("test/config-next/wfe2-ratelimit-defaults.yml", "") | ||
test.AssertNotError(t, err, "making transaction composer") | ||
|
||
// Check that the CertificatesPerFQDNSet limit is reached. | ||
txn, err := txnBuilder.CertificatesPerFQDNSetTransaction([]string{domain}) | ||
test.AssertNotError(t, err, "making transaction") | ||
result, err := limiter.Check(context.Background(), txn) | ||
test.AssertNotError(t, err, "checking transaction") | ||
test.Assert(t, !result.Allowed, "should not be allowed") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I understand that the validation tag catches this, but
MaxNames
could be declared as auint
instead. A minor type changes would be needed in theNewWebFrontEndImpl
constructor andWebFrontEndImpl
struct.