Sniffing & Spoofingproxysockstcpredirectdaemontunnelingfirewall

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

bash
sudo apt install redsocks

Flags

-h, -?Show this help message
-vPrint version information
-tTest configuration file syntax
-p pidfileWrite daemon PID to specified pidfile
-c configSpecify configuration file to use

Examples

Display the usage help message showing all available flags
redsocks -h
Print the current version of redsocks
redsocks -v
Test the syntax of the redsocks configuration file
redsocks -t
Test syntax of a specific configuration file
redsocks -t -c /etc/redsocks.conf
Start redsocks and write PID to specified pidfile
redsocks -p /var/run/redsocks.pid
Start redsocks with custom config file and PID file
redsocks -c /etc/redsocks.conf -p /var/run/redsocks.pid
Updated 2026-04-16kali.org ↗