mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
The master and the minion initialize now
This commit is contained in:
parent
3ea46641d7
commit
63b0fff872
2 changed files with 9 additions and 9 deletions
|
@ -111,7 +111,7 @@ class Auth(object):
|
|||
payload['load']['pub'] = open(tmp_pub, 'r').read()
|
||||
return payload
|
||||
|
||||
def decrypt_auth(self, payload):
|
||||
def decrypt_aes(self, aes):
|
||||
'''
|
||||
This function is used to decrypt the aes seed phrase returned from the
|
||||
master server, the seed phrase is decrypted with the ssh rsa host key.
|
||||
|
@ -119,7 +119,7 @@ class Auth(object):
|
|||
Returns the decrypted aes seed key, a string
|
||||
'''
|
||||
key = self.get_priv_key()
|
||||
return key.public_decrypt(payload['load'], 5)
|
||||
return key.private_decrypt(aes, 4)
|
||||
|
||||
def verify_master(self, master_pub, token):
|
||||
'''
|
||||
|
@ -141,7 +141,7 @@ class Auth(object):
|
|||
else:
|
||||
open(m_pub_fn, 'w+').write(master_pub)
|
||||
pub = RSA.load_pub_key(tmp_pub)
|
||||
if pub.private_decrypt(token, 5) == 'salty bacon':
|
||||
if pub.public_decrypt(token, 5) == 'salty bacon':
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -157,11 +157,11 @@ class Auth(object):
|
|||
socket.connect(self.opts['master_uri'])
|
||||
payload = salt.payload.package(self.minion_sign_in_payload())
|
||||
socket.send(payload)
|
||||
load = self.decrypt_auth(salt.payload.unpackage(socket.recv()))
|
||||
if not self.verify_master(load['pub_key'], load['token']):
|
||||
payload = salt.payload.unpackage(socket.recv())
|
||||
if not self.verify_master(payload['pub_key'], payload['token']):
|
||||
return auth
|
||||
auth['aes'] = load['aes']
|
||||
auth['master_publish_port'] = load['master_publish_port']
|
||||
auth['aes'] = self.decrypt_aes(payload['aes'])
|
||||
auth['publish_port'] = payload['publish_port']
|
||||
return auth
|
||||
|
||||
|
||||
|
|
|
@ -75,14 +75,14 @@ class Minion(object):
|
|||
auth = salt.crypt.Auth(self.opts)
|
||||
creds = auth.sign_in()
|
||||
self.aes = creds['aes']
|
||||
self.master_publish_port = creds['master_publish_port']
|
||||
self.publish_port = creds['publish_port']
|
||||
|
||||
def tune_in(self):
|
||||
'''
|
||||
Lock onto the publisher. This is the main event loop for the minion
|
||||
'''
|
||||
master_pub = 'tcp://' + self.opts['master'] + ':'\
|
||||
+ str(self.master_publish_port)
|
||||
+ str(self.publish_port)
|
||||
context = zmq.Context()
|
||||
socket = context.socket(zmq.SUB)
|
||||
socket.connect(master_pub)
|
||||
|
|
Loading…
Add table
Reference in a new issue