[MXS-2252] Proxy Protocol not displaying originating IP address in SHOW PROCESSLIST Created: 2019-01-07  Updated: 2020-08-25  Resolved: 2019-01-17

Status: Closed
Project: MariaDB MaxScale
Component/s: N/A
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Chris Calender (Inactive) Assignee: markus makela
Resolution: Not a Bug Votes: 1
Labels: None


 Description   

The newer proxy protocol appears to be working fine on the MaxScale side for authentication.

However, what is not working correctly is the display of the originating IP address via SHOW PROCESSLIST.

As I understand it, when proxy protocol is used (and enabled), the client IP address is stored in the proxy header and should be returned instead of the MaxScale IP address when looking at a connection via SHOW PROCESSLIST.



 Comments   
Comment by Vladislav Vaintroub [ 2019-01-09 ]

Exactly this use case is tested on buildbot, in mysql_client_test test (that fake IP address is returned, with proxy header)
ccalender, can you describe your environment better maybe, or supply a small client program that uses MARIADB_OPT_PROXY_HEADER, and does not work as expected?

Comment by Chris Calender (Inactive) [ 2019-01-09 ]

Remote Host:
192.168.1.160 / chris-laptop.cinci.rr.com

Server Host:
192.168.1.183 / chris-linux-laptop-64.cinci.rr.com

MaxScale Version: 2.3.2
MariaDB Version: 10.3.12

On Server Host:

MariaDB [(none)]> select @@global.proxy_protocol_networks;
+-----------------------------------------------------------+
| @@global.proxy_protocol_networks                          |
+-----------------------------------------------------------+
| ::1, 192.168.111.111, 192.168.1.160, 127.0.0.1, localhost |
+-----------------------------------------------------------+

Thus all should be working and configured properly.
MariaDB running on port 3306.
MaxScale RW Splitter Listener listening on port 4006.

On Remote Host:

1. If I connect to port 3306, I see the correct "host":

mysql -uroot -pmysql -h192.168.1.183 -P3306

MariaDB [(none)]> show processlist;
+-----+-------------+------------------------------------------+------+-----------+------+-----------------------------------------------------------------------------+------------------+----------+
| Id  | User        | Host                                     | db   | Command   | Time | State                                                                       | Info             | Progress |
+-----+-------------+------------------------------------------+------+-----------+------+-----------------------------------------------------------------------------+------------------+----------+
...
| 128 | root        | chris-laptop.cinci.rr.com:59552          | NULL | Sleep     |   15 |                                                                             | NULL             |    0.000 |
+-----+-------------+------------------------------------------+------+-----------+------+-----------------------------------------------------------------------------+------------------+----------+

Id 128 host = chris-laptop.cinci.rr.com (the correct remote host)

Also, if I check I_S, the same:

MariaDB [(none)]> select host from information_schema.processlist;
+------------------------------------------+
| host                                     |
+------------------------------------------+
| chris-laptop.cinci.rr.com:59552          |
...

However, if I connect to RW Splitter listener on port 4006:

mysql -uroot -pmysql -h192.168.1.183 -P4006

MariaDB [(none)]> show processlist;
+-----+-------------+------------------------------------------+------+-----------+------+-----------------------------------------------------------------------------+------------------+----------+
| Id  | User        | Host                                     | db   | Command   | Time | State                                                                       | Info             | Progress |
+-----+-------------+------------------------------------------+------+-----------+------+-----------------------------------------------------------------------------+------------------+----------+
...
| 129 | root        | chris-linux-laptop-64.cinci.rr.com:54414 | NULL | Sleep     |    4 |                                                                             | NULL             |    0.000 |
+-----+-------------+------------------------------------------+------+-----------+------+-----------------------------------------------------------------------------+------------------+----------+

Note that Id 129 host = chris-linux-laptop-64.cinci.rr.com (the host of MaxScale), whereas it should be the same as above

Same if I check I_S too:

MariaDB [(none)]> select host from information_schema.processlist;
+------------------------------------------+
| host                                     |
+------------------------------------------+
| chris-linux-laptop-64.cinci.rr.com:54414 |
...

Comment by markus makela [ 2019-01-15 ]

ccalender Does your maxscale.cnf have proxy_protocol=true in the server sections? Testing with SELECT USER() directly and via MaxScale gives the same results when proxy_protocol is enabled. Even localhost is correctly proxied when a connection is created from the same server where MaxScale resides.

Comment by Chris Calender (Inactive) [ 2019-01-16 ]

No, I did not have that variable set in my server sections. After adding it and restarting MaxScale, it began working as expected.

Thank you very much!

I apologize I overlooked this variable in the variables section of the manual.

Also, thank you for now adding it to the proxy protocol section of the manual!

Feel free to close this.

Generated at Thu Feb 08 04:12:46 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.