views:

1377

answers:

1

I need a Reverse Proxy to front both Lablz Web server and SSL VPN Adito (SSL Explorer fork) by sitting on one IP/port. Failed to achieve that with Nginx. Failed to use Adito as a generic reverse HTTP proxy.

Can HAProxy fall back to being a TCP proxy if it does not sense HTTP traffic? In other words can it fall back to Layer 4 if its Layer 7 inspection determines this is not HTTP traffic?

Here is my setup

  • EC2 machine with one public IP (Elastic IP).
  • Only one port is open - 443.
  • Stunnel is sitting on 443 and is passing traffic to HAProxy (I do not like to use Stunnel but HAProxy does not have full support for SSL yet, unlike Nginx).
  • HAProxy must be configured to pass some HTTP traffic to one server (Apache server which fronts the SVN server) and the rest of the HTTP traffic to our Lablz Web/App server.
  • All non-HTTP traffic must be forwarded to Adito VPN.
    • This traffic is:
      • VNC, NX, SMB
      • ... and all other protocols that Adito supports

I can not rely on source IP address or port to split traffic into HTTP and non-HTTP.

So, can such config be accomplished in HAProxy? Can any other reverse proxy be used for this? Let me know if I am not thinking right about HAProxy and an alternative approach is possible.

BTW, Adito SSL VPN is amazing and if this setup works we will be able to provide Lablz developers with a fantastic one-click single-login secure VNC-over-HTTPS access to their boxes in the cloud.

No solution exists for this but via Adito - please prove me wrong. But please do not say that VNC over SSH is better. Yes, VNC-over-SSH is faster, more secure, but also is much harder (for our target user base) to setup and presumes that user is behind the firewall that allows outbound traffic on port 22 (not always the case).

Besides, Adito is much more than the remote access gateway - it is a full blown in-browser VPN, a software distribution platform and more. I am not associated with Adito guys - see my Adito post on our Lablz blog.

A: 

OK, first off, I'd use a simple firewall to divide all HTTP from NON-HTTP traffic. What you need is packet inspection to figure out what it is that is coming in.

Neither haproxy or nginx can do that. They are both made for web traffic and I don't see how they could inspect traffic to guess what it is that they are dealing with.

Update: Looked into this it a bit and with iptables you could probably use string matching to devide the traffic. However, that's all tricky, especially with the encrypted nature. A friend of mine discovered l7-filter and this looks like what you need. Let me know if this helps.

Till
Till, thanks for a suggestion. I am looking at L7-filter which as I understand can use regular expressions to identify application protocols, including HTTP. L7-filter gets packets from IPTABLES and gives them back to IPTABLES. L7-filter inspects first bunch of IP packets on every TCP connection and based on regexp matching marks each packet. This mark can then be used by IPTABLES to forward marked packets to a proper IP/PORT. Sounds great in theory, but seems very complex to setup - at least for my level.
Gene Vayngrib
Till, HAProxy can proxy any TCP traffic, this is why I thought it could be possible for it to detect HTTP and non-HTTP traffic and split them up. But after studying HAProxy docs I could not find a way - thus I asked a question here at stackoverflow.Nginx does not proxy ant TCP protocol, only the specific ones it supports, like HTTP, SMTP - thus you are right - it can not be used.l7-filter's current HTTP matching pattern uses HTTP response, not request - thus it not suitable to route traffic. May be new l7-filter regexp pattern for HTTP can be created...
Gene Vayngrib
I am exploring the possibility to use DeleGate (http://www.delegate.org) which is a full-featured Proxy - both Forwarding and Reverse Proxy. It supports dozens of application protocols and can serve as a generic TCP proxy for any application protocol.
Gene Vayngrib