Skip to content

Commit

Permalink
Add local tests for NULL, EXPORT, DES & 3DES cipher suites
Browse files Browse the repository at this point in the history
  • Loading branch information
jviide committed Aug 31, 2016
1 parent fb89c0b commit b06f476
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion runners/trytls/bundles/https.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,39 @@ def local(accept, cn, description):
)


@testenv
def local_cipher_suites(accept, suites, note=None):
description = "obsolete {} cipher suites".format(suites)
if note:
description += " ({})".format(note)

context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
try:
context.set_ciphers(suites)
except ssl.SSLError:
yield Test(
accept=accept,
description=description,
host="localhost",
port=0,
forced_result=results.Skip("TryTLS does not support {} cipher suites".format(suites))
)
return

certdata, keydata, cadata = gencert("localhost")
with tmpfiles(certdata, keydata, cadata) as (certfile, keyfile, cafile):
context.load_cert_chain(certfile, keyfile)

with http_server(context) as (host, port):
yield Test(
accept=accept,
description=description,
host=host,
port=port,
cafile=cafile
)


@testgroup
def badssl_tests():
forced_result = None
Expand Down Expand Up @@ -277,7 +310,11 @@ def tlsfun_tests():
local_tests = testgroup(
local(True, "localhost", "valid localhost certificate"),
local(False, "nothing", "invalid localhost certificate"),
badssl_onlymyca("use only the given CA bundle, not system's")
badssl_onlymyca("use only the given CA bundle, not system's"),
local_cipher_suites(False, "NULL"),
local_cipher_suites(False, "EXPORT"),
local_cipher_suites(False, "DES"),
local_cipher_suites(False, "3DES", "vulnerable to Sweet32")
)

dshield_tests = testgroup(
Expand Down

0 comments on commit b06f476

Please sign in to comment.