From 8e83e9668f9c0d7429f759496642bee94951bb6b Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Mon, 16 Feb 2015 18:22:19 +0000 Subject: Set kkeytab and init flask_kerberos --- application.cfg | 3 ++- run.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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() -- cgit v1.2.3-70-g09d2