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
f4dac68d
Commit
f4dac68d
authored
Sep 04, 2015
by
Brian May
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16 from prutschman/localhost_fix
Don't redirect excluded subsets of included subnets
parents
e127aab7
3a735203
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
firewall.py
src/firewall.py
+10
-10
No files found.
src/firewall.py
View file @
f4dac68d
...
...
@@ -490,16 +490,16 @@ def do_pf(port, dnsport, family, subnets, udp):
filtering_rules
=
[]
if
subnets
:
include
_subnets
=
filter
(
lambda
s
:
not
s
[
2
],
sorted
(
subnets
,
reverse
=
True
))
if
include_subnets
:
tables
.
append
(
'table <include_subnets> {
%
s}'
%
','
.
join
([
"
%
s/
%
s"
%
(
n
[
3
],
n
[
1
])
for
n
in
include_subnets
]))
translating_rules
.
append
(
'rdr pass on lo0 proto tcp to <include_subnets> -> 127.0.0.1 port
%
r'
%
port
)
filtering_rules
.
append
(
'pass out route-to lo0 inet proto tcp to <include_subnets> keep state'
)
exclude_subnets
=
filter
(
lambda
s
:
s
[
2
],
sorted
(
subnets
,
reverse
=
True
))
if
exclude_subnets
:
tables
.
append
(
'table <exclude_subnets> {
%
s}'
%
','
.
join
([
"
%
s/
%
s"
%
(
n
[
3
],
n
[
1
])
for
n
in
exclude_subnets
])
)
filtering_rules
.
append
(
'pass out quick proto tcp from any to <exclude
_subnets> keep state'
)
include
s
=
[]
# If a given subnet is both included and excluded, list the exclusion
# first; the table will ignore the second, opposite definition
for
f
,
swidth
,
sexclude
,
snet
\
in
sorted
(
subnets
,
key
=
lambda
s
:
(
s
[
1
],
s
[
2
]),
reverse
=
True
):
includes
.
append
(
"
%
s
%
s/
%
s"
%
(
"!"
if
sexclude
else
""
,
snet
,
swidth
))
tables
.
append
(
'table <forward_subnets> {
%
s}'
%
','
.
join
(
includes
))
translating_rules
.
append
(
'rdr pass on lo0 proto tcp to <forward_subnets> -> 127.0.0.1 port
%
r'
%
port
)
filtering_rules
.
append
(
'pass out route-to lo0 inet proto tcp to <forward
_subnets> keep state'
)
if
dnsport
:
nslist
=
resolvconf_nameservers
()
...
...
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