minor update
This commit is contained in:
parent
dd9eb6e08b
commit
e670b2fb9b
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# OpenSSH certificate sign with Hashicorp Vault
|
# OpenSSH certificate sign with Hashicorp Vault
|
||||||
# https://github.com/yverry/vault-cert-openssh
|
# - https://github.com/yverry/vault-cert-openssh
|
||||||
#
|
#
|
||||||
# References:
|
# References:
|
||||||
# - https://tools.ietf.org/html/rfc4251.html#section-5
|
# - https://tools.ietf.org/html/rfc4251.html#section-5
|
||||||
# - http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?annotate=HEAD
|
# - https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?annotate=HEAD
|
||||||
# - https://gist.github.com/corny/8264b74a130eb663dbf3d3f0fe0e0ec9
|
# - https://gist.github.com/corny/8264b74a130eb663dbf3d3f0fe0e0ec9
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
import hvac
|
import hvac
|
||||||
|
@ -146,7 +146,12 @@ if __name__ == "__main__":
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
try:
|
try:
|
||||||
with open(sys.argv[1],'r') as f:
|
with open(sys.argv[1],'r') as f:
|
||||||
|
try:
|
||||||
key = Decode(f.read().split(" ")[1])
|
key = Decode(f.read().split(" ")[1])
|
||||||
|
except KeyError as e:
|
||||||
|
print('Unknown key type %s' % str(e))
|
||||||
|
os._exit(-1)
|
||||||
|
|
||||||
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])
|
||||||
vaultRenewKey(sys.argv[1],vault)
|
vaultRenewKey(sys.argv[1],vault)
|
||||||
|
|
Loading…
Reference in a new issue