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
e7caae81
Commit
e7caae81
authored
Jun 06, 2011
by
Brian May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it clear ports are for IPv4.
parent
4db9b372
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
client.py
client.py
+3
-3
firewall.py
firewall.py
+11
-11
No files found.
client.py
View file @
e7caae81
...
@@ -415,12 +415,12 @@ def main(listenip, ssh_cmd, remotename, python, latency_control, dns,
...
@@ -415,12 +415,12 @@ def main(listenip, ssh_cmd, remotename, python, latency_control, dns,
if
dns
:
if
dns
:
dnsip
=
dns_listener
.
v4
.
getsockname
()
dnsip
=
dns_listener
.
v4
.
getsockname
()
debug1
(
'DNS listening on
%
r.
\n
'
%
(
dnsip
,))
debug1
(
'DNS listening on
%
r.
\n
'
%
(
dnsip
,))
dnsport
=
dnsip
[
1
]
dnsport
_v4
=
dnsip
[
1
]
else
:
else
:
dnsport
=
0
dnsport
_v4
=
0
dns_listener
=
None
dns_listener
=
None
fw
=
FirewallClient
(
listenip
[
1
],
subnets_include
,
subnets_exclude
,
dnsport
)
fw
=
FirewallClient
(
listenip
[
1
],
subnets_include
,
subnets_exclude
,
dnsport
_v4
)
try
:
try
:
return
_main
(
tcp_listener
,
fw
,
ssh_cmd
,
remotename
,
return
_main
(
tcp_listener
,
fw
,
ssh_cmd
,
remotename
,
...
...
firewall.py
View file @
e7caae81
...
@@ -389,11 +389,11 @@ def restore_etc_hosts(port):
...
@@ -389,11 +389,11 @@ def restore_etc_hosts(port):
# exit. In case that fails, it's not the end of the world; future runs will
# exit. In case that fails, it's not the end of the world; future runs will
# supercede it in the transproxy list, at least, so the leftover rules
# supercede it in the transproxy list, at least, so the leftover rules
# are hopefully harmless.
# are hopefully harmless.
def
main
(
port
,
dnsport
,
syslog
):
def
main
(
port
_v4
,
dnsport_v4
,
syslog
):
assert
(
port
>
0
)
assert
(
port
_v4
>
0
)
assert
(
port
<=
65535
)
assert
(
port
_v4
<=
65535
)
assert
(
dnsport
>=
0
)
assert
(
dnsport
_v4
>=
0
)
assert
(
dnsport
<=
65535
)
assert
(
dnsport
_v4
<=
65535
)
if
os
.
getuid
()
!=
0
:
if
os
.
getuid
()
!=
0
:
raise
Fatal
(
'you must be root (or enable su/sudo) to set the firewall'
)
raise
Fatal
(
'you must be root (or enable su/sudo) to set the firewall'
)
...
@@ -449,8 +449,8 @@ def main(port, dnsport, syslog):
...
@@ -449,8 +449,8 @@ def main(port, dnsport, syslog):
debug1
(
'firewall manager: starting transproxy.
\n
'
)
debug1
(
'firewall manager: starting transproxy.
\n
'
)
subnets_v4
=
filter
(
lambda
i
:
i
[
0
]
==
socket
.
AF_INET
,
subnets
)
subnets_v4
=
filter
(
lambda
i
:
i
[
0
]
==
socket
.
AF_INET
,
subnets
)
if
port
:
if
port
_v4
:
do_wait
=
do_it
(
port
,
dnsport
,
socket
.
AF_INET
,
subnets_v4
)
do_wait
=
do_it
(
port
_v4
,
dnsport_v4
,
socket
.
AF_INET
,
subnets_v4
)
elif
len
(
subnets_v4
)
>
0
:
elif
len
(
subnets_v4
)
>
0
:
debug1
(
'IPv4 subnets defined but IPv4 disabled
\n
'
)
debug1
(
'IPv4 subnets defined but IPv4 disabled
\n
'
)
...
@@ -472,7 +472,7 @@ def main(port, dnsport, syslog):
...
@@ -472,7 +472,7 @@ def main(port, dnsport, syslog):
if
line
.
startswith
(
'HOST '
):
if
line
.
startswith
(
'HOST '
):
(
name
,
ip
)
=
line
[
5
:]
.
strip
()
.
split
(
','
,
1
)
(
name
,
ip
)
=
line
[
5
:]
.
strip
()
.
split
(
','
,
1
)
hostmap
[
name
]
=
ip
hostmap
[
name
]
=
ip
rewrite_etc_hosts
(
port
)
rewrite_etc_hosts
(
port
_v4
)
elif
line
:
elif
line
:
raise
Fatal
(
'expected EOF, got
%
r'
%
line
)
raise
Fatal
(
'expected EOF, got
%
r'
%
line
)
else
:
else
:
...
@@ -482,6 +482,6 @@ def main(port, dnsport, syslog):
...
@@ -482,6 +482,6 @@ def main(port, dnsport, syslog):
debug1
(
'firewall manager: undoing changes.
\n
'
)
debug1
(
'firewall manager: undoing changes.
\n
'
)
except
:
except
:
pass
pass
if
port
:
if
port
_v4
:
do_it
(
port
,
0
,
socket
.
AF_INET
,
[])
do_it
(
port
_v4
,
0
,
socket
.
AF_INET
,
[])
restore_etc_hosts
(
port
)
restore_etc_hosts
(
port
_v4
)
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