From 1b74594f5b5716a5f55535766663ee9c666c7148 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Fri, 16 Nov 2018 10:55:53 -0500 Subject: [PATCH] don't create ssl/auth keys if disabled fixes https://github.com/lbryio/lbry/issues/1624 --- lbrynet/extras/daemon/auth/factory.py | 2 +- lbrynet/extras/daemon/auth/server.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lbrynet/extras/daemon/auth/factory.py b/lbrynet/extras/daemon/auth/factory.py index 163d49fe0..77f573baa 100644 --- a/lbrynet/extras/daemon/auth/factory.py +++ b/lbrynet/extras/daemon/auth/factory.py @@ -42,7 +42,7 @@ class AuthJSONRPCResource(resource.Resource): realm = HttpPasswordRealm(self) portal_to_realm = portal.Portal(realm, [checker, ]) root = guard.HTTPAuthSessionWrapper( - portal_to_realm, [guard.BasicCredentialFactory('Login to lbrynet api'), ] + portal_to_realm, [guard.BasicCredentialFactory(b'Login to lbrynet api'), ] ) else: log.info("Using non-authenticated API") diff --git a/lbrynet/extras/daemon/auth/server.py b/lbrynet/extras/daemon/auth/server.py index 82f814cf8..8678c4e79 100644 --- a/lbrynet/extras/daemon/auth/server.py +++ b/lbrynet/extras/daemon/auth/server.py @@ -206,7 +206,6 @@ class AuthJSONRPCServer(AuthorizedBase): self.announced_startup = False self.sessions = {} self.server = None - self.keyring = Keyring.generate_and_save() @defer.inlineCallbacks def start_listening(self): @@ -284,7 +283,10 @@ class AuthJSONRPCServer(AuthorizedBase): return d def get_server_factory(self): - return AuthJSONRPCResource(self).getServerFactory(self.keyring, self._use_authentication, self._use_https) + keyring = None + if self._use_authentication or self._use_https: + keyring = Keyring.generate_and_save() + return AuthJSONRPCResource(self).getServerFactory(keyring, self._use_authentication, self._use_https) def _set_headers(self, request, data, update_secret=False): if conf.settings['allowed_origin']: