Redsocks
Redsocks is a daemon that transparently tunnels any TCP connection via a remote SOCKS4, SOCKS5 or HTTP proxy server. It uses the system firewall's redirection facility for system-wide interception without relying on LD_PRELOAD libraries.
Description
Redsocks is an arbitrary TCP connection redirector that operates as a daemon on the local system. It enables transparent tunneling of TCP connections and UDP packets through remote SOCKS4, SOCKS5, or HTTP proxy servers. The tool leverages the system firewall's redirection capabilities to intercept connections system-wide, providing fine-grained control over the redirection process.
Key features include support for authentication with both SOCKS and HTTP proxies. Additionally, redsocks includes a small DNS server that responds to UDP queries with the 'truncated' flag set, forcing resolvers to fall back to TCP. This makes it particularly useful in environments requiring proxy redirection for network traffic analysis, anonymity, or bypassing restrictions.
As a lightweight daemon (156 KB installed size), redsocks is ideal for scenarios where transparent proxying is needed without modifying application behavior or using library preloading techniques.
How It Works
Redsocks runs as a local daemon that intercepts TCP connections and UDP packets using the system firewall's redirection facility, enabling system-wide transparent tunneling to remote SOCKS4, SOCKS5, or HTTP proxy servers. It supports authentication for both proxy types and includes a DNS server that sets the 'truncated' flag on UDP responses, forcing TCP fallback for DNS queries. The redirection operates independently of LD_PRELOAD libraries, providing fine-grained control through firewall rules.
Installation
sudo apt install redsocksFlags
Examples
redsocks -hredsocks -vredsocks -tredsocks -t -c /etc/redsocks.confredsocks -p /var/run/redsocks.pidredsocks -c /etc/redsocks.conf -p /var/run/redsocks.pid