Skip to content

Commit 6a10a97

Browse files
authored
Merge pull request #67 from CESNET/develop
Version 1.1.5.
2 parents 0cf0bc1 + ad8ef94 commit 6a10a97

6 files changed

Lines changed: 108 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
config.py
2+
instance_config_override.py
23
run.py
34
migrations/
45

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The REST API is documented using Swagger (OpenAPI). After installing and running
5959

6060

6161
## Change Log
62+
- 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.
6263
- 1.1.4 - minor bug fixes and code cleanup
6364
- 1.1.3 - introduced configurable footer menu for links in bottom of the default template
6465
- 1.1.2 - minor security updates (removed unused JS files), setup.py now reads dependencies from requirements.txt

flowapp/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1.4"
1+
__version__ = "1.1.5"

flowapp/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ def create_app(config_object=None):
3030
if config_object:
3131
app.config.from_object(config_object)
3232

33+
# Allow override of instance config from external file
34+
try:
35+
app.config.from_pyfile("../instance_config_override.py", silent=False)
36+
except FileNotFoundError:
37+
pass # No override file, use defaults
38+
3339
app.config.setdefault("VERSION", __version__)
3440

3541
# SSO configuration

flowapp/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
DEFAULT_ORDER = "desc"
1010

1111
# Maximum allowed comma separated values for port string or packet lenght
12-
MAX_COMMA_VALUES = 6
12+
MAX_COMMA_VALUES = 5
1313

1414
SORT_ARG = "sort"
1515
ORDER_ARG = "order"
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# This file can be simply ignored if you do not need to override anything
2+
3+
# Example instance config override
4+
# If you need to override some settings, you can do it here.
5+
# Copy this to instance_config_override.py and customize
6+
7+
8+
# column names for tables
9+
RTBH_COLUMNS = (
10+
("ipv4", "IP address (v4 or v6)"),
11+
("community_id", "Community"),
12+
("expires", "Expires"),
13+
("user_id", "User"),
14+
)
15+
16+
WHITELIST_COLUMNS = (
17+
("address", "IP address / network (v4 or v6)"),
18+
("expires", "Expires"),
19+
("user_id", "User"),
20+
)
21+
22+
23+
RULES_COLUMNS_V4 = (
24+
("source", "Source addr."),
25+
("source_port", "S port"),
26+
("dest", "Dest. addr."),
27+
("dest_port", "D port"),
28+
("protocol", "Proto"),
29+
("packet_len", "Packet len"),
30+
("expires", "Expires"),
31+
("action_id", "Action"),
32+
("flags", "Flags"),
33+
("user_id", "User"),
34+
)
35+
36+
RULES_COLUMNS_V6 = (
37+
("source", "Source addr."),
38+
("source_port", "S port"),
39+
("dest", "Dest. addr."),
40+
("dest_port", "D port"),
41+
("next_header", "Next header"),
42+
("packet_len", "Packet len"),
43+
("expires", "Expires"),
44+
("action_id", "Action"),
45+
("flags", "Flags"),
46+
("user_id", "User"),
47+
)
48+
49+
50+
# Customize main menu
51+
MAIN_MENU = {
52+
"edit": [
53+
{"name": "Add RTBH", "url": "rules.rtbh_rule"},
54+
{"name": "Add Whitelist", "url": "whitelist.add"},
55+
{"name": "API Key", "url": "api_keys.all"},
56+
],
57+
"admin": [
58+
{"name": "Commands Log", "url": "admin.log"},
59+
{"name": "Machine keys", "url": "admin.machine_keys"},
60+
{
61+
"name": "Users",
62+
"url": "admin.users",
63+
"divide_before": True,
64+
},
65+
{"name": "Add User", "url": "admin.user"},
66+
{"name": "Add Multiple Users", "url": "admin.bulk_import_users"},
67+
{"name": "Organizations", "url": "admin.organizations"},
68+
{"name": "Add Org.", "url": "admin.organization"},
69+
{
70+
"name": "Action",
71+
"url": "admin.actions",
72+
"divide_before": True,
73+
},
74+
{"name": "Add action", "url": "admin.action"},
75+
{"name": "RTBH Communities", "url": "admin.communities"},
76+
{"name": "Add RTBH Comm.", "url": "admin.community"},
77+
],
78+
}
79+
80+
# Customize dashboard - only include what you need
81+
DASHBOARD = {
82+
"rtbh": {
83+
"name": "RTBH",
84+
"macro_file": "macros.html",
85+
"macro_tbody": "build_rtbh_tbody",
86+
"macro_thead": "build_rules_thead",
87+
"table_colspan": 5,
88+
"table_columns": RTBH_COLUMNS,
89+
},
90+
"whitelist": {
91+
"name": "Whitelist",
92+
"macro_file": "macros.html",
93+
"macro_tbody": "build_whitelist_tbody",
94+
"macro_thead": "build_rules_thead",
95+
"table_colspan": 4,
96+
"table_columns": WHITELIST_COLUMNS,
97+
},
98+
}

0 commit comments

Comments
 (0)