Krydos Posted November 9, 2023 Posted November 9, 2023 I tested it out a bit myself, and here is what I came up with #!/usr/bin/python3.10 from __future__ import print_function import sys import mysql.connector from mysql.connector.constants import ClientFlag print("Content-Type: text/html\n\n") config = { 'user': 'krydos_test', 'password': '<removed>', 'database': 'krydos_test', 'host': 'tommy2.heliohost.org', 'client_flags': [ClientFlag.SSL] } cnx = mysql.connector.connect(**config) cur = cnx.cursor(buffered=True) cur.execute("show status like 'ssl_cipher'") print(cur.fetchone()) print("<br>") cur.execute("select * from test") result = cur.fetchall() for row in result: print(row) cur.close() cnx.close() You can see the script in action at https://krydos2.heliohost.org/mysql_ssl.py which is running on Johnny and connecting securely to a MySQL database on Tommy. Please note: There are no ca.pem or any other client keys or client certificates needed. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.