From 0b5267dfc3ada8256d6fb265f16fc2bb59929e38 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Fri, 13 Jan 2017 18:56:55 +0100 Subject: Strip kerberos authentication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was mostly just a play-thing, specific to me, and not currently set up. Signed-off-by: Johannes Löthberg --- application.cfg | 3 +-- run.py | 37 ------------------------------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/application.cfg b/application.cfg index 423d539..2f670f5 100644 --- a/application.cfg +++ b/application.cfg @@ -1,6 +1,5 @@ PORT = 7000 DEBUG = True -URL = 'https://zlv.localhost/' +URL = 'http://localhost:7000' 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 c89040f..58951aa 100755 --- a/run.py +++ b/run.py @@ -1,6 +1,5 @@ #!/usr/bin/env python from flask import Flask, send_from_directory, render_template, session, abort -from flask_kerberos import init_kerberos, requires_authentication from classes import Network, Channel, Log from urllib.parse import quote_plus import sys, os @@ -11,17 +10,6 @@ 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) @@ -30,7 +18,6 @@ def get_files(directory): @app.route('/') def index(): - authenticated() networks = [] for network_name in get_files(app.config['ZNC_LOG_DIR']): network_url = '{}/{}'.format(app.config['URL'], network_name) @@ -46,7 +33,6 @@ def index(): @app.route('/') def get_network(network_name): - authenticated() network_url = '{}/{}'.format(app.config['URL'], network_name) channels = [] @@ -61,7 +47,6 @@ def get_network(network_name): @app.route('//') def channel_logs(network_name, channel_name): - authenticated() network_url = '{}/{}'.format(app.config['URL'], network_name) channel_url = '{}/{}'.format(network_url, quote_plus(channel_name)) @@ -78,7 +63,6 @@ def channel_logs(network_name, channel_name): @app.route('///') def get_log(network_name, channel_name, log_file): - authenticated() with open(os.path.join(app.config['ZNC_LOG_DIR'], network_name, channel_name, log_file), 'rb') as file: log = file.read().decode('utf-8', 'ignore') return(render_template('log.html', log=log)) @@ -87,27 +71,6 @@ def get_log(network_name, channel_name, log_file): def send_static(filename): return send_from_directory('static', filename) -@app.route('/login') -@requires_authentication -def login(principal): - if principal == 'kyrias@KYRIASIS.COM': - session['logged_in'] = True - - else: - session.pop('logged_in', None) - return abort(401) - - if session['logged_in']: - return ''' - Logged in! index - ''' - -def authenticated(): - if not session.get('logged_in'): - abort(401) - else: - return True - @app.route('/favicon.ico') def favicon(): return abort(404) -- cgit v1.2.3-54-g00ecf