The expiration timestamp was hard-coded as
2020-12-31T19:14:44.180394
which is now in the past. Instead, use a timestamp
90 minutes in the future.
Fixes: https://tracker.ceph.com/issues/48919
Signed-off-by: Marcus Watts <mwatts@redhat.com>
import logging
import http
import json
+import time
+import math
from urllib.parse import urlparse
token_resp.status < 300):
raise Exception("Cannot authenticate user "+secret["username"]+" for secret creation")
+ expire = time.time() + 5400 # now + 90m
+ (expire_fract,dummy) = math.modf(expire)
+ expire_format = "%%FT%%T.%06d" % (round(expire_fract*1000000))
+ expiration = time.strftime(expire_format, time.gmtime(expire))
token_id = token_resp.getheader('x-subject-token')
key1_json = json.dumps(
{
"name": secret['name'],
- "expiration": "2020-12-31T19:14:44.180394",
+ "expiration": expiration,
"algorithm": "aes",
"bit_length": 256,
"mode": "cbc",