-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'opnsense:master' into master
- Loading branch information
Showing
93 changed files
with
4,856 additions
and
462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/local/bin/python3 | ||
""" | ||
Copyright (c) 2022 Ad Schellevis <ad@opnsense.org> | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, | ||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. | ||
""" | ||
import os | ||
import argparse | ||
import re | ||
from jinja2 import Template | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('-template_filename', default='source/support.rst.in', help='') | ||
parser.add_argument('source', help='source directory') | ||
cmd_args = parser.parse_args() | ||
|
||
# collect all plugins | ||
plugin_tiers = dict() | ||
for root, dirs, files in os.walk(cmd_args.source): | ||
if 'Makefile' in files and 'pkg-descr' in files: | ||
plugin_tier = 3 | ||
with open(os.path.join(root, 'Makefile'), 'rt') as f_in: | ||
for line in f_in.read().split('\n'): | ||
parts = line.split() | ||
if len(parts) >= 2 and parts[0].startswith('PLUGIN_TIER') and parts[-1].isdigit(): | ||
plugin_tier = int(parts[-1]) | ||
plugin_name = root[len(cmd_args.source)+1:] | ||
if plugin_tier not in plugin_tiers: | ||
plugin_tiers[plugin_tier] = {} | ||
plugin_tiers[plugin_tier][plugin_name] = { | ||
'tier': plugin_tier, | ||
'name': plugin_name | ||
} | ||
with open(os.path.join(root, 'pkg-descr'), 'rt') as f_in: | ||
descr = f_in.read().strip().split('\n\n')[0].replace('\n', ' ').replace('"', "'") | ||
plugin_tiers[plugin_tier][plugin_name]['descr'] = descr | ||
|
||
template = Template(open(cmd_args.template_filename, "rt").read()) | ||
if cmd_args.template_filename.endswith('.in'): | ||
with open(cmd_args.template_filename[:-3], 'w') as f_out: | ||
f_out.write(template.render({'tiers': plugin_tiers})) | ||
else: | ||
print(template.render({'tiers': plugin_tiers})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.. _api_core_firewall: | ||
|
||
{{ title }} | ||
{{ title_underline }} | ||
{% for controller in controllers %} | ||
.. csv-table:: {{controller.type}} ({{controller.filename}}) | ||
:header: "Method", "Module", "Controller", "Command", "Parameters" | ||
:widths: 4, 15, 15, 30, 40 | ||
{% for endpoint in controller.endpoints %} | ||
"``{{endpoint.method}}``","{{endpoint.module}}","{{endpoint.controller}}","{{endpoint.command}}","{{endpoint.parameters}}" | ||
{%- endfor %} | ||
{%- if controller.uses %} | ||
{% for use in controller.uses %} | ||
"``<<uses>>``", "", "", "", "*{{use.type}}* `{{use.name}} <{{use.link}}>`__" | ||
{%- endfor %} | ||
{%- endif %} | ||
{% endfor %} | ||
|
||
.. Tip:: | ||
|
||
In order to inject rules using an API, you may take a look at the :ref:`Firewall Plugin API <api_plugins_firewall>`, | ||
currently the core system does not support rule modifications via the API for this topic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.