[MXS-3328] Persistent Connections on Maxscale 2.5 seem to break client authentication Created: 2020-12-08 Updated: 2020-12-11 Resolved: 2020-12-11 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | mariadbbackend, readwritesplit |
| Affects Version/s: | 2.5.5 |
| Fix Version/s: | 2.5.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | George Diamantopoulos | Assignee: | markus makela |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | galera | ||
| Environment: |
Debian Buster 10.7 |
||
| Sprint: | MXS-SPRINT-121 |
| Description |
|
I'm seeing weird authentication failures for clients with 2.5.5 and a 3-node mariadb 10.5.8 galera cluster as backend in a testing setup when persistent connections are enabled. This doesn't seem to happen with 2.4.x. The issue manifests as follows. Soon after receiving connections, newer client connections start to fail. In the log the following is logged:
However there's no mysql client at 10.0.63.186 configured to use the username 'redmine'. This user is used in a client on another IP. Similarly, errors appear for that other user as well. In short, it seems that usernames and hosts are mixed up by maxscale when using persistent connections. Here's the relevant configuration used for this test: General:
Servers:
Monitors:
Routers:
Listeners:
Lastly, I was wondering whether I'm available for more testing if needed. Thank you. |
| Comments |
| Comment by markus makela [ 2020-12-09 ] |
|
One possibility is that proxy_protocol is related to this. If you can test whether the behavior changes when you disable it, we'd know more. |
| Comment by George Diamantopoulos [ 2020-12-09 ] |
|
One possibility is that proxy_protocol is related to this. If you can test whether the behavior changes when you disable it, we'd know more. I'm not sure it makes much sense to test for this. The way I understand it, with proxy_protocol disabled, all backend connections will appear to mariadb as originating from maxscale's IP, so the user/host mixup won't happen anyway. Right? |
| Comment by markus makela [ 2020-12-09 ] |
|
Yeah, I think this would just be to confirm that it's the problem we expect: proxy_protocol causes the client IP to remain the same it is when the connection is originally created. I think we're forced to change it in the current releases so that when proxy_protocol is configured for a server, we have the persistent connection pool is disabled. This will prevent this problem from happening alongside with any other possible problems. To make it possible to use pooled connections with proxy_protocol, we'll have to partition the connections by the client IP. |
| Comment by George Diamantopoulos [ 2020-12-10 ] |
|
Thank you for clarifying. Here's some more information revealed during testing:
To sum up, the following tests have been performed and are presented here for your convenience:
So if I understand correctly, persistent connections were never meant to be used with proxy protocol at the same time? Or is this something that was introduced during Maxscale 2.5 development? |
| Comment by markus makela [ 2020-12-10 ] |
|
Yes, persistent connections should never be mixed with proxy protocol. This should also be the case for 2.4 and it is odd that your testing didn't reveal the same problem there as well (unless it's a typo). |
| Comment by George Diamantopoulos [ 2020-12-10 ] |
|
Nope, not a typo, I also have no explanation for this if that's the case... |
| Comment by markus makela [ 2020-12-10 ] |
|
Actually, this should work in 2.4 as it still partitioned the persistent connections by the username and client IP address. This was removed in 2.5 as this partitioning is mostly useless as a COM_CHANGE_USER is sent to change the user. Partitioning the pool by username and IP only reduces the effectiveness of it in normal use-cases. The only exception where this partitioning is required would be when proxy_protocol is on but this was not known at the time the change in 2.5 was done. I think this is something we should fix in 2.5 by conditionally partitioning the pool if proxy_protocol is on. Since this is what 2.4 does in all cases, the version in 2.5 should still be a performance improvement. |