2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Afetr some feedback, rename it 'collective'

This commit is contained in:
Jarrod Johnson 2018-04-25 13:01:59 -04:00
parent 4155954d1c
commit 033d59b04a
4 changed files with 12 additions and 10 deletions

View File

@ -23,7 +23,7 @@ import eventlet.green.ssl as ssl
try:
import OpenSSL.crypto as crypto
except ImportError:
# while not always required, we use pyopenssl required for at least swarm
# while not always required, we use pyopenssl required for at least collective
crypto = None
swarmcerts = {}
@ -39,7 +39,7 @@ def handle_connection(connection, cert, swarmrequest, local=False):
if 'invite' == operation:
name = swarmrequest['invite']['name']
invitation = invites.create_server_invitation(name)
tlvdata.send(connection, {'swarm': {'invitation': invitation}})
tlvdata.send(connection, {'collective': {'invitation': invitation}})
if 'join' == operation:
invitation = swarmrequest['invitation']
invitation = base64.b64decode(invitation)
@ -60,10 +60,10 @@ def handle_connection(connection, cert, swarmrequest, local=False):
invitation, mycert, cert))
tlvdata.recv(remote) # ignore banner
tlvdata.recv(remote) # ignore authpassed: 0
tlvdata.send(remote, {'swarm': {'operation': 'joinchallenge',
tlvdata.send(remote, {'collective': {'operation': 'joinchallenge',
'name': name, 'hmac': proof}})
rsp = tlvdata.recv(remote)
proof = rsp['swarm']['approval']
proof = rsp['collective']['approval']
j = invites.check_server_proof(invitation, mycert, cert, proof)
if not j:
return
@ -77,6 +77,6 @@ def handle_connection(connection, cert, swarmrequest, local=False):
return
myrsp = base64.b64encode(myrsp)
swarmcerts[swarmrequest['name']] = cert
tlvdata.send(connection, {'swarm': {'approval': myrsp}})
tlvdata.send(connection, {'collective': {'approval': myrsp}})
clientready = tlvdata.recv(connection)
print(repr(clientready))

View File

@ -44,7 +44,7 @@ import confluent.exceptions as exc
import confluent.log as log
import confluent.core as pluginapi
import confluent.shellserver as shellserver
import confluent.swarm.manager as swarm
import confluent.collective.manager as collective
tracelog = None
auditlog = None
@ -116,8 +116,9 @@ def sessionhdl(connection, authname, skipauth=False, cert=None):
while not authenticated: # prompt for name and passphrase
send_data(connection, {'authpassed': 0})
response = tlvdata.recv(connection)
if 'swarm' in response:
return swarm.handle_connection(connection, cert, response['swarm'])
if 'collective' in response:
return collective.handle_connection(connection, cert,
response['collective'])
authname = response['username']
passphrase = response['password']
# note(jbjohnso): here, we need to authenticate, but not
@ -133,8 +134,9 @@ def sessionhdl(connection, authname, skipauth=False, cert=None):
cfm = authdata[1]
send_data(connection, {'authpassed': 1})
request = tlvdata.recv(connection)
if 'swarm' in request and skipauth:
swarm.handle_connection(connection, None, request['swarm'], local=True)
if 'collective' in request and skipauth:
collective.handle_connection(connection, None, request['collective'],
local=True)
while request is not None:
try:
process_request(