From a17528bc142fd8b9d0d58bc6f0a02d2115cf5433 Mon Sep 17 00:00:00 2001 From: youness-adm Date: Mon, 20 Apr 2026 04:04:48 +0200 Subject: [PATCH] Ajouter vault-keys.py --- vault-keys.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 vault-keys.py 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