Top Related Projects
Peer-to-peer VPN
OpenVPN is an open source VPN daemon
Mirror only. Official repository is at https://git.zx2c4.com/wireguard-go
Streisand sets up a new server running your choice of WireGuard, OpenConnect, OpenSSH, OpenVPN, Shadowsocks, sslh, Stunnel, or a Tor bridge. It also generates custom instructions for all of these services. At the end of the run you are given an HTML file with instructions that can be shared with friends, family members, and fellow activists.
Enterprise VPN server
Quick Overview
sshuttle
is a transparent proxy server that allows you to tunnel TCP connections over an SSH connection. It's a lightweight alternative to VPNs, providing a simple and effective way to secure your internet traffic without the overhead of a full-fledged VPN.
Pros
- Lightweight and Portable:
sshuttle
is a Python-based tool that can be easily installed and used on various platforms, including Linux, macOS, and Windows. - Transparent Proxy: It operates as a transparent proxy, meaning you don't need to configure your applications to use it.
sshuttle
automatically intercepts and tunnels your traffic through the SSH connection. - Flexible Configuration:
sshuttle
supports a wide range of configuration options, allowing you to customize the tunneling behavior to suit your needs. - No Root Privileges Required:
sshuttle
can be run without root privileges, making it a convenient option for users who don't have administrative access on their systems.
Cons
- Dependency on SSH:
sshuttle
relies on an active SSH connection, which means you'll need to have access to an SSH server or host to use it effectively. - Limited Protocol Support: While
sshuttle
supports TCP traffic, it does not provide support for other protocols, such as UDP or ICMP. - Performance Overhead: Tunneling all your traffic through an SSH connection can introduce some performance overhead, especially for high-bandwidth applications.
- Potential Security Concerns: As with any proxy or VPN solution, there are potential security concerns to consider, such as the trustworthiness of the SSH server you're connecting to.
Getting Started
To get started with sshuttle
, follow these steps:
-
Install
sshuttle
on your local machine. You can do this using your system's package manager (e.g.,pip install sshuttle
) or by cloning the GitHub repository and running the script directly. -
Identify the SSH server or host you want to use as the proxy. You'll need to have access to this server, including the necessary credentials (username and password or SSH key).
-
Run the
sshuttle
command, specifying the SSH server and the network ranges you want to tunnel. For example:sshuttle -r user@example.com 0.0.0.0/0
This command will create a transparent proxy that tunnels all your traffic through the SSH connection to the
example.com
server. -
Once
sshuttle
is running, your internet traffic will be routed through the SSH tunnel. You can verify this by checking the network activity on your local machine or by testing the connection to a website or service. -
To stop the
sshuttle
proxy, simply pressCtrl+C
in the terminal where you started the command.
That's the basic getting started guide for sshuttle
. Depending on your specific use case, you may want to explore the various configuration options and features available in the tool to customize its behavior.
Competitor Comparisons
Pros of Shadowsocks
- Designed specifically for circumventing internet censorship
- Supports multiple encryption methods for enhanced security
- Lightweight and efficient, with low resource usage
Cons of Shadowsocks
- Requires server setup and configuration
- Limited to SOCKS5 proxy, which may not work for all applications
- Potential security vulnerabilities if not properly configured
Code Comparison
Shadowsocks (Python implementation):
encryptor = encrypt.Encryptor(key, method)
data = encryptor.encrypt(data)
self._write_to_sock(data, self._remote_sock)
Sshuttle:
def ssh_command(self, host, args, stderr=None):
return ['ssh', '-v', '-C', '-oControlMaster=auto',
'-oControlPath=%s' % CONTROL_PATH, host] + args
Key Differences
- Shadowsocks focuses on encrypted proxy connections, while Sshuttle creates a VPN-like tunnel over SSH
- Sshuttle leverages existing SSH infrastructure, making it easier to set up in some cases
- Shadowsocks offers more flexibility in encryption methods, while Sshuttle relies on SSH's built-in encryption
Use Cases
- Shadowsocks: Bypassing internet censorship, securing connections in hostile network environments
- Sshuttle: Creating ad-hoc VPNs, accessing remote networks securely without additional software on the server
Peer-to-peer VPN
Pros of n2n
- Peer-to-peer VPN with direct connections between nodes
- Supports NAT traversal and works well in complex network environments
- Can create multiple virtual networks with different encryption keys
Cons of n2n
- Requires a supernode for initial connection and NAT traversal
- More complex setup compared to sshuttle's simplicity
- May have higher latency for initial connections
Code Comparison
n2n (C):
int main(int argc, char * const argv[]) {
n2n_edge_conf_t conf;
edge_init_conf_defaults(&conf);
// ... (configuration and setup)
return run_edge_loop(&conf, &keep_running);
}
sshuttle (Python):
def main():
options, args = parse_args(sys.argv[1:])
if options.firewall:
return firewall(options.method, args)
else:
return client(options, args)
n2n focuses on creating a peer-to-peer VPN network, while sshuttle provides a simpler, SSH-based VPN-like solution. n2n offers more flexibility in network topology but requires more setup, whereas sshuttle is easier to use but may have limitations in complex network scenarios. n2n is written in C for performance, while sshuttle uses Python for simplicity and ease of modification.
OpenVPN is an open source VPN daemon
Pros of OpenVPN
- More robust security features and encryption options
- Wider platform support, including mobile devices
- Better suited for large-scale enterprise deployments
Cons of OpenVPN
- More complex setup and configuration process
- Requires dedicated server infrastructure
- Higher resource consumption on both client and server
Code Comparison
OpenVPN configuration example:
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
sshuttle usage example:
sshuttle -r username@sshserver 0/0
Summary
OpenVPN is a full-featured VPN solution with strong security and wide platform support, making it ideal for enterprise use. However, it requires more setup and resources. sshuttle, on the other hand, is a lightweight, easy-to-use alternative that leverages existing SSH connections, making it simpler to set up and use for individual users or small teams. While it may not offer the same level of security features as OpenVPN, sshuttle provides a quick and efficient way to create a VPN-like connection without the need for complex configurations or dedicated infrastructure.
Mirror only. Official repository is at https://git.zx2c4.com/wireguard-go
Pros of wireguard-go
- Higher performance and lower latency due to its lightweight design
- Built-in encryption and security features
- Easier to set up and maintain, with simpler configuration
Cons of wireguard-go
- Less flexible in terms of routing options compared to sshuttle
- Requires kernel support or userspace implementation
- May not work as seamlessly with existing SSH infrastructure
Code Comparison
sshuttle:
def connect(self):
self.pfile = self.ssh.stderr
self.execfile = self.ssh.stdin
self.ssh.stdin.write('SSHUTTLE0001')
self.ssh.stdin.flush()
wireguard-go:
func (device *Device) Up() error {
device.state.Lock()
defer device.state.Unlock()
if device.state.up {
return nil
}
The sshuttle code snippet shows its reliance on SSH for connection establishment, while the wireguard-go code demonstrates its direct device management approach. This reflects the fundamental differences in their architectures and implementation strategies.
Streisand sets up a new server running your choice of WireGuard, OpenConnect, OpenSSH, OpenVPN, Shadowsocks, sslh, Stunnel, or a Tor bridge. It also generates custom instructions for all of these services. At the end of the run you are given an HTML file with instructions that can be shared with friends, family members, and fellow activists.
Pros of Streisand
- Offers a wider range of VPN protocols and services (OpenVPN, WireGuard, Shadowsocks, etc.)
- Automates the setup process for multiple cloud providers
- Provides a comprehensive solution for circumventing censorship
Cons of Streisand
- More complex setup and maintenance compared to sshuttle
- Requires a dedicated server or cloud instance to run
- May be overkill for users who only need simple VPN functionality
Code Comparison
Streisand (Ansible playbook excerpt):
- name: Install OpenVPN
apt:
name: openvpn
state: present
- name: Generate OpenVPN configuration
template:
src: openvpn-server.conf.j2
dest: /etc/openvpn/server.conf
sshuttle (Python code excerpt):
def start_firewall(port, dnsport, nslist):
# ...
if method == "nat":
setup_firewall_nat(port, dnsport, nslist)
elif method == "nft":
setup_firewall_nft(port, dnsport, nslist)
Summary
Streisand provides a more comprehensive solution for bypassing censorship with multiple VPN protocols and automated setup for various cloud providers. However, it requires more resources and setup complexity. sshuttle offers a simpler, lightweight approach using SSH tunneling, making it easier to set up and use for basic VPN needs, but with fewer features compared to Streisand.
Enterprise VPN server
Pros of Pritunl
- User-friendly web interface for VPN management
- Supports multiple VPN protocols (OpenVPN, WireGuard)
- Scalable for enterprise environments
Cons of Pritunl
- More complex setup and infrastructure requirements
- Requires a dedicated server or cloud instance
- Potentially higher resource usage
Code Comparison
Sshuttle (Python):
def got_host_port(self, host, port):
self.socks.append(SockWrapper(self.rsock, host, port))
self.connect_timeout = time.time() + 5
Pritunl (JavaScript):
getServerAddr() {
if (!this.server) {
return null;
}
return this.server.split('/')[2].split(':')[0];
}
Summary
Sshuttle is a lightweight, transparent proxy server that routes connections over SSH. It's easy to set up and requires minimal configuration. Pritunl, on the other hand, is a full-featured VPN server with a web-based management interface. It offers more advanced features and scalability but requires more setup and resources.
Sshuttle is ideal for quick, temporary connections or personal use, while Pritunl is better suited for businesses or organizations needing a robust, manageable VPN solution. The choice between them depends on the specific use case, required features, and available resources.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
sshuttle: where transparent proxy meets VPN meets ssh
As far as I know, sshuttle is the only program that solves the following common case:
-
Your client machine (or router) is Linux, FreeBSD, or MacOS.
-
You have access to a remote network via ssh.
-
You don't necessarily have admin access on the remote network.
-
The remote network has no VPN, or only stupid/complex VPN protocols (IPsec, PPTP, etc). Or maybe you are the admin and you just got frustrated with the awful state of VPN tools.
-
You don't want to create an ssh port forward for every single host/port on the remote network.
-
You hate openssh's port forwarding because it's randomly slow and/or stupid.
-
You can't use openssh's PermitTunnel feature because it's disabled by default on openssh servers; plus it does TCP-over-TCP, which has terrible performance (see below).
Obtaining sshuttle
-
From PyPI::
pip install sshuttle
-
Clone::
git clone https://github.com/sshuttle/sshuttle.git ./setup.py install
Documentation
The documentation for the stable version is available at: http://sshuttle.readthedocs.org/
The documentation for the latest development version is available at: http://sshuttle.readthedocs.org/en/latest/
Top Related Projects
Peer-to-peer VPN
OpenVPN is an open source VPN daemon
Mirror only. Official repository is at https://git.zx2c4.com/wireguard-go
Streisand sets up a new server running your choice of WireGuard, OpenConnect, OpenSSH, OpenVPN, Shadowsocks, sslh, Stunnel, or a Tor bridge. It also generates custom instructions for all of these services. At the end of the run you are given an HTML file with instructions that can be shared with friends, family members, and fellow activists.
Enterprise VPN server
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot