[tor-bugs] #30045 [Core Tor/Tor]: output of "tor --key-expiration sign" should be a time stamp

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Sep 9 14:50:55 UTC 2019


#30045: output of "tor --key-expiration sign" should be a time stamp
--------------------------+------------------------------------
 Reporter:  toralf        |          Owner:  (none)
     Type:  enhancement   |         Status:  new
 Priority:  Medium        |      Milestone:  Tor: unspecified
Component:  Core Tor/Tor  |        Version:  Tor: 0.4.0.3-alpha
 Severity:  Normal        |     Resolution:
 Keywords:                |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------

Comment (by toralf):

 In the mean while I do have this
 {{{

 @daily   [[ $(/opt/torutils/key-expires.py
 /var/lib/tor/data/keys/ed25519_signing_cert)  -lt 864000 ]] && echo "Tor
 key is expiring soon"
 @daily   [[ $(/opt/torutils/key-expires.py
 /var/lib/tor/data2/keys/ed25519_signing_cert) -lt 864000 ]] && echo "Tor2
 key is expiring soon"

 # cat /opt/torutils/key-expires.py
 #!/usr/bin/env python3

 # put out the time (in seconds) before the key expires

 import codecs
 import sys
 import time

 # eg.: /var/lib/tor/data2/keys/ed25519_signing_cert
 #
 with open(sys.argv[1], 'rb') as f:
     cert = f.read()
     expire = int(codecs.encode(cert[35:38], 'hex'), 16) * 3600
     now = time.time()
     print(int(expire-now))
 }}}
 which does the job for me.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/30045#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list