Skip to content

Commit d4f10b2

Browse files
committed
Restructure code
* Make compatible with setuptools. * Load modules via ssh into separate modules, not the one name space.
1 parent 41b8ad4 commit d4f10b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+211
-313
lines changed

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include *.txt
2+
include *.rst
3+
include *.py
4+
include MANIFEST.in
5+
recursive-include sshuttle *.py

README.md renamed to README.rst

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
1-
2-
WARNING:
3-
On MacOS 10.6 (at least up to 10.6.6), your network will
4-
stop responding about 10 minutes after the first time you
5-
start sshuttle, because of a MacOS kernel bug relating to
6-
arp and the net.inet.ip.scopedroute sysctl. To fix it,
7-
just switch your wireless off and on. Sshuttle makes the
8-
kernel setting it changes permanent, so this won't happen
9-
again, even after a reboot.
10-
11-
Required Software
12-
=================
13-
14-
- You need PyXAPI, available here:
15-
http://www.pps.univ-paris-diderot.fr/~ylg/PyXAPI/
16-
- Python 2.x, both locally and the remote system
17-
18-
19-
Additional Suggested Software
20-
-----------------------------
21-
22-
- You may want to need autossh, available in various package management
23-
systems
24-
25-
261
sshuttle: where transparent proxy meets VPN meets ssh
272
=====================================================
283

@@ -45,63 +20,82 @@ common case:
4520

4621
- You hate openssh's port forwarding because it's randomly
4722
slow and/or stupid.
48-
23+
4924
- You can't use openssh's PermitTunnel feature because
5025
it's disabled by default on openssh servers; plus it does
5126
TCP-over-TCP, which has terrible performance (see below).
52-
27+
5328

5429
Prerequisites
5530
-------------
5631

5732
- sudo, su, or logged in as root on your client machine.
5833
(The server doesn't need admin access.)
59-
34+
6035
- If you use Linux on your client machine:
6136
iptables installed on the client, including at
6237
least the iptables DNAT, REDIRECT, and ttl modules.
6338
These are installed by default on most Linux distributions.
6439
(The server doesn't need iptables and doesn't need to be
6540
Linux.)
66-
41+
6742
- If you use MacOS or BSD on your client machine:
6843
Your kernel needs to be compiled with `IPFIREWALL_FORWARD`
6944
(MacOS has this by default) and you need to have ipfw
7045
available. (The server doesn't need to be MacOS or BSD.)
7146

7247

73-
Obtaining sshuttle
74-
------------------
48+
- Python 2.x, both locally and the remote system. Python 3.x is not yet supported.
49+
50+
*WARNING*:
51+
On MacOS 10.6 (at least up to 10.6.6), your network will
52+
stop responding about 10 minutes after the first time you
53+
start sshuttle, because of a MacOS kernel bug relating to
54+
arp and the net.inet.ip.scopedroute sysctl. To fix it,
55+
just switch your wireless off and on. Sshuttle makes the
56+
kernel setting it changes permanent, so this won't happen
57+
again, even after a reboot.
58+
7559

76-
- First, go get PyXAPI from the link above
60+
Additional Suggested Software
61+
-----------------------------
62+
63+
- You may want to need autossh, available in various package management
64+
systems
65+
66+
- For Linux only tproxy support, you need PyXAPI, available here:
67+
http://www.pps.univ-paris-diderot.fr/~ylg/PyXAPI/
7768

78-
- Clone: `git clone https://github.com/sshuttle/sshuttle.git`
7969

70+
Obtaining sshuttle
71+
------------------
8072

81-
Usage on (Ubuntu) Linux
82-
-----------------------
73+
- Clone::
8374

84-
- `cd packaging; ./make_deb`
75+
git clone https://github.com/sshuttle/sshuttle.git
76+
./setup.py install
8577

86-
- `sudo dpkg -i ./sshuttle-VERSION.deb`
78+
- From PyPI::
8779

88-
- Check out the files in `/etc/sshuttle`; configure them so your tunnel works
80+
pip install sshuttle
8981

90-
- `sudo service sshuttle start`
9182

83+
Usage
84+
-----
9285

93-
Usage on other Linuxes and OSes
94-
-------------------------------
86+
- Forward all traffic::
9587

96-
<tt>src/sshuttle -r username@sshserver 0.0.0.0/0 -vv</tt>
88+
sshuttle -r username@sshserver 0.0.0.0/0 -vv
9789

9890
- There is a shortcut for 0.0.0.0/0 for those that value
99-
their wrists
100-
<tt>src/sshuttle -r username@sshserver 0/0 -vv</tt>
91+
their wrists::
92+
93+
sshuttle -r username@sshserver 0/0 -vv
10194

10295
- If you would also like your DNS queries to be proxied
103-
through the DNS server of the server you are connect to:
104-
<tt>src/sshuttle --dns -vvr username@sshserver 0/0</tt>
96+
through the DNS server of the server you are connect to::
97+
98+
sshuttle --dns -vvr username@sshserver 0/0
10599

106100
The above is probably what you want to use to prevent
107101
local network attacks such as Firesheep and friends.
@@ -112,6 +106,7 @@ then the remote ssh password. Or you might have sudo and ssh set
112106
up to not require passwords, in which case you won't be
113107
prompted at all.)
114108

109+
115110
Usage Notes
116111
-----------
117112

@@ -127,7 +122,7 @@ to the remote python interpreter.
127122
This creates a transparent proxy server on your local machine for all IP
128123
addresses that match 0.0.0.0/0. (You can use more specific IP addresses if
129124
you want; use any number of IP addresses or subnets to change which
130-
addresses get proxied. Using 0.0.0.0/0 proxies <i>everything</i>, which is
125+
addresses get proxied. Using 0.0.0.0/0 proxies *everything*, which is
131126
interesting if you don't trust the people on your local network.)
132127

133128
Any TCP session you initiate to one of the proxied IP addresses will be
@@ -139,6 +134,19 @@ Fun, right? A poor man's instant VPN, and you don't even have to have
139134
admin access on the server.
140135

141136

137+
Support
138+
-------
139+
140+
Mailing list:
141+
142+
* Subscribe by sending a message to <[email protected]>
143+
* List archives are at: http://groups.google.com/group/sshuttle
144+
145+
Issue tracker and pull requests at github:
146+
147+
* https://github.com/sshuttle/sshuttle
148+
149+
142150
Theory of Operation
143151
-------------------
144152

@@ -155,18 +163,17 @@ doesn't care about individual connections; ie. it's "stateless" with respect
155163
to the traffic. sshuttle is the opposite of stateless; it tracks every
156164
single connection.
157165

158-
You could compare sshuttle to something like the old <a
159-
href="http://en.wikipedia.org/wiki/Slirp">Slirp</a> program, which was a
166+
You could compare sshuttle to something like the old `Slirp <http://en.wikipedia.org/wiki/Slirp>`_ program, which was a
160167
userspace TCP/IP implementation that did something similar. But it
161168
operated on a packet-by-packet basis on the client side, reassembling the
162169
packets on the server side. That worked okay back in the "real live serial
163170
port" days, because serial ports had predictable latency and buffering.
164171

165172
But you can't safely just forward TCP packets over a TCP session (like ssh),
166173
because TCP's performance depends fundamentally on packet loss; it
167-
<i>must</i> experience packet loss in order to know when to slow down! At
174+
*must* experience packet loss in order to know when to slow down! At
168175
the same time, the outer TCP session (ssh, in this case) is a reliable
169-
transport, which means that what you forward through the tunnel <i>never</i>
176+
transport, which means that what you forward through the tunnel *never*
170177
experiences packet loss. The ssh session itself experiences packet loss, of
171178
course, but TCP fixes it up and ssh (and thus you) never know the
172179
difference. But neither does your inner TCP session, and extremely screwy
@@ -181,8 +188,7 @@ safe.
181188
Useless Trivia
182189
--------------
183190

184-
Back in 1998 (12 years ago! Yikes!), I released the first version of <a
185-
href="http://alumnit.ca/wiki/?TunnelVisionReadMe">Tunnel Vision</a>, a
191+
Back in 1998 (12 years ago! Yikes!), I released the first version of `Tunnel Vision <http://alumnit.ca/wiki/?TunnelVisionReadMe>`_, a
186192
semi-intelligent VPN client for Linux. Unfortunately, I made two big mistakes:
187193
I implemented the key exchange myself (oops), and I ended up doing
188194
TCP-over-TCP (double oops). The resulting program worked okay - and people
@@ -197,8 +203,7 @@ tool we called "Double Vision").
197203

198204
I was still in university at the time. A couple years after that, one of my
199205
professors was working with some graduate students on the technology that
200-
would eventually become <a href="http://www.slipstream.com/">Slipstream
201-
Internet Acceleration</a>. He asked me to do a contract for him to build an
206+
would eventually become `Slipstream Internet Acceleration <http://www.slipstream.com/>`_. He asked me to do a contract for him to build an
202207
initial prototype of a transparent proxy server for mobile networks. The
203208
idea was similar to sshuttle: if you reassemble and then disassemble the TCP
204209
packets, you can reduce latency and improve performance vs. just forwarding
@@ -215,7 +220,3 @@ later. You're welcome.
215220

216221
--
217222
Avery Pennarun <[email protected]>
218-
219-
Mailing list:
220-
Subscribe by sending a message to <[email protected]>
221-
List archives are at: http://groups.google.com/group/sshuttle

VERSION.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.72

run

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
if python2 -V 2>/dev/null; then
3+
exec python2 -m "sshuttle" "$@"
4+
else
5+
exec python -m "sshuttle" "$@"
6+
fi

setup.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright 2012-2014 Brian May
4+
#
5+
# This file is part of python-tldap.
6+
#
7+
# python-tldap is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# python-tldap is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with python-tldap If not, see <http://www.gnu.org/licenses/>.
19+
20+
from setuptools import setup, find_packages
21+
22+
with open('VERSION.txt', 'r') as f:
23+
version = f.readline().strip()
24+
25+
setup(
26+
name="sshuttle",
27+
version=version,
28+
url='https://github.com/sshuttle/sshuttle',
29+
author='Brian May',
30+
author_email='[email protected]',
31+
description='Transparent proxy server that works as a poor man\'s VPN.',
32+
packages=find_packages(),
33+
license="GPL2+",
34+
long_description=open('README.rst').read(),
35+
classifiers=[
36+
"Development Status :: 5 - Production/Stable",
37+
"Intended Audience :: Developers",
38+
"Intended Audience :: End Users/Desktop",
39+
"License :: OSI Approved :: "
40+
"GNU General Public License v2 or later (GPLv2+)",
41+
"Operating System :: OS Independent",
42+
"Programming Language :: Python :: 2.7",
43+
"Topic :: System :: Networking",
44+
],
45+
entry_points={
46+
'console_scripts': [
47+
'sshuttle = sshuttle.__main__',
48+
],
49+
},
50+
keywords="ssh vpn",
51+
)

src/Makefile

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)