LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-27-2010, 11:01 AM   #1
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 525

Rep: Reputation: 39
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.

Thanks.

Last edited by tanveer; 02-27-2010 at 11:13 AM.
 
Old 03-02-2010, 09:59 AM   #2
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
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.

I highly recommend it.
 
Old 03-02-2010, 10:02 AM   #3
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
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.
 
Old 03-09-2010, 10:32 PM   #4
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 525

Original Poster
Rep: Reputation: 39
great. Thanks for your reply.

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.
 
Old 03-10-2010, 05:10 AM   #5
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Query related to setting permissions in RHEL5 saagar Linux - Newbie 2 05-22-2009 09:23 PM
LXer: Preventing MySQL Injection Attacks With GreenSQL On Debian Etch LXer Syndicated Linux News 0 10-28-2008 05:40 PM
LXer: Protecting your MySQL database from SQL injection attacks with GreenSQL LXer Syndicated Linux News 0 08-25-2008 07:00 PM
FTP Proxy(?) Setup Query Welsh Pablo Linux - Server 2 10-18-2006 03:15 AM
setting proxy precioso77 Linux - Networking 1 09-14-2003 07:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration