From 65f260d0ba7b925ad9258b8edcb28ab40b2321fe Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Tue, 17 Dec 2013 13:37:20 +0100 Subject: [PATCH] show session-key on application startup Maybe useful to see that it really changes if unset. Also reduced key size to 16 bytes form /dev/urandom (cosmetic reason, still enough). --- isso/__init__.py | 4 ++++ isso/core.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/isso/__init__.py b/isso/__init__.py index 6346e36..c77b07e 100644 --- a/isso/__init__.py +++ b/isso/__init__.py @@ -155,6 +155,10 @@ def make_app(conf=None, threading=True, multiprocessing=False, uwsgi=False): isso = App(conf) + # show session-key (to see that it changes randomely if unset) + logger.info("session-key = %s", isso.conf.get("general", "session-key")) + + # check HTTP server connection for host in conf.getiter("general", "host"): with http.curl('HEAD', host, '/', 5) as resp: if resp is not None: diff --git a/isso/core.py b/isso/core.py index 066194d..ba14201 100644 --- a/isso/core.py +++ b/isso/core.py @@ -106,7 +106,7 @@ class Config: default = [ "[general]", "name = ", - "dbpath = /tmp/isso.db", "session-key = %r" % binascii.b2a_hex(os.urandom(24)), + "dbpath = /tmp/isso.db", "session-key = %s" % binascii.b2a_hex(os.urandom(16)), "host = http://localhost:8080/", "max-age = 15m", "notify = ", "[moderation]",