This repository has been archived on 2026-11-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
scripts/vault-keys.py
2026-04-20 04:04:48 +02:00

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"]))