diff --git a/config.example.py b/config.example.py
index 956ba963..c4fa7a8d 100644
--- a/config.example.py
+++ b/config.example.py
@@ -8,10 +8,12 @@ class Config():
# Flask testing
TESTING = False
# SSO auth enabled
- SSO_AUTH = False
+
+ SSO_AUTH = True
# Authentication is done outside the app, use HTTP header to get the user uuid.
# If SSO_AUTH is set to True, this option is ignored and SSO auth is used.
- HEADER_AUTH = True
+ HEADER_AUTH = False
+
# Name of HTTP header containing the UUID of authenticated user.
# Only used when HEADER_AUTH is set to True
AUTH_HEADER_NAME = 'X-Authenticated-User'
diff --git a/docs/AUTH.md b/docs/AUTH.md
index d1b6a31b..fbea38c4 100644
--- a/docs/AUTH.md
+++ b/docs/AUTH.md
@@ -10,9 +10,12 @@ Since version 0.7.3, the application supports three different forms of user auth
### SSO
To use SSO, you need to set up Apache + Shiboleth in the usual way. Then set `SSO_AUTH = True` in the application configuration file **config.py**
+In general the whole app should be protected by Shiboleth. However, there certain endpoints should be excluded from Shiboleth for the interaction with BGP. See configuration example bellow. The endpoints which are not protected by Shibboleth are protected by app itself. Either by @localhost_only decorator or by API key.
+
Shibboleth configuration example:
-#### shibboleth config:
+#### shibboleth config (shib.conf):
+
```
AuthType shibboleth
@@ -20,6 +23,21 @@ Shibboleth configuration example:
require shib-session
+
+
+ Satisfy Any
+ allow from All
+
+
+
+ Satisfy Any
+ allow from All
+
+
+
+ Satisfy Any
+ allow from All
+
```
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
index 9965ee2e..2589709b 100644
--- a/docs/INSTALL.md
+++ b/docs/INSTALL.md
@@ -125,9 +125,9 @@ Supervisord is used to run and manage application.
#### Final steps - as deploy user
-Copy config.example.py to config.py and fill out the DB credetials.
+1. Copy config.example.py to config.py and fill out the DB credetials.
-Create and populate database tables.
+2. Create and populate database tables.
```
cd ~/www
source venv/bin/activate
@@ -135,8 +135,8 @@ python db-init.py
```
DB-init script inserts default roles, actions, rule states and two organizations (TUL and Cesnet). But no users.
-So before start, use your favorite mysql admin tool and insert some users into database.
-The uuid of user should be set the eppn value provided by Shibboleth.
+3. Before start, **use your favorite mysql admin tool and insert some users into database**.
+The **uuid** of user should be set the **eppn** value provided by Shibboleth.
You can use following MYSQL commands to insert the user, give him role 'admin' and add him to the the organization 'Cesnet'.
diff --git a/flowapp/__init__.py b/flowapp/__init__.py
index 536ac51f..a43d6a6b 100644
--- a/flowapp/__init__.py
+++ b/flowapp/__init__.py
@@ -87,13 +87,14 @@ def logout():
def ext_login():
header_name = app.config.get("AUTH_HEADER_NAME", 'X-Authenticated-User')
if header_name not in request.headers:
- return render_template("errors/401.j2")
+ return render_template("errors/401.html")
+
uuid = request.headers.get(header_name)
if uuid:
try:
_register_user_to_session(uuid)
except AttributeError:
- return render_template("errors/401.j2")
+ return render_template("errors/401.html")
return redirect("/")
@app.route("/")
@@ -136,12 +137,12 @@ def shutdown_session(exception=None):
# HTTP error handling
@app.errorhandler(404)
def not_found(error):
- return render_template("errors/404.j2"), 404
+ return render_template("errors/404.html"), 404
@app.errorhandler(500)
def internal_error(exception):
app.logger.error(exception)
- return render_template("errors/500.j2"), 500
+ return render_template("errors/500.html"), 500
@app.context_processor
def utility_processor():
diff --git a/flowapp/instance_config.py b/flowapp/instance_config.py
index d2ae8743..3c8bafbc 100644
--- a/flowapp/instance_config.py
+++ b/flowapp/instance_config.py
@@ -99,15 +99,15 @@ class InstanceConfig:
DASHBOARD = {
"ipv4": {
"name": "IPv4",
- "macro_file": "macros.j2",
+ "macro_file": "macros.html",
"macro_tbody": "build_ip_tbody",
"macro_thead": "build_rules_thead",
"table_colspan": 10,
- "table_columns": RULES_COLUMNS_V6,
+ "table_columns": RULES_COLUMNS_V4,
},
"ipv6": {
"name": "IPv6",
- "macro_file": "macros.j2",
+ "macro_file": "macros.html",
"macro_tbody": "build_ip_tbody",
"macro_thead": "build_rules_thead",
"table_colspan": 10,
@@ -115,7 +115,7 @@ class InstanceConfig:
},
"rtbh": {
"name": "RTBH",
- "macro_file": "macros.j2",
+ "macro_file": "macros.html",
"macro_tbody": "build_rtbh_tbody",
"macro_thead": "build_rules_thead",
"table_colspan": 5,
diff --git a/flowapp/templates/errors/401.html b/flowapp/templates/errors/401.html
new file mode 100755
index 00000000..6da05328
--- /dev/null
+++ b/flowapp/templates/errors/401.html
@@ -0,0 +1,7 @@
+{% extends 'layouts/default.html' %}
+{% block content %}
+
Could not log you in.
+ 401: Unauthorized
+ Please log out and try logging in again.
+ Log out
+{% endblock %}
\ No newline at end of file
diff --git a/flowapp/templates/errors/404.j2 b/flowapp/templates/errors/404.html
similarity index 78%
rename from flowapp/templates/errors/404.j2
rename to flowapp/templates/errors/404.html
index 0bd068c0..8bccd1d7 100644
--- a/flowapp/templates/errors/404.j2
+++ b/flowapp/templates/errors/404.html
@@ -1,4 +1,4 @@
-{% extends 'layouts/default.j2' %}
+{% extends 'layouts/default.html' %}
{% block content %}
Sorry ...
There's nothing here!
diff --git a/flowapp/templates/errors/500.j2 b/flowapp/templates/errors/500.html
similarity index 76%
rename from flowapp/templates/errors/500.j2
rename to flowapp/templates/errors/500.html
index ff0a04be..e6aa9ebf 100644
--- a/flowapp/templates/errors/500.j2
+++ b/flowapp/templates/errors/500.html
@@ -1,4 +1,4 @@
-{% extends 'layouts/default.j2' %}
+{% extends 'layouts/default.html' %}
{% block content %}
Error ...
Sorry ;-)
diff --git a/flowapp/templates/forms/api_key.j2 b/flowapp/templates/forms/api_key.html
similarity index 88%
rename from flowapp/templates/forms/api_key.j2
rename to flowapp/templates/forms/api_key.html
index d1128583..9d8901cb 100644
--- a/flowapp/templates/forms/api_key.j2
+++ b/flowapp/templates/forms/api_key.html
@@ -1,5 +1,5 @@
-{% extends 'layouts/default.j2' %}
-{% from 'forms/macros.j2' import render_field %}
+{% extends 'layouts/default.html' %}
+{% from 'forms/macros.html' import render_field %}
{% block title %}Add New Machine with ApiKey{% endblock %}
{% block content %}
Add new ApiKey for your machine
diff --git a/flowapp/templates/forms/ipv4_rule.j2 b/flowapp/templates/forms/ipv4_rule.html
similarity index 96%
rename from flowapp/templates/forms/ipv4_rule.j2
rename to flowapp/templates/forms/ipv4_rule.html
index 38427809..c1c7d233 100644
--- a/flowapp/templates/forms/ipv4_rule.j2
+++ b/flowapp/templates/forms/ipv4_rule.html
@@ -1,5 +1,5 @@
-{% extends 'layouts/default.j2' %}
-{% from 'forms/macros.j2' import render_field %}
+{% extends 'layouts/default.html' %}
+{% from 'forms/macros.html' import render_field %}
{% block title %}Add IPv4 rule{% endblock %}
{% block content %}
{{ title or 'New'}} IPv4 rule
diff --git a/flowapp/templates/forms/ipv6_rule.j2 b/flowapp/templates/forms/ipv6_rule.html
similarity index 96%
rename from flowapp/templates/forms/ipv6_rule.j2
rename to flowapp/templates/forms/ipv6_rule.html
index 2732ee7e..8929c99e 100644
--- a/flowapp/templates/forms/ipv6_rule.j2
+++ b/flowapp/templates/forms/ipv6_rule.html
@@ -1,5 +1,5 @@
-{% extends 'layouts/default.j2' %}
-{% from 'forms/macros.j2' import render_field %}
+{% extends 'layouts/default.html' %}
+{% from 'forms/macros.html' import render_field %}
{% block title %}Add IPv6 rule{% endblock %}
{% block content %}
{{ title or 'New'}} IPv6 rule
diff --git a/flowapp/templates/forms/macros.j2 b/flowapp/templates/forms/macros.html
similarity index 100%
rename from flowapp/templates/forms/macros.j2
rename to flowapp/templates/forms/macros.html
diff --git a/flowapp/templates/forms/rtbh_rule.j2 b/flowapp/templates/forms/rtbh_rule.html
similarity index 95%
rename from flowapp/templates/forms/rtbh_rule.j2
rename to flowapp/templates/forms/rtbh_rule.html
index ebb0e8b1..986c081b 100644
--- a/flowapp/templates/forms/rtbh_rule.j2
+++ b/flowapp/templates/forms/rtbh_rule.html
@@ -1,5 +1,5 @@
-{% extends 'layouts/default.j2' %}
-{% from 'forms/macros.j2' import render_field %}
+{% extends 'layouts/default.html' %}
+{% from 'forms/macros.html' import render_field %}
{% block title %}Add RTBH rule{% endblock %}
{% block content %}
{{ title or 'New'}} RTBH rule
diff --git a/flowapp/templates/forms/rule.j2 b/flowapp/templates/forms/rule.html
similarity index 98%
rename from flowapp/templates/forms/rule.j2
rename to flowapp/templates/forms/rule.html
index 5d03bc4d..1a1c94bb 100644
--- a/flowapp/templates/forms/rule.j2
+++ b/flowapp/templates/forms/rule.html
@@ -1,4 +1,4 @@
-{% extends 'layouts/default.j2' %}
+{% extends 'layouts/default.html' %}
{% block title %}Add IPv4 rule{% endblock %}
{% block content %}