Page MenuHomePhabricator

SSL error connecting to frdb1003 using python script
Closed, ResolvedPublic

Description

We're relying on the pymysql package in test results scripts on frdev1002 to connect to databases on frdb1003. However this no longer works

import pymysql, os
db = pymysql.connect(host='frdb1003', read_default_file=os.path.expanduser('~/.my.cnf'))

gives
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'frdb1003' ([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'frdb1003'. (_ssl.c:1123))")

I saw a mention in @Dwisehaupt's email "Maintenance week day 1" that SSL connections are now enabled for most db connections. Any idea how we should do this in Python? It looks like pymysql has a variety of parameters for ssl in its connection method

Related Objects

Event Timeline

Pcoombe triaged this task as Unbreak Now! priority.Nov 1 2023, 3:04 PM

Bumping to UBN since this blocks us from doing any banner testing

@Pcoombe Sorry--this was indeed caused by the SSL connection requirement. It's an easy fix--just change "frdb1003" to "frdb1003.frack.eqiad.wmnet" in your pymysql.connect line and it should work.

Change 970800 had a related patch set uploaded (by Pcoombe; author: Pcoombe):

[wikimedia/fundraising/analytics@master] Fix host name in fr_util.py

https://gerrit.wikimedia.org/r/970800

Change 970800 merged by Pcoombe:

[wikimedia/fundraising/analytics@master] Fix host name in fr_util.py

https://gerrit.wikimedia.org/r/970800

Pcoombe claimed this task.
Pcoombe removed a project: Patch-For-Review.

Worked perfectly, thanks @Jgreen !