diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2017-01-13 18:56:55 +0100 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2017-01-13 18:56:55 +0100 |
commit | 0b5267dfc3ada8256d6fb265f16fc2bb59929e38 (patch) | |
tree | 3a7fda36e9a56122689ce7ae385738cd29a0c7eb | |
parent | 99ae63edbdab9cfac7cb46022e61797982c179fc (diff) | |
download | znc-log-viewer-0b5267dfc3ada8256d6fb265f16fc2bb59929e38.tar.xz |
It was mostly just a play-thing, specific to me, and not currently set
up.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
-rw-r--r-- | application.cfg | 3 | ||||
-rwxr-xr-x | run.py | 37 |
2 files changed, 1 insertions, 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' @@ -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('/<network_name>') 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('/<network_name>/<channel_name>') 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('/<network_name>/<channel_name>/<log_file>') 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! <a href="/">index</a> - ''' - -def authenticated(): - if not session.get('logged_in'): - abort(401) - else: - return True - @app.route('/favicon.ico') def favicon(): return abort(404) |