Squid Web Cache wiki

Squid Web Cache documentation

🔗 Feature: SOCKS Support

🔗 Details

Squid handles many HTTP related protocols. But presently is unable to natively accept or send HTTP connections over SOCKS.

The aim of this project will be to make http_port accept SOCKS connections and make outgoing connections to SOCKS cache_peers so that Squid can send requests easily through to SOCKS gateways or act as an HTTP SOCKS gateway itself.

🔗 Existing State of Squid:

A little research indicates SOCKSv5 is supposed to be as easy as a new bind() call and library linkage. http://www.squid-cache.org/mail-archive/squid-users/199901/0033.html

export CFLAGS=" -Dbind=SOCKSbind "
export CXXFLAGS=" -Dbind=SOCKSbind "
export LDADD=" -lsocks "

With knowledge of how upstream peering works it follows that the connect() calls Squid may also need to be socksified to use cache_peer with a socks proxy. Which would be:

export CFLAGS=" -Dbind=SOCKSbind -Dconnect=SOCKSconnect "
export CXXFLAGS=" -Dbind=SOCKSbind -Dconnect=SOCKSconnect "

Doing these apparently works ad makes Squid into a SOCKS proxy. There are several users who have reported actively using Squid in this fashion.

:warning: It has one downside in that ALL connections inbound and outbound are SOCKS connections. There is no middle ground for mixed SOCKS/non-SOCKS connections.

🔗 Upgrade Plans

A new COMM_SOCKSBIND flag will be needed to the comm layer calls for the listener binding, outbound maybe a config setting for cache_peer acting on the bind() choice directly.

I’ve had a bit of time too short to do anything much and created a branch that is supposed to do listening port and SOCKS peers. It builds and listens on an http_port as far as I can tell now. squidclient has also been adapted to use SOCKS socket operations.

Outstanding Problem:

So currently work is blocked. Using the API via -D= compiler options still apparently works, writing the code to use an if() statement fails. Ideas?


Extra additions: there seems to also be a system configuration setting and config file(s) for setting a parent SOCKSv5 proxy. It may be useful to pull this in as a possible automatic cache_peer entry.

Categories: WantedFeature

Navigation: Site Search, Site Pages, Categories, 🔼 go up