Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Kulya
OpnSense
Commits
a087373e
Commit
a087373e
authored
Mar 01, 2016
by
Ad Schellevis
Committed by
Franco Fichtner
Mar 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(proxy) exclude some file patterns for remote acl's, add one level
(cherry picked from commit
9e339515
)
parent
58445de7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
fetchACLs.py
src/opnsense/scripts/proxy/fetchACLs.py
+15
-1
No files found.
src/opnsense/scripts/proxy/fetchACLs.py
View file @
a087373e
...
...
@@ -113,6 +113,16 @@ class ACLDownload(object):
yield
filename
,
file_type
,
line
def
filename_in_ignorelist
(
filename
):
""" ignore certain files from processing.
:param filename: filename to inspect
"""
if
(
filename
.
lower
()
.
split
(
'.'
)[
-
1
]
in
[
'pdf'
,
'txt'
,
'doc'
]):
return
True
elif
(
filename
.
lower
()
in
(
'readme'
,
'license'
)):
return
True
return
False
# parse OPNsense external ACLs config
if
os
.
path
.
exists
(
acl_config_fn
):
# create acl directory (if new)
...
...
@@ -145,6 +155,10 @@ if os.path.exists(acl_config_fn):
acl
=
ACLDownload
(
download_url
,
acl_max_timeout
)
all_filenames
=
list
()
for
filename
,
filetype
,
line
in
acl
.
download
():
if
filename_in_ignorelist
(
os
.
path
.
basename
(
filename
)):
# ignore documents, licenses and readme's
continue
if
filename
not
in
all_filenames
:
all_filenames
.
append
(
filename
)
...
...
@@ -166,7 +180,7 @@ if os.path.exists(acl_config_fn):
with
open
(
'
%
s.index'
%
target_filename
,
'wb'
)
as
idx_out
:
index_data
=
dict
()
for
filename
in
all_filenames
:
if
len
(
filename
.
split
(
'/'
))
>
3
:
if
len
(
filename
.
split
(
'/'
))
>
2
:
index_key
=
'/'
.
join
(
filename
.
split
(
'/'
)[
1
:
-
1
])
if
index_key
not
in
index_data
:
index_data
[
index_key
]
=
index_key
...
...
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