Create JWK formatted key on startup
This commit is contained in:
parent
8595140f38
commit
cf5f7aa476
2 changed files with 2 additions and 17 deletions
Binary file not shown.
19
boot.py
19
boot.py
|
@ -19,26 +19,11 @@ def create_quay_service_key(seconds_until_expiration):
|
||||||
expiration = timedelta(seconds=seconds_until_expiration)
|
expiration = timedelta(seconds=seconds_until_expiration)
|
||||||
private_key, service_key = generate_service_key('quay', datetime.now()+expiration)
|
private_key, service_key = generate_service_key('quay', datetime.now()+expiration)
|
||||||
approve_service_key(service_key.kid, None, ServiceKeyApprovalType.SUPERUSER)
|
approve_service_key(service_key.kid, None, ServiceKeyApprovalType.SUPERUSER)
|
||||||
|
jwk = RSAKey(key=private_key).serialize(private=True)
|
||||||
private_key_file = {
|
|
||||||
'KeyID': service_key.kid,
|
|
||||||
'PrivateKey': {
|
|
||||||
'N': int(private_key._n),
|
|
||||||
'E': int(private_key._e),
|
|
||||||
'D': int(private_key._d),
|
|
||||||
'Primes': [int(private_key._p), int(private_key._q)],
|
|
||||||
'Precomputed': {
|
|
||||||
'Dp': None,
|
|
||||||
'Dq': None,
|
|
||||||
'Quinv': None,
|
|
||||||
'CRTValues': []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
with open('/conf/quay.jwk', mode='w') as f:
|
with open('/conf/quay.jwk', mode='w') as f:
|
||||||
f.truncate(0)
|
f.truncate(0)
|
||||||
f.write(json.dumps(private_key_file))
|
f.write(json.dumps(jwk))
|
||||||
|
|
||||||
|
|
||||||
def create_jwtproxy_conf():
|
def create_jwtproxy_conf():
|
||||||
|
|
Reference in a new issue