Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sshuttle
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pub
sshuttle
Commits
32b4defa
Commit
32b4defa
authored
Nov 09, 2010
by
Avery Pennarun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a new --ssh-cmd= option to let you override the ssh command.
Requested by Axel Beckert.
parent
8b7605cc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
client.py
client.py
+5
-4
main.py
main.py
+3
-1
ssh.py
ssh.py
+8
-2
No files found.
client.py
View file @
32b4defa
...
@@ -98,7 +98,7 @@ class FirewallClient:
...
@@ -98,7 +98,7 @@ class FirewallClient:
raise
Fatal
(
'cleanup:
%
r returned
%
d'
%
(
self
.
argv
,
rv
))
raise
Fatal
(
'cleanup:
%
r returned
%
d'
%
(
self
.
argv
,
rv
))
def
_main
(
listener
,
fw
,
remotename
,
python
,
seed_hosts
,
auto_nets
):
def
_main
(
listener
,
fw
,
ssh_cmd
,
remotename
,
python
,
seed_hosts
,
auto_nets
):
handlers
=
[]
handlers
=
[]
if
helpers
.
verbose
>=
1
:
if
helpers
.
verbose
>=
1
:
helpers
.
logprefix
=
'c : '
helpers
.
logprefix
=
'c : '
...
@@ -106,7 +106,7 @@ def _main(listener, fw, remotename, python, seed_hosts, auto_nets):
...
@@ -106,7 +106,7 @@ def _main(listener, fw, remotename, python, seed_hosts, auto_nets):
helpers
.
logprefix
=
'client: '
helpers
.
logprefix
=
'client: '
debug1
(
'connecting to server...
\n
'
)
debug1
(
'connecting to server...
\n
'
)
try
:
try
:
(
serverproc
,
serversock
)
=
ssh
.
connect
(
remotename
,
python
)
(
serverproc
,
serversock
)
=
ssh
.
connect
(
ssh_cmd
,
remotename
,
python
)
except
socket
.
error
,
e
:
except
socket
.
error
,
e
:
if
e
.
errno
==
errno
.
EPIPE
:
if
e
.
errno
==
errno
.
EPIPE
:
raise
Fatal
(
"failed to establish ssh session"
)
raise
Fatal
(
"failed to establish ssh session"
)
...
@@ -181,7 +181,7 @@ def _main(listener, fw, remotename, python, seed_hosts, auto_nets):
...
@@ -181,7 +181,7 @@ def _main(listener, fw, remotename, python, seed_hosts, auto_nets):
mux
.
check_fullness
()
mux
.
check_fullness
()
def
main
(
listenip
,
remotename
,
python
,
seed_hosts
,
auto_nets
,
def
main
(
listenip
,
ssh_cmd
,
remotename
,
python
,
seed_hosts
,
auto_nets
,
subnets_include
,
subnets_exclude
):
subnets_include
,
subnets_exclude
):
debug1
(
'Starting sshuttle proxy.
\n
'
)
debug1
(
'Starting sshuttle proxy.
\n
'
)
listener
=
socket
.
socket
()
listener
=
socket
.
socket
()
...
@@ -212,6 +212,7 @@ def main(listenip, remotename, python, seed_hosts, auto_nets,
...
@@ -212,6 +212,7 @@ def main(listenip, remotename, python, seed_hosts, auto_nets,
fw
=
FirewallClient
(
listenip
[
1
],
subnets_include
,
subnets_exclude
)
fw
=
FirewallClient
(
listenip
[
1
],
subnets_include
,
subnets_exclude
)
try
:
try
:
return
_main
(
listener
,
fw
,
remotename
,
python
,
seed_hosts
,
auto_nets
)
return
_main
(
listener
,
fw
,
ssh_cmd
,
remotename
,
python
,
seed_hosts
,
auto_nets
)
finally
:
finally
:
fw
.
done
()
fw
.
done
()
main.py
View file @
32b4defa
...
@@ -56,6 +56,7 @@ python= specify the name/path of the python interpreter on the remote server [py
...
@@ -56,6 +56,7 @@ python= specify the name/path of the python interpreter on the remote server [py
r,remote= ssh hostname (and optional username) of remote sshuttle server
r,remote= ssh hostname (and optional username) of remote sshuttle server
x,exclude= exclude this subnet (can be used more than once)
x,exclude= exclude this subnet (can be used more than once)
v,verbose increase debug message verbosity
v,verbose increase debug message verbosity
e,ssh-cmd= the command to use to connect to the remote [ssh]
seed-hosts= with -H, use these hostnames for initial scan (comma-separated)
seed-hosts= with -H, use these hostnames for initial scan (comma-separated)
server (internal use only)
server (internal use only)
firewall (internal use only)
firewall (internal use only)
...
@@ -97,8 +98,9 @@ try:
...
@@ -97,8 +98,9 @@ try:
else
:
else
:
sh
=
None
sh
=
None
sys
.
exit
(
client
.
main
(
parse_ipport
(
opt
.
listen
or
'0.0.0.0:0'
),
sys
.
exit
(
client
.
main
(
parse_ipport
(
opt
.
listen
or
'0.0.0.0:0'
),
opt
.
ssh_cmd
,
remotename
,
remotename
,
(
opt
.
python
or
"python"
)
,
opt
.
python
,
sh
,
sh
,
opt
.
auto_nets
,
opt
.
auto_nets
,
parse_subnets
(
includes
),
parse_subnets
(
includes
),
...
...
ssh.py
View file @
32b4defa
...
@@ -21,7 +21,7 @@ def empackage(z, filename):
...
@@ -21,7 +21,7 @@ def empackage(z, filename):
return
'
%
s
\n
%
d
\n
%
s'
%
(
basename
,
len
(
content
),
content
)
return
'
%
s
\n
%
d
\n
%
s'
%
(
basename
,
len
(
content
),
content
)
def
connect
(
rhostport
,
python
):
def
connect
(
ssh_cmd
,
rhostport
,
python
):
main_exe
=
sys
.
argv
[
0
]
main_exe
=
sys
.
argv
[
0
]
l
=
(
rhostport
or
''
)
.
split
(
':'
,
1
)
l
=
(
rhostport
or
''
)
.
split
(
':'
,
1
)
rhost
=
l
[
0
]
rhost
=
l
[
0
]
...
@@ -53,7 +53,13 @@ def connect(rhostport, python):
...
@@ -53,7 +53,13 @@ def connect(rhostport, python):
if
not
rhost
:
if
not
rhost
:
argv
=
[
python
,
'-c'
,
pyscript
]
argv
=
[
python
,
'-c'
,
pyscript
]
else
:
else
:
argv
=
[
'ssh'
]
+
portl
+
[
rhost
,
'--'
,
"'
%
s' -c '
%
s'"
%
(
python
,
pyscript
)]
if
ssh_cmd
:
sshl
=
ssh_cmd
.
split
(
' '
)
else
:
sshl
=
[
'ssh'
]
argv
=
(
sshl
+
portl
+
[
rhost
,
'--'
,
"'
%
s' -c '
%
s'"
%
(
python
,
pyscript
)])
(
s1
,
s2
)
=
socket
.
socketpair
()
(
s1
,
s2
)
=
socket
.
socketpair
()
def
setup
():
def
setup
():
# runs in the child process
# runs in the child process
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment