Skip to content

Commit

Permalink
PYTHON-1331 Recreate expired SSL certificates for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-antoniak committed Oct 1, 2024
1 parent 6e2ffd4 commit e313680
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 100 deletions.
4 changes: 1 addition & 3 deletions cassandra/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,15 +779,13 @@ def __init__(self, host='127.0.0.1', port=9042, authenticator=None,
self.ssl_options.update(self.endpoint.ssl_options or {})
elif self.endpoint.ssl_options:
self.ssl_options = self.endpoint.ssl_options
self._check_hostname = self.ssl_options.get('check_hostname', False)

# PYTHON-1331
#
# We always use SSLContext.wrap_socket() now but legacy configs may have other params that were passed to ssl.wrap_socket()...
# and either could have 'check_hostname'. Remove these params into a separate map and use them to build an SSLContext if
# we need to do so.
#
# Note the use of pop() here; we are very deliberately removing these params from ssl_options if they're present. After this
# operation ssl_options should contain only args needed for the ssl_context.wrap_socket() call.
if not self.ssl_context and self.ssl_options:
self.ssl_context = self._build_ssl_context_from_options()

Expand Down
Binary file modified tests/integration/long/ssl/127.0.0.1.keystore
Binary file not shown.
21 changes: 21 additions & 0 deletions tests/integration/long/ssl/ca-cert
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDXzCCAkegAwIBAgIUNaZrKLGgSDvEMiIZE401OeWIYXQwDQYJKoZIhvcNAQEL
BQAwPzEQMA4GA1UEAwwHcm9vdC1jYTEQMA4GA1UECwwHZHJpdmVyczEMMAoGA1UE
CgwDb3NzMQswCQYDVQQGEwJVUzAeFw0yNDA5MjQwODUwMThaFw0zNDA5MjIwODUw
MThaMD8xEDAOBgNVBAMMB3Jvb3QtY2ExEDAOBgNVBAsMB2RyaXZlcnMxDDAKBgNV
BAoMA29zczELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQCK9qGc3CboY44t8K28q3GEVGsJieT5b3qNpsI1HBmJ7L6u0z2+qNCq6YS8
zT4Dyf/E0lIluh1hfnHF0ZuPOc9tODZPuqGJrdSHDCgoh0pGgSG5Nne4YT/RLwtG
/F1DXVFBZRMvxqo+A5Td7R2jk/iAy0pIQNghxYOYyaq8bGV/CbkEgS3OUto3yA0F
UPyJLuBKlvw5/1gNOyWy2HRUHIrwMBSuFZ5cgjewWH8Q9WoFcaHvT5gh0+Rzffn9
TEfuwsFDS8e9QMc6MmicCZ5y7xk3/J1ZRbk9ovh/AA7dhS9Q4LFmFr9e5MH7Yafu
LWk+12gRItC/W/r95PQF03dSPaQdAgMBAAGjUzBRMB0GA1UdDgQWBBRnQujD5pLP
J5ZalKZ0Ij3Zi0uJTjAfBgNVHSMEGDAWgBRnQujD5pLPJ5ZalKZ0Ij3Zi0uJTjAP
BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQByyImDmYFnn/D3gLCy
F6ZrOV2xywDk36rfSfrpRK29E++3PBMvl/e5UrDQaI5dsoNjYiAO4J3xZqA0DQan
/6Pf1x/SL04nZnMuY73UFBovtk2RzkFJFPv11+m8muWiS2aiL1IEd83tpGXGaVXY
cmj+iqCupQGdZf9Qz3RhXi1Ye7m7joszYWazFCyAg2FtkwXeWBZcmRQFv3V3R6lt
cyZKLFjKCa8hyeEjYoTC53Fd9ibTdIEWtSWSvgGTDuKD1AjFvr92iYHaw3xsv1WF
8QXU6SjDaJfs7Crzm0B+5eQTjIp7Dwt5FfB5RSnnewiMqaMpI9HKvgA/Ru0iEb/8
ANcF
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions tests/integration/long/ssl/ca-key
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCK9qGc3CboY44t
8K28q3GEVGsJieT5b3qNpsI1HBmJ7L6u0z2+qNCq6YS8zT4Dyf/E0lIluh1hfnHF
0ZuP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IJn3FvX2fcJ/aj1MX7LxXFTvDBOPMBD5
slYXzFiL6vCmrJG+2405mE80DBXmw2xzQ0qPZLYFA0fYc3KKoaFtF0hn4QKBgQCn
wRf4IbnbEVcrT+Agm7i4xDb6Ykirh2/ZRURDo6Yc86h1LkuFhCnEcGqgeZPWP6CA
g/WAjonP0AZfIKs7vXOfAE3pzhgZDNr9WcKlNYQd+zMQNR0vYrl+0l39ubC2VjHO
1cl5XxyFpMMICFmy34ALVXdzt1+fPBHDR/85rwyZTQKBgFC9VXukiHiF0JVRHJwh
WFi16M4wAh7juPQjskAXK6USkuUZMSkONpQqFwVVKbxp4f+F3VKtDRWUYtiuZDgW
AosCimrs16KxTV1pjgJCE/C2b4ANAApStxZxzdN3qnwS5myNYEgU9cSNwfmKSoes
XOMwluTpn+FdmDye+Lw7nmoM
-----END PRIVATE KEY-----
Binary file modified tests/integration/long/ssl/cassandra.truststore
Binary file not shown.
21 changes: 21 additions & 0 deletions tests/integration/long/ssl/client.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDYTCCAkmgAwIBAgIUGtLp1v/4I4YFhA1t7Y4kb2LPkXYwDQYJKoZIhvcNAQEL
BQAwPzEQMA4GA1UEAwwHcm9vdC1jYTEQMA4GA1UECwwHZHJpdmVyczEMMAoGA1UE
CgwDb3NzMQswCQYDVQQGEwJVUzAeFw0yNDA5MjQwODUwMzlaFw0zNDA5MjIwODUw
MzlaMEExCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNvc3MxEDAOBgNVBAsTB2RyaXZl
cnMxEjAQBgNVBAMTCTEyNy4wLjAuMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBALj5zQWQP+Q1Zsrvnf0lFOmIMUwG3CnkKYIH+3w6UCBTimnqYUdWmDxX
rx2EMgOCkpWAQ+IdnPNygJdSdBiiv4Io6mCCtHYXQOLdvofQF+O7e7FTlWLAzaJF
3Sk7wHJGk2Xwm5uKr/EXtr7vT1a0WzNmPmdDMR5CBx/urnSob4v4wgWaXeJEQVGR
Q2Oe2cps2dl0kieq0iFdaaHxlaHFbODhBm7EmRPHmjPbEmTBkVlAXwvP9TWzf0K+
XvguJ0ePadsG84PslheY7Vw0Ul6j2neshZR0aO/pjVDNRzTCtG2fwhJG+D7zwgcU
kxbDgmeVWJIgo4Z3C+jxfn2yKkO/i2UCAwEAAaNTMFEwDwYDVR0RBAgwBocEfwAA
ATAdBgNVHQ4EFgQU+jUkfI5lW5C5KYPWlNpa0RESilwwHwYDVR0jBBgwFoAUZ0Lo
w+aSzyeWWpSmdCI92YtLiU4wDQYJKoZIhvcNAQELBQADggEBAIKE5Xk52FbSz3h5
ecl8GvdJlYrABzIXns41IV4ThJM5ki4Y2WVOk+t2dm74p61XHkCLaO+OltHuGNAO
dzuFnkEAEp6bILJQZ+bsSCn5mBwj5b6lup0n8Jdf01Gr6wmUemf4joiBMKz3J0JL
JVg56l5Wsz9MGIKra49z735rOE+VR+WgcZM95xHwXqN++jI4+c7GVuG4ShhHqpfV
mBS6bJ+pwxa3bClNYg+e9PWvEzzN6m6jg4Mgnxgz8Moj4BiNelxr+7QQCg8f6Ide
DNhwU/irKXukd0/HMzNvS9z6SsgK3V51txl0lah77T5Wjo5u310XbcU7/uAgqc35
OcCwg7Q=
-----END CERTIFICATE-----
19 changes: 0 additions & 19 deletions tests/integration/long/ssl/client.crt_signed

This file was deleted.

56 changes: 30 additions & 26 deletions tests/integration/long/ssl/client.key
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
Bag Attributes
friendlyName: 127.0.0.1
localKeyID: 54 69 6D 65 20 31 37 32 37 31 36 37 38 32 34 36 37 31
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCeukTeDyltCfa1
VWJ1fZbDWuH/pggfoQZb2Fcw78XnTpF4yu6/4CWKVzsHaw+kZEMpe6nLbchyl8w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ssl/client_encrypted.key
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,7288A409E846EBE2DE421B77598DAF98

ahiUSf+k9POIEUJb5BGbQ6knk4+FtTz+e+6fouqVc4Lq+RXR9f0pFBi9eDEkFNiN
AcUjLkxh+3TmihTZJprqXSbQ3jacwbnwDOFgtZE3PxoA1heHxADaKCNr+Ph0lC/T
3cIzsoIZ6slk+3n6ERieZRdmvoMH1SY8nXKT5+bLMR4RIjw1y7h26MRhjQS+lXaX
Asd5EOGROCIgefeEBGHAbrlg0FoHy7slqVBxuZphTHKtyK/VK4fRLt6doUzBu5GJ
T2jdrqJCWr5PRn3bAqMemJWxDhZLX4DyNDQPn8riZ8jMbwPOVUSnF8B8re1tNkQ0
CsH77sYIIjmPdizCdvj91+jH6o7MRCZPvky+PHG/9G5WsPiw5W1i/nrPemT1XJyy
oPRc/fMFfbHmW3HCGqgv2/6Wg+17un/a6UyzXsbNdhDZLCVqtAQ7PSv83z5oUazT
djzFHgxSqRknUY0lOUvP8Rni67MG+Rcksj9HgszhLoC0be64IX0Ey5oc5+pBYrf9
FVEPsuyyu4aDSRYYATC2E1V/EQRwcvpKEZNFTbqMpQhjrWtlBM/GgQnQBeQdLAGX
yefDSzkH31y5gcdgHLElriWwbHHbcaAmf3e15W94YHgTytJBsQ9A19SmtmgUmo4h
jaFoUooM5mFA8hc/snSe2PdkEefkzS72g8qxa//61LTJAAkVk43dYjoqQ34wq6WR
OB4nn/W2xlfv/ClZJTWf8YvQTrQptJY5VQq/TTEcrXy67Uc0wRHXZK2rTjKeyRj9
65SkyyXhMopWEl2vX25ReITVfdJ0FgjqI/ugYSf25iOfJtsk+jgrtrswZ+8F2eMq
iAQ+0JSiYmlot2Pn1QCalLjtTz8zeMfXPyo5fbKNMdp52U1cPYld90kUGHZfjqju
GmY/aHa6N8lZGxj8SC/JM36GawaGKe4S/F5BetYJOp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zqAGqutFuepMF8lGmVUw6g5MOEf2goIjdQ6PgcWHAFT//O5RrQEE86
I4lRU0wn/kZfgPWOxMoghVTLZOLH14/pooMZwph+zLr6y3qp5QBlcPhZZETTo4B+
iLEEoTPspJ/RsbI9OCoxTpQ/VrRKbHNUGOeI4HULEq04y0cZ+Vaaknktw2/xhUkk
78Mpj14fYmgp57jfAj8Xq8LkBPdW/FWMG+zfElu4U8Kz/Fgk2WSmj54idOu/zZUe
Y97ARqyP0upUL4PlE8glAFxbpWcwjKivoc9p2xb/gfomObeLzvxPXYzWXKqYc8dV
ZbgiJwDLOpIdBy+46sAkHXbhXLQ4+FpVEL4QohcPuPnuQoRNTjoz5wU=
-----END ENCRYPTED PRIVATE KEY-----
31 changes: 31 additions & 0 deletions tests/integration/long/ssl/generate_certificates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# create new CA key and certificate
openssl req -new -newkey rsa:2048 -days 3650 -x509 -subj "/CN=root-ca/OU=drivers/O=oss/C=US" -keyout ca-key -out ca-cert -nodes

# create keystore and key-pair for DSE server
keytool -genkey -keyalg RSA -keystore 127.0.0.1.keystore -validity 3650 -storepass cassandra -keypass cassandra -dname "CN=127.0.0.1,OU=drivers,O=oss,C=US" -ext "SAN=IP:127.0.0.1" -alias 127.0.0.1 -storetype pkcs12

# export DSE server key from keystore
openssl pkcs12 -in 127.0.0.1.keystore -nodes -nocerts -out client.key -legacy -passin pass:cassandra

# create encrypted client key
openssl rsa -aes256 -in client.key -passout pass:cassandra -out client_encrypted.key

# create CSR
keytool -keystore 127.0.0.1.keystore -alias 127.0.0.1 -certreq -file client.csr -storepass cassandra -ext san=ip:127.0.0.1

# sign CSR with CA key
openssl x509 -req -CA ca-cert -CAkey ca-key -in client.csr -out client.crt -days 3650 -copy_extensions copyall -passin pass:cassandra

# import CA certificate to DSE node keystore
keytool -keystore 127.0.0.1.keystore -alias CARoot -import -file ca-cert -storepass cassandra -noprompt

# import signed certificate to DSE node keystore
keytool -keystore 127.0.0.1.keystore -alias 127.0.0.1 -import -file client.crt -storepass cassandra -noprompt

# import CA certificate to DSE node truststore
keytool -keystore cassandra.truststore -alias CARoot -import -file ca-cert -storepass cassandra -noprompt

# cleanup
rm client.csr
19 changes: 0 additions & 19 deletions tests/integration/long/ssl/rootCa.crt

This file was deleted.

6 changes: 3 additions & 3 deletions tests/integration/long/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
SERVER_TRUSTSTORE_PATH = os.path.abspath("tests/integration/long/ssl/cassandra.truststore")

# Client specific keys/certs
CLIENT_CA_CERTS = os.path.abspath("tests/integration/long/ssl/rootCa.crt")
CLIENT_CA_CERTS = os.path.abspath("tests/integration/long/ssl/ca-cert")
DRIVER_KEYFILE = os.path.abspath("tests/integration/long/ssl/client.key")
DRIVER_KEYFILE_ENCRYPTED = os.path.abspath("tests/integration/long/ssl/client_encrypted.key")
DRIVER_CERTFILE = os.path.abspath("tests/integration/long/ssl/client.crt_signed")
DRIVER_CERTFILE = os.path.abspath("tests/integration/long/ssl/client.crt")
DRIVER_CERTFILE_BAD = os.path.abspath("tests/integration/long/ssl/client_bad.key")

USES_PYOPENSSL = "twisted" in EVENT_LOOP_MANAGER or "eventlet" in EVENT_LOOP_MANAGER
Expand Down Expand Up @@ -486,7 +486,7 @@ def test_cannot_connect_ssl_context_with_invalid_hostname(self):
password="cassandra",
)
ssl_context.verify_mode = ssl.CERT_REQUIRED
ssl_options["check_hostname"] = True
ssl_context.check_hostname = True
with self.assertRaises(Exception):
validate_ssl_options(ssl_context=ssl_context, ssl_options=ssl_options, hostname="localhost")

Expand Down

0 comments on commit e313680

Please sign in to comment.