-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
how to connect from a client machine with an ssl connection and don't have access to the cert and key #1014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Assuming localhost, with self-signed certs, and server config
this works import pymysql
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.VerifyMode.CERT_NONE
conn = pymysql.connect(user='root', host='127.0.0.1', ssl=ctx) Obviously you can elide the disabling of verification if your certs are signed by a public CA. Appending cursor = conn.cursor()
cursor.execute("SHOW SESSION STATUS LIKE 'Ssl_cipher';")
for row in cursor:
print(row) gives the following when I tested
This seems to me that the documentation for the PyMySQL/pymysql/connections.py Line 129 in eb108a6
to make it more obvious this feature is available since 098a404 😄 I'd also been wondering about this for a number of months |
Ok. A shorter working example. Not sure if if violates some knowledge of the internals, but this works as at writing. import pymysql
conn = pymysql.connect(user='root', host='127.0.0.1', ssl={"verify_mode": None}) or any non-empty |
For the documenting of |
Describe the bug

A clear and concise description of what the bug is.
don't have access to the cert and key, is there any way to simple add ssl=true ?
To Reproduce
Complete steps to reproduce the behavior:
Schema:
Code:
Expected behavior
A clear and concise description of what you expected to happen.
Environment
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: