Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


SOCKS5 proxy server with HAProxy and Lua
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

SOCKS5 proxy server with HAProxy and Lua

Over the past few days I tried to implement a SOCKS5 server with HAProxy and Lua. The goal was to make a simple and fast SOCKS5 proxy server that leverages the performance, reliability and versatility of HAProxy. It turned out to be fairly simple and easy to write a Lua script that speaks the SOCKS protocol, and leave the connections to HAProxy afterwards.

Here is the GitHub gist that includes the Lua script and HAProxy example config:
https://gist.github.com/trimsj/da37da55994a07bc1c602a22f13cbdb4

It requires a recent (higher than 1.9) haproxy, and the lua-socket module (to perform DNS resolution), which can be found from most distributions. It supports IPv6 and remote DNS, but doesn't support any kind of authorization (in my case that's left to the ACL in HAProxy). The example config will open a proxy without any authorization and binds to all interfaces, so make sure to adjust the configuration before you put it to work.

Thanked by 1fatchan
Sign In or Register to comment.