how to get the query by setting up a proxy like greensql
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to get the query by setting up a proxy like greensql
Hi,
I was willing to create proxy in between the web app. and MySQL database so that I can do some modification before sending the query to the DB. But how to grep the query in the middle isn't working in the head yet.
I found a tool named 'greensql' which captures the query in the middle but couldn't get how they are doing it.
GreenSQL works like any other proxy... you point your client at the proxy port, and the proxy itself points at the server port.
The way I have it set up is as follows...
Apache/PHP -> GreenSQL (3305) -> MySQL (3306)
GreenSQL parses the incoming queries and looks for obvious injection attempts, escapes and so on, and either sanitises them or blocks them accordingly. You will not notice any slowdown, unless your server is already at or near capacity.
Ah... I think I misinterpreted the point of your post. You want to modify queries yourself, before they hit the server, right?
I suppose you could string together a listener/stream editor/connector using netcat and grep/sed/awk. Or you could write one in Perl/Ruby/<ILoC>. Not hugely difficult.
I was just looking is there any other way besides listening in the stream or how the greensql is using for this. What if the mysql in setup using SSL so that way it will be hard to get the query as it won't be in plain text.
In order to do any of this, access to the box would be necessary. GreenSQL simply proxies connections between 3305 and 3306. Any solution you come up with would have to do something similar.
Given that you have access to the box, SSL is no barrier, as you would have access to the keys too and setting up an SSL proxy (man in the middle) would be trivial.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.