summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-02-16 18:22:19 +0000
committerJohannes Löthberg <johannes@kyriasis.com>2015-02-16 18:22:19 +0000
commit8e83e9668f9c0d7429f759496642bee94951bb6b (patch)
tree5276f3fd30a7f6233b79ff18fc7c2a4f6c9c52fa
parent843594a43b7c4b335145e21ad1849c3a46b52d38 (diff)
downloadznc-log-viewer-8e83e9668f9c0d7429f759496642bee94951bb6b.tar.xz
Set kkeytab and init flask_kerberos
-rw-r--r--application.cfg3
-rwxr-xr-xrun.py13
2 files changed, 15 insertions, 1 deletions
diff --git a/application.cfg b/application.cfg
index 80dd60b..423d539 100644
--- a/application.cfg
+++ b/application.cfg
@@ -1,5 +1,6 @@
PORT = 7000
DEBUG = True
-URL = 'https://zlv.localhost'
+URL = 'https://zlv.localhost/'
ZNC_LOG_DIR = '/path/to/znc/logdir'
SECRET_KEY = 'GENERATE_A_SECRET_KEY'
+KRB5_KTNAME = '/path/to/keytab'
diff --git a/run.py b/run.py
index 0583ed9..2608212 100755
--- a/run.py
+++ b/run.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
from flask import Flask, send_from_directory, render_template, url_for
+from flask_kerberos import init_kerberos
from classes import Network, Channel, Log
from urllib.parse import quote_plus
import sys, os
@@ -10,6 +11,18 @@ app.config.from_pyfile('application.cfg', silent=True)
app.jinja_env.add_extension('jinja2_highlight.HighlightExtension')
app.jinja_env.extend(jinja2_highlight_cssclass = 'codehilite')
+if not "KRB5_KTNAME" in os.environ:
+ try:
+ os.environ['KRB5_KTNAME'] = app.config['KRB5_KTNAME']
+ except KeyError:
+ print("Error: No KEYTAB specified in config and \
+ KRB5_KTNAME envvar not set",
+ file=sys.stderr)
+ sys.exit(1)
+
+init_kerberos(app)
+
+
def get_files(directory):
files = os.listdir(directory)
files.sort()