mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-22 16:25:17 +00:00
Use local time for connected_since
This commit is contained in:
parent
108c2bc017
commit
4c1e72709c
@ -1,10 +1,13 @@
|
||||
|
||||
from datetime import datetime
|
||||
from dateutil import tz
|
||||
from pyasn1.codec.der import decoder
|
||||
from certidude import config
|
||||
from certidude.auth import login_required, authorize_admin
|
||||
from certidude.decorators import serialize
|
||||
|
||||
localtime = tz.tzlocal()
|
||||
|
||||
OIDS = {
|
||||
(2, 5, 4, 3) : 'CN', # common name
|
||||
(2, 5, 4, 6) : 'C', # country
|
||||
@ -39,10 +42,12 @@ class StatusFileLeaseResource(object):
|
||||
from openvpn_status import parse_status
|
||||
from urllib import urlopen
|
||||
fh = urlopen(self.uri)
|
||||
# openvpn-status.log has no information about timezone
|
||||
# and dates marked there use local time instead of UTC
|
||||
status = parse_status(fh.read())
|
||||
for cn, e in status.routing_table.items():
|
||||
yield {
|
||||
"acquired": status.client_list[cn].connected_since,
|
||||
"acquired": status.client_list[cn].connected_since.replace(tzinfo=localtime)
|
||||
"released": None,
|
||||
"address": e.virtual_address,
|
||||
"identity": "CN=%s" % cn, # BUGBUG
|
||||
|
Loading…
Reference in New Issue
Block a user