Sistemata versione dello script per la creazione della chiave per il vault.

This commit is contained in:
Emiliano Vavassori 2015-07-14 01:06:00 +02:00
parent 0faf2f2ef4
commit 8dff62b115
1 changed files with 2 additions and 2 deletions

View File

@ -11,11 +11,11 @@ from os import makedirs, path
key = MD5.new(gethostname()).digest()
cipher = AES.new(key, AES.MODE_ECB)
base64enc = get("http://{{ serverfqdn }}:3000/vaultpass")
encrypted = b64decode(base64enc)
encrypted = b64decode(base64enc.content)
longpass = cipher.decrypt(encrypted)
if not path.exists('/root/.ansible'):
makedirs('/root/.ansible')
with open('/root/.ansible/vault.txt', 'w') as vaultfile:
with open('/root/.ansible/vault.txt', 'w+') as vaultfile:
vaultfile.write(longpass.strip('x'))