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
49c55f68
Commit
49c55f68
authored
Mar 21, 2015
by
Sean Zeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use -E/-X to enable/disable pf on yosemite
parent
1874aace
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
firewall.py
src/firewall.py
+6
-10
No files found.
src/firewall.py
View file @
49c55f68
...
...
@@ -7,6 +7,7 @@ import compat.ssubprocess as ssubprocess
import
ssyslog
import
sys
import
os
import
re
from
helpers
import
log
,
debug1
,
debug3
,
islocal
,
Fatal
,
family_to_string
,
\
resolvconf_nameservers
from
fcntl
import
ioctl
...
...
@@ -469,7 +470,7 @@ def do_ipfw(port, dnsport, family, subnets, udp):
def
pfctl
(
args
,
stdin
=
None
):
argv
=
[
'pfctl'
]
+
list
(
args
.
split
(
" "
))
debug1
(
'>>
%
s
, stdin:
%
s
\n
'
%
(
' '
.
join
(
argv
),
stdin
)
)
debug1
(
'>>
%
s
'
%
' '
.
join
(
argv
),
stdin
)
p
=
ssubprocess
.
Popen
(
argv
,
stdin
=
ssubprocess
.
PIPE
,
stdout
=
ssubprocess
.
PIPE
,
...
...
@@ -480,7 +481,7 @@ def pfctl(args, stdin = None):
return
o
_pf_
started_by_sshuttle
=
False
_pf_
context
=
{
'started_by_sshuttle'
:
False
,
'Xtoken'
:
''
}
def
do_pf
(
port
,
dnsport
,
family
,
subnets
,
udp
):
global
_pf_started_by_sshuttle
...
...
@@ -513,16 +514,11 @@ def do_pf(port, dnsport, family, subnets, udp):
pf_add_anchor_rule
(
PF_RDR
,
"sshuttle"
)
if
not
'
\n
anchor "sshuttle" all
\n
'
in
pf_status
:
pf_add_anchor_rule
(
PF_PASS
,
"sshuttle"
)
if
not
'INFO:
\n
Status: Enabled'
in
pf_status
:
pfctl
(
'-e'
)
_pf_started_by_sshuttle
=
True
pfctl
(
'-a sshuttle -f /dev/stdin'
,
rules
)
o
=
pfctl
(
'-a sshuttle -f /dev/stdin -E'
,
rules
)
_pf_context
[
'Xtoken'
]
=
re
.
search
(
r'Token : (.+)'
,
o
[
1
])
.
group
(
1
)
else
:
pfctl
(
'-a sshuttle -F all'
)
if
_pf_started_by_sshuttle
:
pfctl
(
'-d'
)
pfctl
(
'-a sshuttle -F all -X
%
s'
%
_pf_context
[
'Xtoken'
])
def
program_exists
(
name
):
...
...
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