summaryrefslogtreecommitdiff
path: root/bonafide
diff options
context:
space:
mode:
Diffstat (limited to 'bonafide')
-rw-r--r--bonafide/README.rst3
-rw-r--r--bonafide/src/leap/bonafide/_protocol.py2
-rw-r--r--bonafide/src/leap/bonafide/_srp.py2
-rw-r--r--bonafide/src/leap/bonafide/ssh_service.py2
-rw-r--r--bonafide/src/leap/bonafide/ws_service.py1
-rw-r--r--bonafide/src/leap/bonafide/zmq_service.py14
6 files changed, 18 insertions, 6 deletions
diff --git a/bonafide/README.rst b/bonafide/README.rst
index 1a4e44eb..2e10764f 100644
--- a/bonafide/README.rst
+++ b/bonafide/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/bonafide/src/leap/bonafide/_protocol.py b/bonafide/src/leap/bonafide/_protocol.py
index b093b9cc..6a1c3d25 100644
--- a/bonafide/src/leap/bonafide/_protocol.py
+++ b/bonafide/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/bonafide/src/leap/bonafide/_srp.py b/bonafide/src/leap/bonafide/_srp.py
index 4f4a6058..1c711f35 100644
--- a/bonafide/src/leap/bonafide/_srp.py
+++ b/bonafide/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/bonafide/src/leap/bonafide/ssh_service.py b/bonafide/src/leap/bonafide/ssh_service.py
new file mode 100644
index 00000000..3777b10f
--- /dev/null
+++ b/bonafide/src/leap/bonafide/ssh_service.py
@@ -0,0 +1,2 @@
+# TODO expose bonafide protocol through ssh, accessible through a hidden
+# service
diff --git a/bonafide/src/leap/bonafide/ws_service.py b/bonafide/src/leap/bonafide/ws_service.py
new file mode 100644
index 00000000..feaa4b01
--- /dev/null
+++ b/bonafide/src/leap/bonafide/ws_service.py
@@ -0,0 +1 @@
+# TODO expose bonafide protocol through websockets
diff --git a/bonafide/src/leap/bonafide/zmq_service.py b/bonafide/src/leap/bonafide/zmq_service.py
index df8e2344..38c0305c 100644
--- a/bonafide/src/leap/bonafide/zmq_service.py
+++ b/bonafide/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]