diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-02-16 18:22:19 +0000 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-02-16 18:22:19 +0000 |
commit | 8e83e9668f9c0d7429f759496642bee94951bb6b (patch) | |
tree | 5276f3fd30a7f6233b79ff18fc7c2a4f6c9c52fa | |
parent | 843594a43b7c4b335145e21ad1849c3a46b52d38 (diff) | |
download | znc-log-viewer-8e83e9668f9c0d7429f759496642bee94951bb6b.tar.xz |
Set kkeytab and init flask_kerberos
-rw-r--r-- | application.cfg | 3 | ||||
-rwxr-xr-x | run.py | 13 |
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' @@ -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() |