diff --git a/vault-keys.py b/vault-keys.py new file mode 100644 index 0000000..31bdb23 --- /dev/null +++ b/vault-keys.py @@ -0,0 +1,20 @@ +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"])) \ No newline at end of file