Skip to content

Commit 88a6295

Browse files
committed
Remove last in-the-past tests and scaffolding
1 parent 3438b05 commit 88a6295

File tree

5 files changed

+6
-166
lines changed

5 files changed

+6
-166
lines changed

start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
if not startservers.install(race_detection=False):
2121
raise(Exception("failed to build"))
2222

23-
if not startservers.start(fakeclock=None):
23+
if not startservers.start():
2424
sys.exit(1)
2525
try:
2626
os.wait()

test/helpers.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -154,29 +154,6 @@ def verify_akamai_purge():
154154
break
155155
reset_akamai_purges()
156156

157-
twenty_days_ago_functions = [ ]
158-
159-
def register_twenty_days_ago(f):
160-
"""Register a function to be run during "setup_twenty_days_ago." This allows
161-
test cases to define their own custom setup.
162-
"""
163-
twenty_days_ago_functions.append(f)
164-
165-
def setup_twenty_days_ago():
166-
"""Do any setup that needs to happen 20 day in the past, for tests that
167-
will run in the 'present'.
168-
"""
169-
for f in twenty_days_ago_functions:
170-
f()
171-
172-
six_months_ago_functions = []
173-
174-
def register_six_months_ago(f):
175-
six_months_ago_functions.append(f)
176-
177-
def setup_six_months_ago():
178-
[f() for f in six_months_ago_functions]
179-
180157
def waitport(port, prog, perTickCheck=None):
181158
"""Wait until a port on localhost is open."""
182159
for _ in range(1000):

test/integration-test.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,7 @@ def main():
7373
if not startservers.install(race_detection=race_detection):
7474
raise(Exception("failed to build"))
7575

76-
if not args.test_case_filter:
77-
now = datetime.datetime.utcnow()
78-
79-
six_months_ago = now+datetime.timedelta(days=-30*6)
80-
if not startservers.start(fakeclock=fakeclock(six_months_ago)):
81-
raise(Exception("startservers failed (mocking six months ago)"))
82-
setup_six_months_ago()
83-
startservers.stop()
84-
85-
twenty_days_ago = now+datetime.timedelta(days=-20)
86-
if not startservers.start(fakeclock=fakeclock(twenty_days_ago)):
87-
raise(Exception("startservers failed (mocking twenty days ago)"))
88-
setup_twenty_days_ago()
89-
startservers.stop()
90-
91-
if not startservers.start(fakeclock=None):
76+
if not startservers.start():
9277
raise(Exception("startservers failed"))
9378

9479
if args.run_chisel:

test/startservers.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,14 @@ def install(race_detection):
199199

200200
return subprocess.call(["/usr/bin/make", "GO_BUILD_FLAGS=%s" % go_build_flags]) == 0
201201

202-
def run(cmd, fakeclock):
202+
def run(cmd):
203203
e = os.environ.copy()
204204
e.setdefault("GORACE", "halt_on_error=1")
205-
if fakeclock:
206-
e.setdefault("FAKECLOCK", fakeclock)
207205
p = subprocess.Popen(cmd, env=e)
208206
p.cmd = cmd
209207
return p
210208

211-
def start(fakeclock):
209+
def start():
212210
"""Return True if everything builds and starts.
213211
214212
Give up and return False if anything fails to build, or dies at
@@ -237,7 +235,7 @@ def start(fakeclock):
237235
print("Starting service", service.name)
238236
try:
239237
global processes
240-
p = run(service.cmd, fakeclock)
238+
p = run(service.cmd)
241239
processes.append(p)
242240
if service.grpc_port is not None:
243241
waithealth(' '.join(p.args), service.grpc_port, service.host_override)
@@ -297,8 +295,7 @@ def startChallSrv():
297295
'--management', ':8055',
298296
'--http01', '10.77.77.77:80',
299297
'-https01', '10.77.77.77:443',
300-
'--tlsalpn01', '10.88.88.88:443'],
301-
None)
298+
'--tlsalpn01', '10.88.88.88:443'])
302299
# Wait for the pebble-challtestsrv management port.
303300
if not waitport(8055, ' '.join(challSrvProcess.args)):
304301
return False

test/v2_integration.py

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,69 +1085,6 @@ def test_ct_submission():
10851085
if total_count < 2:
10861086
raise(Exception("Got %d total submissions, expected at least 2" % total_count))
10871087

1088-
def check_ocsp_basic_oid(cert_file, issuer_file, url):
1089-
"""
1090-
This function checks if an OCSP response was successful, but doesn't verify
1091-
the signature or timestamp. This is useful when simulating the past, so we
1092-
don't incorrectly reject a response for being in the past.
1093-
"""
1094-
ocsp_request = make_ocsp_req(cert_file, issuer_file)
1095-
responses = fetch_ocsp(ocsp_request, url)
1096-
# An unauthorized response (for instance, if the OCSP responder doesn't know
1097-
# about this cert) will just be 30 03 0A 01 06. A "good" or "revoked"
1098-
# response will contain, among other things, the id-pkix-ocsp-basic OID
1099-
# identifying the response type. We look for that OID to confirm we got a
1100-
# successful response.
1101-
expected = bytearray.fromhex("06 09 2B 06 01 05 05 07 30 01 01")
1102-
for resp in responses:
1103-
if not expected in bytearray(resp):
1104-
raise(Exception("Did not receive successful OCSP response: %s doesn't contain %s" %
1105-
(base64.b64encode(resp), base64.b64encode(expected))))
1106-
1107-
ocsp_exp_unauth_setup_data = {}
1108-
@register_six_months_ago
1109-
def ocsp_exp_unauth_setup():
1110-
client = chisel2.make_client(None)
1111-
cert_file = temppath('ocsp_exp_unauth_setup.pem')
1112-
chisel2.auth_and_issue([random_domain()], client=client, cert_output=cert_file.name)
1113-
1114-
# Since our servers are pretending to be in the past, but the openssl cli
1115-
# isn't, we'll get an expired OCSP response. Just check that it exists;
1116-
# don't do the full verification (which would fail).
1117-
lastException = None
1118-
for issuer_file in glob.glob("test/certs/webpki/int-rsa-*.cert.pem"):
1119-
try:
1120-
check_ocsp_basic_oid(cert_file.name, issuer_file, "http://localhost:4002")
1121-
global ocsp_exp_unauth_setup_data
1122-
ocsp_exp_unauth_setup_data['cert_file'] = cert_file.name
1123-
return
1124-
except Exception as e:
1125-
lastException = e
1126-
continue
1127-
raise(lastException)
1128-
1129-
def test_ocsp_exp_unauth():
1130-
tries = 0
1131-
if 'cert_file' not in ocsp_exp_unauth_setup_data:
1132-
raise Exception("ocsp_exp_unauth_setup didn't run")
1133-
cert_file = ocsp_exp_unauth_setup_data['cert_file']
1134-
last_error = ""
1135-
while tries < 5:
1136-
try:
1137-
verify_ocsp(cert_file, "test/certs/webpki/int-rsa-*.cert.pem", "http://localhost:4002", "XXX")
1138-
raise(Exception("Unexpected return from verify_ocsp"))
1139-
except subprocess.CalledProcessError as cpe:
1140-
last_error = cpe.output
1141-
if cpe.output == b"Responder Error: unauthorized (6)\n":
1142-
break
1143-
except e:
1144-
last_error = e
1145-
pass
1146-
tries += 1
1147-
time.sleep(0.25)
1148-
else:
1149-
raise(Exception("timed out waiting for unauthorized OCSP response for expired certificate. Last error: {}".format(last_error)))
1150-
11511088
def test_expiration_mailer():
11521089
email_addr = "integration.%[email protected]" % random.randrange(2**16)
11531090
order = chisel2.auth_and_issue([random_domain()], email=email_addr)
@@ -1324,59 +1261,3 @@ def test_auth_deactivation():
13241261
resp = client.deactivate_authorization(order.authorizations[0])
13251262
if resp.body.status is not messages.STATUS_DEACTIVATED:
13261263
raise Exception("unexpected authorization status")
1327-
1328-
def get_ocsp_response_and_reason(cert_file, issuer_glob, url):
1329-
"""Returns the ocsp response output and revocation reason."""
1330-
output = verify_ocsp(cert_file, issuer_glob, url, None)
1331-
m = re.search('Reason: (\w+)', output)
1332-
reason = m.group(1) if m is not None else ""
1333-
return output, reason
1334-
1335-
ocsp_resigning_setup_data = {}
1336-
@register_twenty_days_ago
1337-
def ocsp_resigning_setup():
1338-
"""Issue and then revoke a cert in the past.
1339-
1340-
Useful setup for test_ocsp_resigning, which needs to check that the
1341-
revocation reason is still correctly set after re-signing and old OCSP
1342-
response.
1343-
"""
1344-
client = chisel2.make_client(None)
1345-
cert_file = temppath('ocsp_resigning_setup.pem')
1346-
order = chisel2.auth_and_issue([random_domain()], client=client, cert_output=cert_file.name)
1347-
1348-
cert = OpenSSL.crypto.load_certificate(
1349-
OpenSSL.crypto.FILETYPE_PEM, order.fullchain_pem)
1350-
# Revoke for reason 5: cessationOfOperation
1351-
client.revoke(josepy.ComparableX509(cert), 5)
1352-
1353-
ocsp_response, reason = get_ocsp_response_and_reason(
1354-
cert_file.name, "test/certs/webpki/int-rsa-*.cert.pem", "http://localhost:4002")
1355-
global ocsp_resigning_setup_data
1356-
ocsp_resigning_setup_data = {
1357-
'cert_file': cert_file.name,
1358-
'response': ocsp_response,
1359-
'reason': reason
1360-
}
1361-
1362-
def test_ocsp_resigning():
1363-
"""Check that, after re-signing an OCSP, the reason is still set."""
1364-
if 'response' not in ocsp_resigning_setup_data:
1365-
raise Exception("ocsp_resigning_setup didn't run")
1366-
1367-
tries = 0
1368-
while tries < 5:
1369-
resp, reason = get_ocsp_response_and_reason(
1370-
ocsp_resigning_setup_data['cert_file'], "test/certs/webpki/int-rsa-*.cert.pem", "http://localhost:4002")
1371-
if resp != ocsp_resigning_setup_data['response']:
1372-
break
1373-
tries += 1
1374-
time.sleep(0.25)
1375-
else:
1376-
raise(Exception("timed out waiting for re-signed OCSP response for certificate"))
1377-
1378-
if reason != ocsp_resigning_setup_data['reason']:
1379-
raise(Exception("re-signed ocsp response has different reason %s expected %s" % (
1380-
reason, ocsp_resigning_setup_data['reason'])))
1381-
if reason != "cessationOfOperation":
1382-
raise(Exception("re-signed ocsp response has wrong reason %s" % reason))

0 commit comments

Comments
 (0)