summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.rst3
-rw-r--r--src/leap/bonafide/_protocol.py2
-rw-r--r--src/leap/bonafide/_srp.py2
-rw-r--r--src/leap/bonafide/ssh_service.py2
-rw-r--r--src/leap/bonafide/ws_service.py1
-rw-r--r--src/leap/bonafide/zmq_service.py14
6 files changed, 18 insertions, 6 deletions
diff --git a/README.rst b/README.rst
index 1a4e44e..2e10764 100644
--- a/README.rst
+++ b/README.rst
@@ -3,7 +3,8 @@ Bonafide
Bonafide is the protocol for secure user registration, authentication, and provider discovery for the LEAP
applications. See the `Bonafide`_ design docs.
-This is a client implementation, written in python.
+This is a client implementation, written in python. It consists of a python library, a
+twisted service and a command-line interface to interact locally with it.
.. _`Bonafide`: https://leap.se/en/docs/design/bonafide
diff --git a/src/leap/bonafide/_protocol.py b/src/leap/bonafide/_protocol.py
index b093b9c..6a1c3d2 100644
--- a/src/leap/bonafide/_protocol.py
+++ b/src/leap/bonafide/_protocol.py
@@ -115,7 +115,7 @@ class BonafideProtocol(object):
return d
def do_stats(self):
- log.msg('Calculating Bonafide STATS')
+ log.msg('Calculating Bonafide Service STATS')
mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
return '[+] Bonafide service: [%s sessions] [Mem usage: %s KB]' % (
len(self._sessions), mem / 1024)
diff --git a/src/leap/bonafide/_srp.py b/src/leap/bonafide/_srp.py
index 4f4a605..1c711f3 100644
--- a/src/leap/bonafide/_srp.py
+++ b/src/leap/bonafide/_srp.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# srp_auth.py
+# _srp.py
# Copyright (C) 2015 LEAP
#
# This program is free software: you can redistribute it and/or modify
diff --git a/src/leap/bonafide/ssh_service.py b/src/leap/bonafide/ssh_service.py
new file mode 100644
index 0000000..3777b10
--- /dev/null
+++ b/src/leap/bonafide/ssh_service.py
@@ -0,0 +1,2 @@
+# TODO expose bonafide protocol through ssh, accessible through a hidden
+# service
diff --git a/src/leap/bonafide/ws_service.py b/src/leap/bonafide/ws_service.py
new file mode 100644
index 0000000..feaa4b0
--- /dev/null
+++ b/src/leap/bonafide/ws_service.py
@@ -0,0 +1 @@
+# TODO expose bonafide protocol through websockets
diff --git a/src/leap/bonafide/zmq_service.py b/src/leap/bonafide/zmq_service.py
index df8e234..38c0305 100644
--- a/src/leap/bonafide/zmq_service.py
+++ b/src/leap/bonafide/zmq_service.py
@@ -14,11 +14,13 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
"""
Bonafide ZMQ Service.
"""
+
from leap.bonafide import config
-from leap.bonafide.protocol import BonafideProtocol, COMMANDS
+from leap.bonafide._protocol import BonafideProtocol, COMMANDS
from txzmq import ZmqEndpoint, ZmqFactory, ZmqREPConnection
@@ -27,6 +29,8 @@ from twisted.internet import reactor
from twisted.python import log
+# TODO [] should shutdown all the ongoing connections when stopping the service
+
class BonafideZMQService(service.Service):
def __init__(self):
@@ -36,9 +40,14 @@ class BonafideZMQService(service.Service):
def startService(self):
zf = ZmqFactory()
e = ZmqEndpoint("bind", config.ENDPOINT)
+
self._conn = _BonafideZmqREPConnection(zf, e, self._bonafide)
reactor.callWhenRunning(self._conn.do_greet)
+ #def stopService(self):
+ # pass
+
+
class _BonafideZmqREPConnection(ZmqREPConnection):
@@ -50,7 +59,7 @@ class _BonafideZmqREPConnection(ZmqREPConnection):
print "Bonafide service running..."
def do_bye(self):
- print "[+] Bonafide service stopped. Have a nice day."
+ print "Bonafide service stopped. Have a nice day."
reactor.stop()
def gotMessage(self, msgId, *parts):
@@ -59,7 +68,6 @@ class _BonafideZmqREPConnection(ZmqREPConnection):
def log_err(failure):
log.err(failure)
- print "FAILURE", failure
defer_reply("ERROR: %r" % failure)
cmd = parts[0]