Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
config.py
instance_config_override.py
run.py
migrations/

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The REST API is documented using Swagger (OpenAPI). After installing and running


## Change Log
- 1.1.5 - introduced instance config override. Copy the sample to instance_config_override.py and customize you dashboard menu items easily. For normal installations no override is needed.
- 1.1.4 - minor bug fixes and code cleanup
- 1.1.3 - introduced configurable footer menu for links in bottom of the default template
- 1.1.2 - minor security updates (removed unused JS files), setup.py now reads dependencies from requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion flowapp/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.4"
__version__ = "1.1.5"
6 changes: 6 additions & 0 deletions flowapp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def create_app(config_object=None):
if config_object:
app.config.from_object(config_object)

# Allow override of instance config from external file
try:
app.config.from_pyfile("../instance_config_override.py", silent=False)
except FileNotFoundError:
pass # No override file, use defaults

app.config.setdefault("VERSION", __version__)

# SSO configuration
Expand Down
2 changes: 1 addition & 1 deletion flowapp/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
DEFAULT_ORDER = "desc"

# Maximum allowed comma separated values for port string or packet lenght
MAX_COMMA_VALUES = 6
MAX_COMMA_VALUES = 5

SORT_ARG = "sort"
ORDER_ARG = "order"
Expand Down
98 changes: 98 additions & 0 deletions instance_config_override.example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# This file can be simply ignored if you do not need to override anything

# Example instance config override
# If you need to override some settings, you can do it here.
# Copy this to instance_config_override.py and customize


# column names for tables
RTBH_COLUMNS = (
("ipv4", "IP address (v4 or v6)"),
("community_id", "Community"),
("expires", "Expires"),
("user_id", "User"),
)

WHITELIST_COLUMNS = (
("address", "IP address / network (v4 or v6)"),
("expires", "Expires"),
("user_id", "User"),
)


RULES_COLUMNS_V4 = (
("source", "Source addr."),
("source_port", "S port"),
("dest", "Dest. addr."),
("dest_port", "D port"),
("protocol", "Proto"),
("packet_len", "Packet len"),
("expires", "Expires"),
("action_id", "Action"),
("flags", "Flags"),
("user_id", "User"),
)

RULES_COLUMNS_V6 = (
("source", "Source addr."),
("source_port", "S port"),
("dest", "Dest. addr."),
("dest_port", "D port"),
("next_header", "Next header"),
("packet_len", "Packet len"),
("expires", "Expires"),
("action_id", "Action"),
("flags", "Flags"),
("user_id", "User"),
)


# Customize main menu
MAIN_MENU = {
"edit": [
{"name": "Add RTBH", "url": "rules.rtbh_rule"},
{"name": "Add Whitelist", "url": "whitelist.add"},
{"name": "API Key", "url": "api_keys.all"},
],
"admin": [
{"name": "Commands Log", "url": "admin.log"},
{"name": "Machine keys", "url": "admin.machine_keys"},
{
"name": "Users",
"url": "admin.users",
"divide_before": True,
},
{"name": "Add User", "url": "admin.user"},
{"name": "Add Multiple Users", "url": "admin.bulk_import_users"},
{"name": "Organizations", "url": "admin.organizations"},
{"name": "Add Org.", "url": "admin.organization"},
{
"name": "Action",
"url": "admin.actions",
"divide_before": True,
},
{"name": "Add action", "url": "admin.action"},
{"name": "RTBH Communities", "url": "admin.communities"},
{"name": "Add RTBH Comm.", "url": "admin.community"},
],
}

# Customize dashboard - only include what you need
DASHBOARD = {
"rtbh": {
"name": "RTBH",
"macro_file": "macros.html",
"macro_tbody": "build_rtbh_tbody",
"macro_thead": "build_rules_thead",
"table_colspan": 5,
"table_columns": RTBH_COLUMNS,
},
"whitelist": {
"name": "Whitelist",
"macro_file": "macros.html",
"macro_tbody": "build_whitelist_tbody",
"macro_thead": "build_rules_thead",
"table_colspan": 4,
"table_columns": WHITELIST_COLUMNS,
},
}