Skip to content

Commit

Permalink
empty client_authz extension from RFC 5878
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Aug 27, 2016
1 parent ba72318 commit 77cf1ca
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 1 deletion.
5 changes: 4 additions & 1 deletion prober.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@
UserMappingNull12PFS(),
UserMappingOverflow(),
UserMappingOverflow12(),
UserMappingOverflow12PFS()
UserMappingOverflow12PFS(),
ClientAuthzNull(),
ClientAuthzNull12(),
ClientAuthzNull12PFS()
]

def probe(ipaddress, port, starttls, specified_probe):
Expand Down
25 changes: 25 additions & 0 deletions probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1629,3 +1629,28 @@ class UserMappingOverflow12(UserMappingOverflow, NormalHandshake12):
class UserMappingOverflow12PFS(UserMappingOverflow, NormalHandshake12PFS):
'''As with UserMappingOverflow but in PFS TLSv1.2 hello'''
pass


class ClientAuthzNull(NormalHandshake):
'''Send empty client authz extension in hello'''

def make_client_authz_hello(self, value):
client_authz_ext = Extension.create(
extension_type=7,
data=value)
return self.make_hello([client_authz_ext])

def test(self, sock):
logging.debug('Sending Client Hello...')
# normal extension has an array, don't send anything
sock.write(self.make_client_authz_hello(b''))


class ClientAuthzNull12(ClientAuthzNull, NormalHandshake12):
'''Send empty client authz extension in TLSv1.2 hello'''
pass


class ClientAuthzNull12PFS(ClientAuthzNull, NormalHandshake12PFS):
'''Send empty client authz extension in PFS TLSv1.2 hello'''
pass
61 changes: 61 additions & 0 deletions tests/test_probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3139,3 +3139,64 @@ def test_test(self):
b'\x00\x06'
b'\x00\x06\x00\x02'
b'\x02\x40'])


class TestClientAuthzNull(unittest.TestCase):
def test_test(self):
probe = ClientAuthzNull()
sock = MockSock()

probe.test(sock)

self.assertEqual(sock.sent_data,
[b'\x16\x03\x01\x00?'
b'\x01\x00\x00;'
b'\x03\x01' +
RANDOM_STR +
b'\x00'
b'\x00\x0e' +
DEFAULT_CIPHERS_STR +
b'\x01\x00'
b'\x00\x04'
b'\x00\x07\x00\x00'])


class TestClientAuthzNull12(unittest.TestCase):
def test_test(self):
probe = ClientAuthzNull12()
sock = MockSock()

probe.test(sock)

self.assertEqual(sock.sent_data,
[b'\x16\x03\x01\x00W'
b'\x01\x00\x00S'
b'\x03\x03' +
RANDOM_STR +
b'\x00'
b'\x00&' +
DEFAULT_12_CIPHERS_STR +
b'\x01\x00'
b'\x00\x04'
b'\x00\x07\x00\x00'])


class TestClientAuthzNull12PFS(unittest.TestCase):
def test_test(self):
probe = ClientAuthzNull12PFS()
sock = MockSock()

probe.test(sock)

self.maxDiff = None
self.assertEqual(sock.sent_data,
[b"\x16\x03\x01\x00\x8f"
b"\x01\x00\x00\x8b"
b"\x03\x03" +
RANDOM_STR +
b"\x00"
b"\x00^" +
DEFAULT_PFS_CIPHERS_STR +
b"\x01\x00"
b'\x00\x04'
b'\x00\x07\x00\x00'])

0 comments on commit 77cf1ca

Please sign in to comment.