mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
DNSSEC: Store time & date key metadata in UTC.
OpenDNSSEC stores key metadata in local time zone but BIND needs timestamps in UTC. UTC will be stored in LDAP. https://fedorahosted.org/freeipa/ticket/4657 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
57429c1cfa
commit
fe6819eb9d
@ -17,6 +17,7 @@ Purpose of this replacement is to upload keys generated by OpenDNSSEC to LDAP.
|
||||
|
||||
from binascii import hexlify
|
||||
from datetime import datetime
|
||||
import dateutil.tz
|
||||
import dns.dnssec
|
||||
import fcntl
|
||||
import logging
|
||||
@ -80,7 +81,12 @@ def datetime2ldap(dt):
|
||||
return dt.strftime(ipalib.constants.LDAP_GENERALIZED_TIME_FORMAT)
|
||||
|
||||
def sql2datetime(sql_time):
|
||||
return datetime.strptime(sql_time, "%Y-%m-%d %H:%M:%S")
|
||||
"""Convert SQL date format from local time zone into UTC."""
|
||||
localtz = dateutil.tz.tzlocal()
|
||||
localtime = datetime.strptime(sql_time, "%Y-%m-%d %H:%M:%S").replace(
|
||||
tzinfo=localtz)
|
||||
utctz = dateutil.tz.gettz('UTC')
|
||||
return localtime.astimezone(utctz)
|
||||
|
||||
def sql2datetimes(row):
|
||||
row2key_map = {'generate': 'idnsSecKeyCreated',
|
||||
|
Loading…
Reference in New Issue
Block a user