Skip to content

Commit 67fd6ef

Browse files
benileorolandshoemaker
authored andcommitted
Add certificatesPerName rate limit to integration test (letsencrypt#1940)
This PR, covers the code path where the certificatesPerName rate limit is exceeded. Additionally, a node package (cli) was upgraded as the spinner was preventing the redirection of I/O. See this commit: node-js-libs/cli@ff064fe. Fixes letsencrypt#1614 letsencrypt#1940
1 parent e62a605 commit 67fd6ef

File tree

6 files changed

+30
-2
lines changed

6 files changed

+30
-2
lines changed

ratelimit/rate-limits_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func TestLoadPolicies(t *testing.T) {
8484
test.AssertEquals(t, certsPerName.Threshold, 2)
8585
test.AssertDeepEquals(t, certsPerName.Overrides, map[string]int{
8686
"ratelimit.me": 1,
87+
"lim.it": 0,
8788
"le.wtf": 10000,
8889
"le1.wtf": 10000,
8990
"le2.wtf": 10000,

test/integration-test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,29 @@ def expect(target_time, num):
265265
expect(now, 0)
266266
expect(after_grace_period, 1)
267267

268+
def run_certificates_per_name_test():
269+
try:
270+
# This command will return a non zero error code. In order
271+
# to avoid a CalledProcessException we use Popen.
272+
handle = subprocess.Popen(
273+
'''node test.js --email %s --domains %s''' % ('test@lim.it', 'lim.it'),
274+
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
275+
handle.wait()
276+
out, err = handle.communicate()
277+
except subprocess.CalledProcessError as e:
278+
print("\nFailure while running certificates per name test %s" % e)
279+
die(ExitStatus.PythonFailure)
280+
281+
expected = [
282+
"urn:acme:error:rateLimited",
283+
"Error creating new cert :: Too many certificates already issued for: lim.it",
284+
"429"
285+
]
286+
for s in expected:
287+
if s not in out:
288+
print("\nCertificates per name test: expected %s not present in output" % s)
289+
die(ExitStatus.Error)
290+
268291
@atexit.register
269292
def cleanup():
270293
import shutil
@@ -328,6 +351,8 @@ def main():
328351

329352
run_expired_authz_purger_test()
330353

354+
run_certificates_per_name_test()
355+
331356
# Simulate a disconnection from RabbitMQ to make sure reconnects work.
332357
startservers.bounce_forward()
333358

test/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"repository": "https://github.com/letsencrypt/boulder",
55
"version": "0.0.1",
66
"dependencies": {
7-
"cli": "^0.6.5",
7+
"cli": "^0.7.1",
88
"colors": "^1.1.0",
99
"inquirer": "^0.8.2",
1010
"node-forge": "^0.6.21",

test/rate-limit-policies-b.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ certificatesPerName:
77
threshold: 99
88
overrides:
99
ratelimit.me: 1
10+
lim.it: 0
1011
# Hostnames used by the letsencrypt client integration test.
1112
le.wtf: 9999
1213
le1.wtf: 9999

test/rate-limit-policies.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ certificatesPerName:
77
threshold: 2
88
overrides:
99
ratelimit.me: 1
10+
lim.it: 0
1011
# Hostnames used by the letsencrypt client integration test.
1112
le.wtf: 10000
1213
le1.wtf: 10000

wfe/wfe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ func (wfe *WebFrontEndImpl) NewCertificate(ctx context.Context, logEvent *reques
808808
// TODO IMPORTANT: The RA trusts the WFE to provide the correct key. If the
809809
// WFE is compromised, *and* the attacker knows the public key of an account
810810
// authorized for target site, they could cause issuance for that site by
811-
// lying to the RA. We should probably pass a copy of the whole rquest to the
811+
// lying to the RA. We should probably pass a copy of the whole request to the
812812
// RA for secondary validation.
813813
cert, err := wfe.RA.NewCertificate(ctx, certificateRequest, reg.ID)
814814
if err != nil {

0 commit comments

Comments
 (0)