Skip to content

Commit

Permalink
allow client cert paths to be passed into client_ssl
Browse files Browse the repository at this point in the history
Also added a comment with a reminder for how to create self-signed certs.

Useful for playing with ssl configurations.
  • Loading branch information
Jim Fulton committed Jul 16, 2016
1 parent d209579 commit bcf292e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ZEO/tests/testssl.py
Expand Up @@ -345,11 +345,18 @@ def test_suite():
</zeo>
""".format(server_cert, server_key, client_cert)

def client_ssl():
def client_ssl(cafile=server_key,
client_cert=client_cert,
client_key=client_key,
):
context = ssl.create_default_context(
ssl.Purpose.CLIENT_AUTH, cafile=server_cert)

context.load_cert_chain(client_cert, client_key)
context.verify_mode = ssl.CERT_REQUIRED
context.check_hostname = False
return context

# Here's a command to create a cert/key pair:
# openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem \
# -days 999999 -nodes -batch

0 comments on commit bcf292e

Please sign in to comment.