From 4cd422ee54a07b9bf43e6786f6fe263fa4e59acb Mon Sep 17 00:00:00 2001 From: Olivier DUMAS Date: Mon, 1 Oct 2018 19:15:09 +0200 Subject: [PATCH 01/17] Added a session_timeout setting to manage session lifetime --- app/models.py | 1 + app/views.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/app/models.py b/app/models.py index 4869608..91331cf 100644 --- a/app/models.py +++ b/app/models.py @@ -1808,6 +1808,7 @@ class Setting(db.Model): 'allow_user_create_domain': False, 'bg_domain_updates': False, 'site_name': 'PowerDNS-Admin', + 'session_timeout': 10, 'pdns_api_url': '', 'pdns_api_key': '', 'pdns_version': '4.1.1', diff --git a/app/views.py b/app/views.py index 3311997..9ed1c33 100644 --- a/app/views.py +++ b/app/views.py @@ -3,6 +3,7 @@ import logging as logger import os import traceback import re +import datetime from distutils.util import strtobool from distutils.version import StrictVersion from functools import wraps @@ -68,6 +69,11 @@ def before_request(): if maintenance and current_user.is_authenticated and current_user.role.name not in ['Administrator', 'Operator']: return render_template('maintenance.html') + # Manage session timeout + session.permanent = True + app.permanent_session_lifetime = datetime.timedelta(minutes=int(Setting().get('session_timeout'))) + session.modified = True + g.user = current_user @login_manager.user_loader def load_user(id): From dabc324c520d0e5b45f8d53992aca572193c43a2 Mon Sep 17 00:00:00 2001 From: odumasFR <37532391+odumasFR@users.noreply.github.com> Date: Tue, 2 Oct 2018 08:01:04 +0200 Subject: [PATCH 02/17] Adjust basic settings list Added the new 'session_timeout' setting to the list of rendered basic settings --- app/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views.py b/app/views.py index 9ed1c33..7f5fcb2 100644 --- a/app/views.py +++ b/app/views.py @@ -1375,7 +1375,8 @@ def admin_setting_basic(): 'dnssec_admins_only', 'allow_user_create_domain', 'bg_domain_updates', - 'site_name'] + 'site_name', + 'session_timeout' ] return render_template('admin_setting_basic.html', settings=settings) From 5909de99e9a2a4099c7350076b676b28d842a22b Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 2 Oct 2018 06:56:50 +0000 Subject: [PATCH 03/17] spelling: admin --- app/templates/admin_setting_pdns.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/admin_setting_pdns.html b/app/templates/admin_setting_pdns.html index 3310680..ce44b48 100644 --- a/app/templates/admin_setting_pdns.html +++ b/app/templates/admin_setting_pdns.html @@ -63,7 +63,7 @@
-

You must configure the API connection information before PowerDNS-Admiin can query your PowerDNS data. Following fields are required:

+

You must configure the API connection information before PowerDNS-Admin can query your PowerDNS data. Following fields are required:

PDNS API URL
Your PowerDNS API URL (eg. http://127.0.0.1:8081/).
PDNS API KEY
From 7875be3b780c3eef8ecb8f0b908de36b5ab29dd6 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 2 Oct 2018 07:03:41 +0000 Subject: [PATCH 04/17] spelling: authentication --- config_template.py | 2 +- configs/development.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config_template.py b/config_template.py index 1a1c1f8..4095269 100644 --- a/config_template.py +++ b/config_template.py @@ -31,7 +31,7 @@ SQLALCHEMY_DATABASE_URI = 'mysql://'+SQLA_DB_USER+':'+SQLA_DB_PASSWORD+'@'+SQLA_ # DATABSE - SQLite # SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'pdns.db') -# SAML Authnetication +# SAML Authentication SAML_ENABLED = False SAML_DEBUG = True SAML_PATH = os.path.join(os.path.dirname(__file__), 'saml') diff --git a/configs/development.py b/configs/development.py index 5552eea..5a15098 100644 --- a/configs/development.py +++ b/configs/development.py @@ -24,7 +24,7 @@ SQLALCHEMY_DATABASE_URI = 'mysql://'+DB_USER+':'+DB_PASSWORD+'@'+DB_HOST+'/'+DB_ SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository') SQLALCHEMY_TRACK_MODIFICATIONS = True -# SAML Authnetication +# SAML Authentication SAML_ENABLED = False SAML_DEBUG = True SAML_PATH = os.path.join(os.path.dirname(__file__), 'saml') From 74d49add6da133d9d434da45f3ec478ca4bd524e Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 2 Oct 2018 07:03:55 +0000 Subject: [PATCH 05/17] spelling: building --- docker/PowerDNS-Admin/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/PowerDNS-Admin/Dockerfile b/docker/PowerDNS-Admin/Dockerfile index 807e26d..2dcd2c0 100644 --- a/docker/PowerDNS-Admin/Dockerfile +++ b/docker/PowerDNS-Admin/Dockerfile @@ -28,7 +28,7 @@ RUN apt-get install -y netcat # lib for building mysql db driver RUN apt-get install -y libmysqlclient-dev -# lib for buiding ldap and ssl-based application +# lib for building ldap and ssl-based application RUN apt-get install -y libsasl2-dev libldap2-dev libssl-dev # lib for building python3-saml From d9d3add093ea718e73f39f14ab14d406144eac8f Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 2 Oct 2018 07:04:07 +0000 Subject: [PATCH 06/17] spelling: cannot --- app/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views.py b/app/views.py index 3311997..cc79b50 100644 --- a/app/views.py +++ b/app/views.py @@ -787,7 +787,7 @@ def record_apply(domain_name): else: return make_response(jsonify( result ), 400) except Exception as e: - logging.error('Canot apply record changes. Error: {0}'.format(e)) + logging.error('Cannot apply record changes. Error: {0}'.format(e)) logging.debug(traceback.format_exc()) return make_response(jsonify( {'status': 'error', 'msg': 'Error when applying new changes'} ), 500) From 2efb6742302d8802eb45dae49b1b1efb5925f47b Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 2 Oct 2018 07:06:06 +0000 Subject: [PATCH 07/17] spelling: comparison --- app/templates/user_profile.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/user_profile.html b/app/templates/user_profile.html index 90e9706..d32236f 100644 --- a/app/templates/user_profile.html +++ b/app/templates/user_profile.html @@ -137,7 +137,7 @@ {% endblock %} {% block extrascripts %} - +