Archivos por Etiqueta: stunnel

Apache: PROXY protocol for Amazon ELB (Elastic Load Balancing)

If you want to use Apache 2.2 / 2.4 behind a Amazon ELB (Elastic Load Balancing), HAproxy, Stunnel, Stud o anything similar, you will have seen that in the logs appears IP of ELB instead of the remote client, and filter by IP is a double problem.

The module “remoteip” does not solve the problem. Amazon ELB, HAProxy and others support “PROXY protocol”, that helps to fix this issues working behind proxys.

The protocol look similar to:

PROXY TCP4 10.1.2.3 192.168.0.11 56324 443\r\n
GET / HTTP/1.1\r\n
Host: www.acme.com\r\n
Accept: */*\r\n
Connection: close\r\n
\r\n

But Apache currently does not support out-of-the-box. So following the philosophy of Do-It-Yourself, here is the source code (beta):

mod_myfixip.c in Github (for Apache 2.4)
mod_myfixip.c in Github (for Apache 2.2)

UPDATE (2015.01.17): Seems that AWS-ELB don’t always send PROXY header in only one packet / TCP-frame (in some cases data is received fragmented, now the module handle this behavior).

References:
ElasticLoadBalancing: Enable Proxy Protocol
PROXY protocol

Java: Simple Bouncer

forward

Si alguna vez has tenido un servidor en una DMZ seguramente habras usado rinetd o stunnel, esta aplicacion es una version simplificada de stunnel para tuneles SSL o una version del rinetd con algunas funcionalidades extra (loadbalancing o failover de conexiones) en menos de 550 lineas de codigo (Java).

El codigo fuente en GitHub: SimpleBouncer

A %d blogueros les gusta esto: