-
-
Notifications
You must be signed in to change notification settings - Fork 107
Description
I'm working on a modification to sslproxy to use addresses provided using the haproxy PROXY v1 protocol from the initial client TCP connection to allow easier redirection and load distribution without the need for complicated iptables which isn't available in all environments.
My test environment is the following
┌───────────┐
│sslproxy │
└─────▲─────┘
│
│
│
┌─────▼─────┐
┌────────┐ │Python │ ┌───────┐
│ Client ◄───────►Redirector ◄───────►Server │
└────────┘ └───────────┘ └───────┘
All connections are made successfully; sslproxy reports TLS negotiation to client and server; the divert socket in the python redirector shows all data, unencrypted, and has no issues passing messages. tcpdump on the lo interface shows diverted responses coming back from sslproxy are received and sent back to sslproxy as well. However, sslproxy never passes the encrypted data back to the client socket.
I'm really struggling to debug this and would appreciate some thoughts.
The main code change is to prototcp_fd_readcb
. I've added a handler that will peek the receive buffer, parse the PROXY header if present, and override srcaddr/dstaddr if the header is parsed successfully. In pxy_conn_init
I have to bypass dstaddr handling as well.
The only odd thing I see in the packet capture is that there is 2 TCP connections sent from sslproxy to the divert port. The first remains unused/idle while the second receives the SSLproxy header and is where the decrypted traffic is sent back to.