Welcome! Log In Create A New Profile

Advanced

Regular Expression Parsing of TCP Session

Posted by myLanguage 
Regular Expression Parsing of TCP Session
August 07, 2011 12:16AM
Hi,

** This is a very important project, with a very short timeline. If
any developers are interested in building this, and potentially
releasing it as open source, please contact me asap! My contact
details are included below. **

I'm attempting to configure a reverse TCP proxy which is able to
provide seamless authentication for a partner company's API. The API
has no per-user granular access control capability, so I'm hoping to
add this control by inspecting the first non-handshake packet (after
SYN, SYN/ACK, ACK).

I'm looking for the value between <uid> and </uid>, which is always
sent as the first non-handshake packet.
Possible regex: <uid>(.*)</uid>

So far, I've successfully compiled nginx w/ TCP Proxy module,
configured it to allow me to access partner API, and it works great.
Now, I'm attempting to read the first non-handshake packet, looking
for <uid>(.*)</uid>
Once I have this uid value, I will use drizzle module to connect
directly to MySQL cluster to see if uid has access to API. If it has
access, nginx should simply forward the request. If not, nginx should
block the request with an error message.

I've tried looking at form-input module, because it is able to parse
POST variables. I've also looked at HTTP Header parsing code in nginx
core, but I haven't figured out how to get pointer to TCP payload. I
believe once I have a pointer, it will be possible to find the value
I'm looking for.

Another note - If the packet is not #4 in the stream, I don't want to
process it. Otherwise it will become very CPU intensive.


I'm a complete newbie to nginx, however I am already quite impressed,
and I would like to support future development of the product (both
open source and paid).

Cheers!

--
Andrew Lauder
CEO, Founder
myLanguage, Inc.
http://www.myLanguage.me

t: +1 408 982 6515 | f: +1 408 856 2534
e: andrew@mylanguage.me
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 133
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready