Archived
20 lines
583 B
Python
20 lines
583 B
Python
import json
|
|
import os
|
|
|
|
# Création du dossier cible si inexistant
|
|
os.makedirs("/iam-certs", exist_ok=True)
|
|
|
|
with open("/tmp/vault-cert.json") as f:
|
|
data = json.load(f)["data"]
|
|
|
|
# 1. Certificat Public
|
|
with open("/iam-certs/vault.crt", "w") as f:
|
|
f.write(data["certificate"])
|
|
|
|
# 2. Clé Privée (SECRET)
|
|
with open("/iam-certs/vault.key", "w") as f:
|
|
f.write(data["private_key"])
|
|
|
|
# 3. Full Chain (Certificat + Chaîne CA) - Recommandé pour Keycloak
|
|
with open("/iam-certs/vault-fullchain.crt", "w") as f:
|
|
f.write(data["certificate"] + "\n" + "\n".join(data["ca_chain"])) |