add sealed vault support (quick & dirty)

This commit is contained in:
Verry Yann 2020-03-22 18:16:09 +01:00
parent e670b2fb9b
commit 2c64814975
Signed by: yann
GPG key ID: 19754E8692B8416C

View file

@ -154,11 +154,15 @@ if __name__ == "__main__":
if int(time.time()) > key['valid before']: if int(time.time()) > key['valid before']:
print("Need to renew %s" % sys.argv[1]) print("Need to renew %s" % sys.argv[1])
try:
vaultRenewKey(sys.argv[1],vault) vaultRenewKey(sys.argv[1],vault)
else: except hvac.exceptions.VaultDown:
print("Nothing to do") print("Vault is sealed, unable to renew SSH Key")
except FileNotFoundError: except FileNotFoundError:
try:
vaultRenewKey(sys.argv[1],vault) vaultRenewKey(sys.argv[1],vault)
except hvac.exceptions.VaultDown:
print("Vault is sealed, unable to renew SSH Key")
else: else:
print("Usage: %s [path to certificate]" % sys.argv[0]) print("Usage: %s [path to certificate]" % sys.argv[0])
exit(1) exit(1)