Comment 4 for bug 2003835

Revision history for this message
Trent Lloyd (lathiat) wrote :

I have narrowed this down to.. when you connect via mysql-router only, on 127.0.0.1 (TCP)

The code at /usr/lib/python3/dist-packages/pymysql/_auth.py:254 in caching_sha2_password_auth expects to receive 0x01 (checked by pkt.is_extra_auth_data) and then the public key. Instead it's received 0x2D.. and then the same public key. This causes the code there to error out.

I have not yet figured out why it's getting 0x2D or what that means.

Likely candidate upstream commits:
https://github.com/mysql/mysql-server/commit/e31f9f26e26d428a577deb9b0b9d07f652045ccb
"Bug#34778017 authenticating over unix-socket fails"

https://github.com/mysql/mysql-server/commit/099e4529acc46657b887961ae590b8090ff2c1fc
"Bug#34556764: Contribution by Facebook: Fix sha256_password_auth_client_nonblocking"

08:47:03.952527 line 254 if not conn.server_public_key:
08:47:03.952638 line 255 pkt = _roundtrip(conn, b'\x02') # Request public key
08:47:03.953153 line 256 print(hex(pkt._data[0]))
0x2d
08:47:03.953290 line 257 print(pkt._data.decode('ascii'))
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkrOn8+wodDNTomkEa2jT
t6YIXXSwX9MEWnwEdXiSwCk3LW46l881lg7N1yox3KtgjrNn6X1aeHUGzrDcTGy+
Sz5ErhJZzWoHLMDt6IAfgPswgrH89NUkKadHTyk02E+fV4UL4k9LGDg6pYAdLU1w
EqGUCiugoQ6YNh8JAhfk3Y+haP1mhoN5JseoYvOc0o/D4R3nEOMl+a2JyNrwOVqq
JW5Z1Rxa9eByd/yjb+Hix5jNZf2S65J6i9zbDweSl06rS3EQXEc0k6mxpBhPMxkM
R9nbO86pD0yc1JUbwDam1nLXod2hzoHzHBUbbOQ4HDK+7nQ8VAZv2zG+j7tx8s0l
2wIDAQAB
-----END PUBLIC KEY-----

08:47:03.953448 line 258 if not pkt.is_extra_auth_data():
08:47:03.953534 line 259 raise OperationalError(
08:47:03.953607 line 260 "caching sha2: Unknown packet for public key: %s" % pkt._data[:1]
08:47:03.953683 line 259 raise OperationalError(
08:47:03.953757 exception 259 raise OperationalError(
Exception:..... pymysql.err.OperationalError: caching sha2: Unknown packet for public key: b'-'
Call ended by exception