v.licheni.net
/
stack
/
cam.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f054c99
)
print expiration dates in the "list" command
author
ale
<ale@incal.net>
Mon, 6 Feb 2012 19:55:14 +0000
(19:55 +0000)
committer
ale
<ale@incal.net>
Mon, 6 Feb 2012 19:55:14 +0000
(19:55 +0000)
cam/main.py
patch
|
blob
|
history
diff --git
a/cam/main.py
b/cam/main.py
index
538697e
..
a925df3
100755
(executable)
--- a/
cam/main.py
+++ b/
cam/main.py
@@
-87,8
+87,18
@@
def main():
print c.public_key_file
print c.private_key_file
elif cmd == 'list':
print c.public_key_file
print c.private_key_file
elif cmd == 'list':
+ now = time.time()
for cert in sorted(certs, key=lambda x: x.name):
for cert in sorted(certs, key=lambda x: x.name):
- print cert.name, cert.cn, cert.get_expiration_date()
+ expiry = cert.get_expiration_date()
+ state = 'OK'
+ expiry_str = ''
+ if not expiry:
+ state = 'MISSING'
+ else:
+ if expiry < now:
+ state = 'EXPIRED'
+ expiry_str = time.strftime('%Y/%m/%d', time.gmtime(expiry))
+ print cert.name, cert.cn, state, expiry_str
elif cmd == 'fp' or cmd == 'fingerprint':
if len(args) > 0:
certs = [find_cert(certs, x) for x in args]
elif cmd == 'fp' or cmd == 'fingerprint':
if len(args) > 0:
certs = [find_cert(certs, x) for x in args]