# đ DEVIS PHASE 2.5 : PKI PUBLIQUE ALLIANCE BORĂALE **Version :** 1.0 **Date :** 2025-11-01 **Projet :** Alliance BorĂ©ale - Infrastructure PKI **Membre :** Chezlepro Inc. **Auteur :** Claude (Profils #4 Architecte RĂ©seau, #10 Auditeur SĂ©curitĂ©) **Statut :** Devis pour nouveau fil de discussion --- ## đŻ OBJECTIF DĂ©ployer une **PKI publique** pour l'Alliance BorĂ©ale servant de **racine de confiance collective** pour : - Tous les membres de l'Alliance - Tous les clients (tenants) des membres - Signature des artefacts (code, documents, votes) - Authentification mutuelle (mTLS services) - Communications sĂ©curisĂ©es (S/MIME, Git signing) **Principe fondamental** : Gouvernance collective via **Shamir Secret Sharing (5/3)** + Transparence totale. --- ## đŠ LIVRABLES ### 1. INFRASTRUCTURE TECHNIQUE #### 1.1 Serveur PKI (VMID 02003) **VM** : `ca.infra.chezlepro.ca` (10.0.2.12) **Specs** : - RAM : 2GB - CPU : 2 cores - Disk : 20GB - OS : Ubuntu 22.04 LTS **Logiciel** : **step-ca** (Smallstep Certificate Authority) **FonctionnalitĂ©s** : - CA IntermĂ©diaire Chezlepro (signĂ©e par CA Racine) - ACME protocol (auto-renewal) - API REST (intĂ©gration FastAPI) - OCSP responder (vĂ©rification rĂ©vocations) - Metrics Prometheus - Backups automatiques --- #### 1.2 RĂŽle Ansible : `step-ca` **Structure complĂšte** : ``` roles/step-ca/ âââ tasks/ â âââ main.yml # Orchestration â âââ install.yml # Installation step-ca â âââ intermediate-ca.yml # Config CA IntermĂ©diaire â âââ provisioners.yml # ACME, JWK, etc. â âââ ocsp.yml # OCSP responder â âââ nginx.yml # Reverse proxy HTTPS â âââ backup.yml # Backups automatiques â âââ firewall.yml # nftables â âââ validate.yml # Tests post-dĂ©ploiement â âââ templates/ â âââ ca.json.j2 # Config step-ca â âââ step-ca.service.j2 # Systemd â âââ nginx-ca.conf.j2 # Nginx vhost â âââ provisioners/ â â âââ acme.json.j2 # Provisioner ACME â â âââ jwk.json.j2 # Provisioner JWK â â âââ ansible.json.j2 # Provisioner Ansible â âââ backup.sh.j2 # Script backup â âââ files/ â âââ intermediate-ca.crt # Certificat CA IntermĂ©diaire (signĂ© offline) â âââ intermediate-ca.key # ClĂ© privĂ©e CA IntermĂ©diaire (chiffrĂ©e) â âââ root-ca.crt # Certificat CA Racine (public) â âââ handlers/ â âââ main.yml # restart step-ca, reload nginx â âââ defaults/ âââ main.yml # Variables par dĂ©faut ``` **Points critiques** : - â ïž `intermediate-ca.crt` et `intermediate-ca.key` doivent ĂȘtre gĂ©nĂ©rĂ©s **AVANT** dĂ©ploiement (cĂ©rĂ©monie offline) - â ïž ClĂ© privĂ©e CA IntermĂ©diaire chiffrĂ©e avec passphrase stockĂ©e dans Ansible Vault --- #### 1.3 RĂŽle Ansible : `pki-client` **Structure** : ``` roles/pki-client/ âââ tasks/ â âââ main.yml # Installation client â âââ install-root-ca.yml # Installation root-ca.crt â âââ request-certificate.yml # Demande certificat service â âââ auto-renew.yml # Cron renouvellement â âââ validate.yml # Tests â âââ templates/ â âââ renew-cert.sh.j2 # Script renouvellement â âââ renew-cert.timer.j2 # Systemd timer â âââ files/ â âââ root-ca.crt # CA Racine (distribuĂ© partout) â âââ handlers/ â âââ main.yml # reload services si cert renouvelĂ© â âââ defaults/ âââ main.yml ``` **DĂ©ployĂ© sur** : TOUS les serveurs (Phase 1, 2, 3+) --- #### 1.4 Site web PKI : `https://ca.alliance-boreale.ca` **Contenu** (pages statiques + Jekyll/Hugo) : ``` ca.alliance-boreale.ca/ âââ index.html # Page accueil âââ download/ â âââ root-ca.crt # TĂ©lĂ©chargement certificat racine â âââ root-ca.crt.sha256 # Hash SHA256 â âââ root-ca.crt.asc # Signature GPG âââ docs/ â âââ cp.pdf # Certificate Policy â âââ cps.pdf # Certification Practice Statement â âââ install-guide.pdf # Guide installation â âââ incident-response.pdf # Plan incidents âââ ceremonies/ â âââ 2025-11-root-ca-creation.md # PV cĂ©rĂ©monie fondatrice â âââ 2025-11-root-ca-creation.mp4 # VidĂ©o (optionnel) â âââ blockchain-proof.txt # Hash + TxID Bitcoin âââ crl/ â âââ root-ca.crl # Certificate Revocation List âââ ocsp/ # OCSP responder endpoint ``` **HĂ©bergement** : Pages statiques sur `ca.infra.chezlepro.ca` via Nginx --- ### 2. GOUVERNANCE & DOCUMENTATION #### 2.1 Certificate Policy (CP) **Document** : `Certificate_Policy_Alliance_Boreale_v1.0.pdf` **Structure** (RFC 3647 compliant) : ```markdown # Certificate Policy - Alliance BorĂ©ale Version 1.0 | 2025-11-01 ## 1. Introduction ### 1.1 Aperçu Alliance BorĂ©ale ### 1.2 Identification du document - OID: 1.3.6.1.4.1.XXXXX.1 (Ă obtenir) - Version: 1.0 - Statut: Production ### 1.3 PortĂ©e - Membres Alliance BorĂ©ale - Clients (tenants) des membres - Artefacts logiciels Alliance ### 1.4 Parties prenantes - CA Racine: Gouvernance collective (Shamir 5/3) - CA IntermĂ©diaires: Membres fĂ©dĂ©rĂ©s - Sujets: Services, personnes, artefacts - Utilisateurs: Tous ceux qui font confiance ## 2. ResponsabilitĂ©s ### 2.1 Obligations CA Racine ### 2.2 Obligations CA IntermĂ©diaires ### 2.3 Obligations sujets certificats ### 2.4 Obligations parties utilisatrices ## 3. Identification et authentification ### 3.1 Processus enregistrement ### 3.2 VĂ©rification identitĂ© ### 3.3 Authentification renouvellement ### 3.4 RĂ©vocation ## 4. Cycle de vie certificats ### 4.1 Demande certificat ### 4.2 Ămission ### 4.3 Acceptation ### 4.4 Suspension/RĂ©vocation ### 4.5 Renouvellement ### 4.6 Re-keying ## 5. ContrĂŽles opĂ©rationnels ### 5.1 Protection clĂ©s privĂ©es - CA Racine: Offline, Shamir 5/3, coffres bancaires - CA IntermĂ©diaires: Online, HSM ou chiffrement fort ### 5.2 SĂ©paration des rĂŽles ### 5.3 Logs et audit ### 5.4 Archivage ### 5.5 Gestion incidents ## 6. ContrĂŽles sĂ©curitĂ© physique ### 6.1 CA Racine: Machine airgapped dĂ©diĂ©e ### 6.2 CA IntermĂ©diaires: Datacenter sĂ©curisĂ© ## 7. ContrĂŽles sĂ©curitĂ© technique ### 7.1 GĂ©nĂ©ration clĂ©s ### 7.2 Algorithmes cryptographiques - RSA 4096 bits (CA Racine/IntermĂ©diaires) - RSA 2048 ou ECDSA P-256 (certificats finaux) - SHA-256 minimum ### 7.3 DurĂ©es de vie - CA Racine: 20 ans - CA IntermĂ©diaires: 2 ans - Certificats serveurs: 90 jours (auto-renew) - Code signing: 1 an ## 8. Profils certificats ### 8.1 Certificats serveurs TLS ### 8.2 Certificats code signing ### 8.3 Certificats email (S/MIME) ### 8.4 Certificats clients ## 9. Audit et conformitĂ© ### 9.1 Audits internes (peer review annuel) ### 9.2 Rapports publics ### 9.3 Gestion non-conformitĂ©s ## 10. Dispositions lĂ©gales ### 10.1 Limitation responsabilitĂ© ### 10.2 Garanties ### 10.3 ConfidentialitĂ© ### 10.4 PropriĂ©tĂ© intellectuelle ## Annexes - A. DĂ©finitions - B. OIDs utilisĂ©s - C. Algorithmes approuvĂ©s - D. Contacts ``` **Longueur** : 40-50 pages **Format** : Markdown + PDF gĂ©nĂ©rĂ© **Publication** : - Site web PKI - Repository Git public - Document 15 dans `/mnt/project/` --- #### 2.2 Certification Practice Statement (CPS) **Document** : `Certification_Practice_Statement_Alliance_Boreale_v1.0.pdf` **Structure** (implĂ©mentation concrĂšte de la CP) : ```markdown # Certification Practice Statement - Alliance BorĂ©ale Version 1.0 | 2025-11-01 ## 1. Introduction ### 1.1 Lien avec Certificate Policy ### 1.2 Outils utilisĂ©s - step-ca (Smallstep) - Shamir Secret Sharing (ssss) - OpenSSL - Ansible ## 2. Organisation ### 2.1 Structure gouvernance - Cercle OpĂ©rationnel (gestion CA Racine) - Membres fĂ©dĂ©rĂ©s (gestion CA IntermĂ©diaires) ### 2.2 Contacts - security@alliance-boreale.ca - Incident response: incidents@alliance-boreale.ca ## 3. Processus opĂ©rationnels ### 3.1 GĂ©nĂ©ration CA Racine [ProcĂ©dure dĂ©taillĂ©e cĂ©rĂ©monie fondatrice] ### 3.2 GĂ©nĂ©ration CA IntermĂ©diaires [ProcĂ©dure cĂ©rĂ©monie bi-annuelle] ### 3.3 Ămission certificats quotidiens [API step-ca, ACME, etc.] ## 4. Architecture technique ### 4.1 CA Racine (offline) - Hardware: Raspberry Pi 4 dĂ©diĂ© - Storage: 3x USB chiffrĂ©es (AES-256) - Localisation: 3 coffres bancaires distincts ### 4.2 CA IntermĂ©diaires (online) - VM Ubuntu 22.04 LTS - step-ca version X.Y.Z - PostgreSQL backend ## 5. ProcĂ©dures cĂ©rĂ©monies ### 5.1 CĂ©rĂ©monie fondatrice (CA Racine) [Checklist complĂšte, Ă©tape par Ă©tape] ### 5.2 CĂ©rĂ©monies bi-annuelles (signature CA IntermĂ©diaires) [Checklist, quorum 3/5, enregistrement, publication] ## 6. Gestion rĂ©vocations ### 6.1 Processus rĂ©vocation ### 6.2 CRL (Certificate Revocation List) - Publication: https://ca.alliance-boreale.ca/crl/ - Mise Ă jour: quotidienne ### 6.3 OCSP (Online Certificate Status Protocol) - Endpoint: http://ocsp.ca.alliance-boreale.ca ## 7. SĂ©curitĂ© opĂ©rationnelle ### 7.1 Backups - CA IntermĂ©diaire: backup quotidien, rĂ©tention 30j - Logs: rĂ©tention 1 an ### 7.2 Monitoring - Prometheus metrics - Alerting Icinga2 ### 7.3 Gestion incidents [ProcĂ©dure, contacts, escalade] ## 8. ConformitĂ© ### 8.1 Audits internes - FrĂ©quence: annuelle - Auditeurs: pairs (rotation membres) - Rapport public ### 8.2 Revue CP/CPS - FrĂ©quence: annuelle ou si changement majeur ## Annexes - A. Templates certificats (x509v3) - B. Configuration step-ca - C. Scripts automatisation - D. Changelog ``` **Longueur** : 30-40 pages **Format** : Markdown + PDF --- #### 2.3 Root CA Distribution Guide **Document** : `Root_CA_Installation_Guide_v1.0.pdf` **Structure** : ````markdown # Guide d'installation - Certificat Racine Alliance BorĂ©ale ## Pourquoi installer ce certificat ? Vous ĂȘtes : - â Membre de l'Alliance BorĂ©ale - â Client (tenant) d'un membre - â Partenaire de l'Alliance Installer le certificat racine vous permet de : - AccĂ©der aux services sans avertissement navigateur - VĂ©rifier authenticitĂ© artefacts signĂ©s (code, documents) - Utiliser authentification mutuelle (certificats clients) ## TĂ©lĂ©chargement sĂ©curisĂ© ### Option A : Site web officiel https://ca.alliance-boreale.ca/download/root-ca.crt **VĂ©rification** : ```bash sha256sum root-ca.crt # Doit afficher: abc123def456... ```` ### Option B : Git (recommandĂ©) ```bash git clone https://git.alliance-boreale.ca/alliance-boreale/pki-public cd pki-public gpg --verify root-ca.crt.asc root-ca.crt ``` ## Installation par systĂšme ### Ubuntu / Debian ```bash sudo cp root-ca.crt /usr/local/share/ca-certificates/alliance-boreale.crt sudo update-ca-certificates ``` ### RHEL / Fedora ```bash sudo cp root-ca.crt /etc/pki/ca-trust/source/anchors/ sudo update-ca-trust ``` ### macOS ```bash sudo security add-trusted-cert -d -r trustRoot \ -k /Library/Keychains/System.keychain root-ca.crt ``` ### Windows 1. Double-clic sur `root-ca.crt` 2. "Installer le certificat..." 3. "Ordinateur local" 4. "Placer tous les certificats dans le magasin suivant" 5. SĂ©lectionner "AutoritĂ©s de certification racines de confiance" 6. Terminer ### Firefox (tous OS) 1. ParamĂštres â Vie privĂ©e et sĂ©curitĂ© 2. Certificats â Afficher les certificats 3. AutoritĂ©s â Importer 4. SĂ©lectionner `root-ca.crt` 5. â "Confirmer cette AC pour identifier des sites web" ## VĂ©rification installation ### Linux / macOS ```bash # Tester avec un service Alliance curl -v https://sso.infra.chezlepro.ca 2>&1 | grep "SSL certificate verify ok" ``` ### Windows / Firefox Visiter https://sso.infra.chezlepro.ca â Pas d'avertissement = OK ## RĂ©vocation (si nĂ©cessaire) Si vous ne faites plus confiance Ă l'Alliance BorĂ©ale : ### Linux ```bash sudo rm /usr/local/share/ca-certificates/alliance-boreale.crt sudo update-ca-certificates --fresh ``` ### macOS ```bash sudo security delete-certificate -c "Alliance BorĂ©ale Root CA" \ /Library/Keychains/System.keychain ``` ### Windows Panneau de configuration â Certificats â Supprimer ## Support Questions : support@alliance-boreale.ca SĂ©curitĂ© : security@alliance-boreale.ca ```` **Longueur** : 8-10 pages **Format** : Markdown + PDF **Traductions** : FR + EN (minimum) --- #### 2.4 Key Ceremony Procedures **Document** : `Key_Ceremony_Procedures_v1.0.pdf` **Structure** : ```markdown # ProcĂ©dures CĂ©rĂ©monies PKI - Alliance BorĂ©ale ## 1. CĂ©rĂ©monie Fondatrice (CA Racine) - UNE FOIS ### PrĂ©requis - [ ] 5 membres fondateurs confirmĂ©s - [ ] 3 membres minimum disponibles (quorum) - [ ] Machine dĂ©diĂ©e (Raspberry Pi 4 neuf) - [ ] 5 clĂ©s USB neuves (chiffrĂ©es) - [ ] 3 coffres bancaires rĂ©servĂ©s - [ ] Notaire (optionnel) ### MatĂ©riel requis - Raspberry Pi 4 (4GB RAM, 32GB SD) - Clavier, souris, Ă©cran - 5x USB 3.0 (16GB minimum) - Imprimante (backup papier) - CamĂ©ra (enregistrement optionnel) ### ProcĂ©dure dĂ©taillĂ©e #### Ătape 1 : PrĂ©paration machine (Jour J-7) ```bash # Installation OS propre 1. TĂ©lĂ©charger Raspberry Pi OS Lite (vĂ©rifier hash) 2. Flasher SD card 3. Boot, update, install tools sudo apt update && sudo apt install -y ssss openssl 4. DĂCONNECTER rĂ©seau (airgap) 5. VĂ©rifier: ping 8.8.8.8 (doit Ă©chouer) ```` #### Ătape 2 : Convocation (Jour J-14) - Email Cercle OpĂ©rationnel - Ordre du jour publiĂ© (Forgejo) - Confirmation prĂ©sence 3+ membres #### Ătape 3 : CĂ©rĂ©monie (Jour J) **9h00 - Accueil & vĂ©rification identitĂ©s** - Appel nominal - VĂ©rification piĂšces d'identitĂ© - Signatures feuille prĂ©sence - DĂ©marrage enregistrement vidĂ©o (optionnel) **9h30 - GĂ©nĂ©ration CA Racine** ```bash # Sur machine airgapped cd /tmp/ceremony # GĂ©nĂ©rer clĂ© privĂ©e (RSA 4096) openssl genrsa -out root-ca.key 4096 # GĂ©nĂ©rer certificat auto-signĂ© (20 ans) openssl req -x509 -new -nodes \ -key root-ca.key \ -sha256 -days 7300 \ -out root-ca.crt \ -subj "/C=CA/ST=Quebec/O=Alliance Boreale/CN=Alliance Boreale Root CA" # VĂ©rifier openssl x509 -in root-ca.crt -text -noout ``` **10h30 - Fragmentation Shamir (5/3)** ```bash # Fragmenter clĂ© privĂ©e ssss-split -t 3 -n 5 -w root-ca < root-ca.key # RĂ©sultat : 5 lignes imprimĂ©es # 1-abc123def456... # 2-ghi789jkl012... # 3-mno345pqr678... # 4-stu901vwx234... # 5-yza567bcd890... ``` **11h00 - Distribution fragments** - Chaque fragment â enveloppe scellĂ©e - Signature enveloppe par dĂ©tenteur - Remise en main propre - AccusĂ© rĂ©ception **11h30 - Chiffrement USB** ```bash # Pour chaque USB sudo cryptsetup luksFormat /dev/sdX sudo cryptsetup luksOpen /dev/sdX usb-fragment-1 sudo mkfs.ext4 /dev/mapper/usb-fragment-1 sudo mount /dev/mapper/usb-fragment-1 /mnt # Copier fragment echo "1-abc123def456..." > /mnt/fragment.txt # Backup papier (optionnel) qrencode -o fragment-1-qr.png < /mnt/fragment.txt lp fragment-1-qr.png # Imprimer # Unmount & close sudo umount /mnt sudo cryptsetup luksClose usb-fragment-1 ``` **12h00 - Mise en coffre** - 3 membres vont en banque (3 banques diffĂ©rentes) - DĂ©posent USB en coffre - Reçoivent reçu **14h00 - Nettoyage & destruction** ```bash # EFFACEMENT SĂCURISĂ clĂ© privĂ©e shred -vfz -n 10 root-ca.key # VĂ©rifier disparition ls -la root-ca.key # Doit Ă©chouer # Garder root-ca.crt (public) cp root-ca.crt /tmp/root-ca-public.crt ``` **14h30 - Documentation** - RĂ©daction PV - Signatures GPG des 3 participants - Hash PV â blockchain Bitcoin - Publication Forgejo **15h00 - ClĂŽture** - ArrĂȘt enregistrement vidĂ©o - Archivage PV - Publication publique #### Ătape 4 : Post-cĂ©rĂ©monie (Jour J+1) - Publication PV sur site PKI - Email tous membres (annonce CA Racine créée) - Distribution root-ca.crt publiquement --- ## 2. CĂ©rĂ©monie Bi-annuelle (Signature CA IntermĂ©diaires) ### FrĂ©quence Tous les 2 ans (ou si nouveau membre nĂ©cessite CA IntermĂ©diaire) ### Quorum 3 membres sur 5 (fragments Shamir) ### ProcĂ©dure #### Ătape 1 : PrĂ©paration (Jour J-14) - Convocation Cercle OpĂ©rationnel - 3 membres confirment disponibilitĂ© + apportent USB - RĂ©servation lieu (datacenter neutre ou visio) #### Ătape 2 : GĂ©nĂ©ration CA IntermĂ©diaires (Jour J-7) **Chaque membre gĂ©nĂšre son CSR (Certificate Signing Request)** : ```bash # Sur ca.infra.chezlepro.ca openssl genrsa -out intermediate-ca.key 4096 openssl req -new -key intermediate-ca.key \ -out intermediate-ca.csr \ -subj "/C=CA/ST=Quebec/O=Alliance Boreale/OU=Chezlepro/CN=Chezlepro Intermediate CA" ``` Envoyer `intermediate-ca.csr` Ă Cercle Op (Forgejo) #### Ătape 3 : CĂ©rĂ©monie signature (Jour J) **9h00 - RĂ©union physique (ou vidĂ©o sĂ©curisĂ©e)** **9h30 - Reconstruction clĂ© CA Racine** ```bash # Machine airgapped (mĂȘme Raspberry Pi si possible) cd /tmp/ceremony-2025-11 # 3 membres insĂšrent USB, entrent passphrase LUKS # Copient fragments # Reconstruction cat fragment-1.txt fragment-3.txt fragment-5.txt | ssss-combine -t 3 > root-ca.key # VĂ©rifier openssl rsa -in root-ca.key -check # OK â clĂ© valide ``` **10h00 - Signature CSR** ```bash # Pour chaque membre (exemple: Chezlepro) openssl x509 -req \ -in chezlepro-intermediate-ca.csr \ -CA root-ca.crt \ -CAkey root-ca.key \ -CAcreateserial \ -out chezlepro-intermediate-ca.crt \ -days 730 \ # 2 ans -sha256 \ -extensions v3_intermediate_ca \ -extfile openssl.cnf # VĂ©rifier openssl verify -CAfile root-ca.crt chezlepro-intermediate-ca.crt # OK ``` **11h00 - Distribution certificats** - Remettre `*-intermediate-ca.crt` Ă chaque membre - Copie sur USB chiffrĂ©e (backup) **11h30 - EFFACEMENT clĂ© CA Racine** ```bash shred -vfz -n 10 root-ca.key sync # VĂ©rifier disparition ``` **12h00 - Remise USB en coffre** - 3 membres retournent en banque - Remettent USB en coffre **14h00 - Documentation** - PV cĂ©rĂ©monie - Signatures GPG - Blockchain timestamp - Publication Forgejo #### Ătape 4 : DĂ©ploiement (Jour J+1) Chaque membre dĂ©ploie son CA IntermĂ©diaire : ```bash ansible-playbook playbooks/phase2.5-pki-deploy.yml \ --limit ca.infra.chezlepro.ca \ --ask-vault-pass ``` --- ## 3. CĂ©rĂ©monie Extraordinaire (Compromission) ### DĂ©clenchement Si CA Racine ou fragments compromis ### ProcĂ©dure d'urgence 1. RĂ©vocation immĂ©diate (CRL + OCSP) 2. Notification tous membres + clients (< 24h) 3. CĂ©rĂ©monie extraordinaire gĂ©nĂ©ration nouvelle CA Racine 4. Migration tous certificats (< 7 jours) ### DĂ©tails \[Ă documenter lors de l'incident, chaque cas est unique\] --- ## Annexes ### A. Checklist matĂ©riel - \[ \] Raspberry Pi 4 (4GB) - \[ \] SD Card 32GB (neuve) - \[ \] 5x USB 3.0 16GB (neuves) - \[ \] Clavier + souris + Ă©cran - \[ \] Imprimante (backup papier) - \[ \] CamĂ©ra (enregistrement) ### B. Checklist logiciels - \[ \] Raspberry Pi OS Lite (vĂ©rifiĂ©) - \[ \] ssss (Shamir) - \[ \] OpenSSL 3.x - \[ \] qrencode (QR codes) - \[ \] cryptsetup (LUKS) ### C. Template PV cĂ©rĂ©monie \[Markdown template\] ### D. Configuration OpenSSL \[openssl.cnf avec extensions v3_intermediate_ca\] ```` **Longueur** : 25-30 pages **Format** : Markdown + PDF --- #### 2.5 Incident Response Plan **Document** : `PKI_Incident_Response_Plan_v1.0.pdf` **Structure** : ```markdown # Plan de RĂ©ponse aux Incidents PKI - Alliance BorĂ©ale ## 1. Classification incidents ### SĂ©vĂ©ritĂ© P0 (Critique) - Compromission clĂ© privĂ©e CA Racine - Compromission clĂ© privĂ©e CA IntermĂ©diaire - RĂ©vocation CA Racine/IntermĂ©diaire nĂ©cessaire **DĂ©lai rĂ©ponse** : < 4 heures **Notification** : ImmĂ©diate (tous membres + clients) ### SĂ©vĂ©ritĂ© P1 (Majeure) - Ămission certificat frauduleux dĂ©tectĂ© - Perte fragment Shamir - Compromission serveur PKI (step-ca) **DĂ©lai rĂ©ponse** : < 24 heures **Notification** : Cercle OpĂ©rationnel + membres affectĂ©s ### SĂ©vĂ©ritĂ© P2 (ModĂ©rĂ©e) - Panne serveur PKI (step-ca down) - Erreur Ă©mission certificat (bug) - CRL/OCSP indisponible **DĂ©lai rĂ©ponse** : < 72 heures **Notification** : Cercle OpĂ©rationnel ## 2. Contacts urgence **Ăquipe rĂ©ponse incidents PKI** : - Responsable : president@alliance-boreale.ca - Technique : security@alliance-boreale.ca - Backup : Cercle OpĂ©rationnel (Matrix #incidents) **Escalade** : 1. DĂ©tection â security@ 2. P0/P1 â Convocation Cercle Op (< 4h) 3. P0 â Notification publique (< 24h) ## 3. ProcĂ©dures par type ### 3.1 Compromission CA Racine (P0) **Indicateurs** : - Fragment Shamir divulguĂ© publiquement - 3+ fragments perdus/volĂ©s - Ămission certificat CA Racine non autorisĂ©e **Actions** : 1. **H+0** : DĂ©tection, alerte Cercle Op 2. **H+4** : RĂ©union urgence (quorum 3/5) - Ăvaluation gravitĂ© - DĂ©cision : rĂ©vocation ou surveillance 3. **H+24** : Si rĂ©vocation nĂ©cessaire - Notification publique (site PKI) - Email tous membres + clients - Publication mĂ©dias sociaux 4. **J+3** : CĂ©rĂ©monie extraordinaire - GĂ©nĂ©ration nouvelle CA Racine - Signature nouvelles CA IntermĂ©diaires 5. **J+7** : Migration complĂšte - Tous certificats rĂ©-Ă©mis - Ancienne CA Racine rĂ©voquĂ©e ### 3.2 Compromission CA IntermĂ©diaire (P1) **Indicateurs** : - ClĂ© privĂ©e CA IntermĂ©diaire divulguĂ©e - Serveur step-ca piratĂ© - Ămission certificats frauduleux **Actions** : 1. **H+0** : DĂ©tection, arrĂȘt step-ca 2. **H+4** : Investigation (logs, forensics) 3. **H+24** : RĂ©vocation CA IntermĂ©diaire - CRL mis Ă jour - OCSP renvoit "revoked" 4. **J+2** : Demande nouvelle CA IntermĂ©diaire - GĂ©nĂ©ration nouveau CSR - CĂ©rĂ©monie signature CA Racine 5. **J+7** : RĂ©-Ă©mission certificats affectĂ©s ### 3.3 Perte fragment Shamir (P1) **Indicateurs** : - Membre perd accĂšs coffre - USB dĂ©fectueuse - Fragment illisible **Actions** : 1. **H+0** : Notification Cercle Op 2. **J+1** : Ăvaluation risque - 1 fragment perdu sur 5 â OK (besoin 3) - 2 fragments perdus â Surveillance - 3+ fragments perdus â P0 (re-keying) 3. **Si 2 fragments perdus** : - Planifier cĂ©rĂ©monie re-keying - GĂ©nĂ©ration nouveaux fragments - Migration CA Racine (nouvelle clĂ©) ### 3.4 Certificat frauduleux (P1) **Indicateurs** : - Certificat Ă©mis sans autorisation - Certificat pour domaine non contrĂŽlĂ© - Rapport externe (security researcher) **Actions** : 1. **H+0** : VĂ©rification (est-ce vraiment frauduleux ?) 2. **H+4** : Si confirmĂ© - RĂ©vocation immĂ©diate - CRL + OCSP mis Ă jour 3. **H+24** : Investigation - Comment Ă©mis ? (bug, compromission ?) - Correctif (patch step-ca, audit) 4. **J+3** : Rapport public - Transparence totale - Post-mortem publiĂ© ## 4. Communication ### ModĂšles emails #### Email P0 (Compromission CA Racine) ```` Objet: \[URGENT\] Incident sĂ©curitĂ© PKI Alliance BorĂ©ale Chers membres et clients, Nous vous informons d'un incident de sĂ©curitĂ© P0 affectant notre PKI. La CA Racine Alliance BorĂ©ale est potentiellement compromise. ACTIONS IMMĂDIATES REQUISES: 1. Cesser d'utiliser certificats Alliance BorĂ©ale 2. Attendre nouvelle CA Racine (ETA: 7 jours) DĂ©tails: https://ca.alliance-boreale.ca/incidents/2025-11-001 Contact urgence: security@alliance-boreale.ca Alliance BorĂ©ale - Cercle OpĂ©rationnel ```` #### Page web incidents ```html
Statut: EN COURS
Sévérité: P0 (Critique)
Détecté: 2025-11-01 14:32 UTC
[Description incident]
Cette page sera mise Ă jour toutes les 4 heures.
```` ## 5. Post-mortem AprĂšs chaque incident P0/P1, rapport public obligatoire : **Structure post-mortem** : ```markdown # Post-Mortem Incident PKI 2025-11-001 ## RĂ©sumĂ© exĂ©cutif [Quoi, quand, impact, rĂ©solution] ## Timeline dĂ©taillĂ©e [Chronologie exacte] ## Cause racine [Analyse technique] ## Actions correctives - [ ] Court terme (< 1 mois) - [ ] Moyen terme (< 6 mois) - [ ] Long terme (amĂ©lioration process) ## Leçons apprises [Ce qu'on fera diffĂ©remment] ## Questions/RĂ©ponses [FAQ pour communautĂ©] ``` **Publication** : - Site PKI - Forgejo - Email tous membres **DĂ©lai** : < 30 jours aprĂšs rĂ©solution ## Annexes ### A. Checklist incidents \[Checklist par type P0/P1/P2\] ### B. Contacts urgence \[Liste tĂ©lĂ©phones, emails, Matrix\] ### C. Templates communication \[Emails, pages web, posts Matrix\] ```` **Longueur** : 20-25 pages **Format** : Markdown + PDF --- ### 3. PLAYBOOKS ANSIBLE #### 3.1 Playbook : `phase2.5-pki-deploy.yml` **DĂ©ploiement infrastructure PKI** : ```yaml --- # Alliance BorĂ©ale - Phase 2.5 : PKI Publique # DĂ©ploiement CA IntermĂ©diaire + distribution racine - name: "đ Phase 2.5 - DĂ©ploiement serveur PKI" hosts: ca.infra.chezlepro.ca become: true pre_tasks: - name: "â ïž VĂ©rifier prĂ©sence certificat CA IntermĂ©diaire" ansible.builtin.stat: path: "{{ role_path }}/files/intermediate-ca.crt" register: intermediate_ca_check failed_when: not intermediate_ca_check.stat.exists delegate_to: localhost run_once: true tags: always - name: "đ Afficher avertissement" ansible.builtin.debug: msg: | â ïž IMPORTANT â ïž Ce playbook nĂ©cessite que la CĂRĂMONIE FONDATRICE ait Ă©tĂ© exĂ©cutĂ©e et que les fichiers suivants existent: - roles/step-ca/files/root-ca.crt (public) - roles/step-ca/files/intermediate-ca.crt (signĂ© offline) - roles/step-ca/files/intermediate-ca.key (chiffrĂ©) Si ces fichiers n'existent pas, ARRĂTER maintenant et exĂ©cuter la cĂ©rĂ©monie fondatrice d'abord. tags: always roles: - common - step-ca post_tasks: - name: "â PKI dĂ©ployĂ©e" ansible.builtin.debug: msg: | â Serveur PKI dĂ©ployĂ© avec succĂšs URL: https://ca.infra.chezlepro.ca ACME: https://ca.infra.chezlepro.ca/acme/acme/directory Prochaines Ă©tapes: 1. Tester Ă©mission certificat: step ca certificate test.chezlepro.ca test.crt test.key 2. DĂ©ployer pki-client sur tous serveurs: ansible-playbook phase2.5-pki-client.yml 3. Publier site web PKI: ansible-playbook phase2.5-pki-website.yml - name: "đ Phase 2.5 - DĂ©ploiement site web PKI" hosts: ca.infra.chezlepro.ca become: true tasks: - name: "đŠ Installer gĂ©nĂ©rateur site statique" ansible.builtin.apt: name: jekyll state: present - name: "đ DĂ©ployer contenu site PKI" ansible.builtin.copy: src: "{{ playbook_dir }}/../pki-website/" dest: /var/www/pki/ owner: www-data group: www-data mode: '0755' - name: "đš GĂ©nĂ©rer site statique" ansible.builtin.command: cmd: jekyll build chdir: /var/www/pki become_user: www-data - name: "âïž Configurer Nginx vhost" ansible.builtin.template: src: nginx-pki-site.conf.j2 dest: /etc/nginx/sites-available/pki-site notify: reload nginx - name: "đ Activer site" ansible.builtin.file: src: /etc/nginx/sites-available/pki-site dest: /etc/nginx/sites-enabled/pki-site state: link notify: reload nginx - name: "đĄ Phase 2.5 - Distribution CA Racine (tous serveurs)" hosts: all become: true roles: - pki-client post_tasks: - name: "â Distribution terminĂ©e" ansible.builtin.debug: msg: "â Certificat CA Racine installĂ© sur {{ inventory_hostname }}" ```` --- #### 3.2 Playbook : `phase2.5-pki-migrate.yml` **Migration certificats auto-signĂ©s â PKI** : ```yaml --- # Migration certificats Phases 1-2 vers PKI - name: "đ Migration certificats DNS (Phase 1)" hosts: dns_servers become: true tasks: - name: "đ Demander nouveaux certificats" ansible.builtin.command: cmd: > step ca certificate {{ inventory_hostname }} /etc/ssl/certs/{{ inventory_hostname }}.crt /etc/ssl/private/{{ inventory_hostname }}.key --provisioner acme args: creates: "/etc/ssl/certs/{{ inventory_hostname }}.crt" - name: "âïž Reconfigurer PowerDNS API" ansible.builtin.lineinfile: path: /etc/powerdns/pdns.conf regexp: '^webserver-port=' line: 'webserver-port=8081' notify: restart powerdns - name: "âïž Reconfigurer Nginx" ansible.builtin.template: src: nginx-dns-pki.conf.j2 dest: /etc/nginx/sites-available/powerdns notify: reload nginx - name: "đ Migration certificats Keycloak (Phase 2)" hosts: idp_servers become: true tasks: - name: "đ Demander certificat Keycloak" ansible.builtin.command: cmd: > step ca certificate sso.infra.chezlepro.ca /etc/ssl/certs/keycloak.crt /etc/ssl/private/keycloak.key --provisioner acme args: creates: "/etc/ssl/certs/keycloak.crt" - name: "âïž Reconfigurer Nginx" ansible.builtin.template: src: nginx-keycloak-pki.conf.j2 dest: /etc/nginx/sites-available/keycloak notify: reload nginx - name: "đ Migration certificats Forgejo (Phase 2)" hosts: forge_servers become: true tasks: - name: "đ Demander certificat Forgejo" ansible.builtin.command: cmd: > step ca certificate git.infra.chezlepro.ca /etc/ssl/certs/forgejo.crt /etc/ssl/private/forgejo.key --provisioner acme args: creates: "/etc/ssl/certs/forgejo.crt" - name: "âïž Reconfigurer Nginx" ansible.builtin.template: src: nginx-forgejo-pki.conf.j2 dest: /etc/nginx/sites-available/forgejo notify: reload nginx - name: "đ§Ș Validation migration" hosts: localhost gather_facts: false tasks: - name: "đ§Ș Tester certificats" ansible.builtin.uri: url: "https://{{ item }}" validate_certs: true loop: - ns1.infra.chezlepro.ca:8081 - sso.infra.chezlepro.ca - git.infra.chezlepro.ca register: cert_tests - name: "â Migration rĂ©ussie" ansible.builtin.debug: msg: "â Tous les services utilisent maintenant la PKI Alliance BorĂ©ale" ``` --- ### 4. VAULT SECRETS **Mise Ă jour** `vault/production.yml` : ```yaml --- # PHASE 2.5 - PKI # Passphrase pour clĂ© privĂ©e CA IntermĂ©diaire (chiffrĂ©e au repos) vault_pki_intermediate_key_passphrase: "changeme-strong-passphrase-here" # API key step-ca (admin) vault_step_ca_admin_password: "changeme-step-ca-admin-password" # Provisioner passwords vault_step_ca_provisioner_acme_password: "changeme-acme-provisioner-password" vault_step_ca_provisioner_jwk_password: "changeme-jwk-provisioner-password" # PostgreSQL pour step-ca (si backend DB au lieu de files) vault_postgresql_step_ca_password: "changeme-step-ca-db-password" ``` **GĂ©nĂ©ration secrets** : ```bash # Passphrases (32 chars) openssl rand -base64 32 # Passwords (24 chars) openssl rand -base64 24 ``` --- ### 5. TESTS & VALIDATION #### 5.1 Tests automatisĂ©s **Script** : `tests/pki-validation.sh` ```bash #!/bin/bash # Tests validation PKI Alliance BorĂ©ale set -e echo "đ§Ș Tests PKI Alliance BorĂ©ale" echo "==============================" # Test 1: CA Racine installĂ©e echo "Test 1: CA Racine installĂ©e..." if openssl verify -CAfile /etc/ssl/certs/alliance-boreale-root-ca.crt \ /etc/ssl/certs/alliance-boreale-root-ca.crt; then echo "â CA Racine installĂ©e" else echo "â CA Racine manquante" exit 1 fi # Test 2: Serveur PKI accessible echo "Test 2: Serveur PKI accessible..." if curl -s https://ca.infra.chezlepro.ca/health | grep -q "ok"; then echo "â Serveur PKI rĂ©pond" else echo "â Serveur PKI inaccessible" exit 1 fi # Test 3: ACME endpoint echo "Test 3: ACME endpoint..." if curl -s https://ca.infra.chezlepro.ca/acme/acme/directory | grep -q "newAccount"; then echo "â ACME fonctionne" else echo "â ACME non disponible" exit 1 fi # Test 4: Ămission certificat test echo "Test 4: Ămission certificat test..." step ca certificate test-$(date +%s).chezlepro.ca test.crt test.key \ --provisioner acme --force if [ -f test.crt ]; then echo "â Ămission certificat OK" rm -f test.crt test.key else echo "â Ămission certificat Ă©chouĂ©e" exit 1 fi # Test 5: CRL accessible echo "Test 5: CRL accessible..." if curl -s https://ca.infra.chezlepro.ca/crl/root-ca.crl > /dev/null; then echo "â CRL disponible" else echo "â CRL inaccessible" exit 1 fi # Test 6: OCSP responder echo "Test 6: OCSP responder..." if curl -s http://ocsp.ca.infra.chezlepro.ca/health | grep -q "ok"; then echo "â OCSP rĂ©pond" else echo "â ïž OCSP non configurĂ© (optionnel Phase 2.5)" fi echo "" echo "==============================" echo "â Tous les tests passent" echo "PKI Alliance BorĂ©ale opĂ©rationnelle" ``` --- ## đ RESSOURCES REQUISES ### VM | Service | VMID | FQDN | IP | Specs | |---------|-------|-----------------------|-----------|----------------------| | step-ca | 02003 | ca.infra.chezlepro.ca | 10.0.2.12 | 2GB RAM, 2 CPU, 20GB | ### MatĂ©riel cĂ©rĂ©monie | Item | QuantitĂ© | CoĂ»t unitaire | Total | |----------------------|----------|---------------|-------| | Raspberry Pi 4 (4GB) | 1 | 80$ | 80$ | | SD Card 32GB | 1 | 15$ | 15$ | | USB 3.0 16GB | 5 | 10$ | 50$ | | CĂąbles/pĂ©riphĂ©riques | \- | \- | 50$ | | **Sous-total matĂ©riel** | | | **195$** | ### Services externes (optionnels) | Service | CoĂ»t annuel | |--------------------------------------|--------------------| | 3x Coffres bancaires | 150-300$ | | Notarisation (si choisi) | 300-500$/cĂ©rĂ©monie | | Assurance RC (si inclusion stores) | 5 000-20 000$ | | Audit WebTrust (si inclusion stores) | 15 000-50 000$ | **Total Phase 2.5 (sans notarisation/audit externe)** : \~500$ one-time + 200$/an (coffres) --- ## â±ïž TIMELINE ### PrĂ©paration (Semaine 1-2) - RĂ©daction documents gouvernance (CP, CPS, guides) - Revue par Cercle OpĂ©rationnel - Achat matĂ©riel cĂ©rĂ©monie - RĂ©servation coffres bancaires ### CĂ©rĂ©monie Fondatrice (Semaine 3) - Jour J-7 : Convocation membres - Jour J : CĂ©rĂ©monie (8h, 3-5 personnes) - Jour J+1 : Publication PV, distribution root-ca.crt ### DĂ©veloppement Ansible (Semaine 4-5) - RĂŽles `step-ca` et `pki-client` - Playbooks dĂ©ploiement - Tests ### DĂ©ploiement (Semaine 6) - DĂ©ploiement serveur PKI (VMID 02003) - Distribution CA Racine (tous serveurs) - Site web PKI ### Migration (Semaine 7) - Remplacement certificats auto-signĂ©s Phases 1-2 - Tests validation - Documentation **DurĂ©e totale** : **7 semaines** --- ## đŻ CRITĂRES DE SUCCĂS ### Techniques - â CA Racine gĂ©nĂ©rĂ©e offline (Shamir 5/3) - â CA IntermĂ©diaire Chezlepro opĂ©rationnelle - â ACME protocol fonctionnel - â Auto-renewal certificats (90j) - â Tous serveurs Phases 1-2 migrĂ©s vers PKI - â CRL publiĂ© et Ă jour - â Tests validation 100% passent ### Gouvernance - â CP/CPS publiĂ©s et approuvĂ©s - â CĂ©rĂ©monie fondatrice documentĂ©e (PV, vidĂ©o, blockchain) - â Fragments Shamir en coffres - â Site web PKI public et accessible - â Guide installation distribuĂ© Ă tous membres ### Adoption - â 100% membres ont installĂ© root-ca.crt - â Documentation lue et comprise - â Processus incident response testĂ© (drill) --- ## đ DĂPENDANCES ### PrĂ©requis - â Phase 1 (DNS) dĂ©ployĂ©e - â Phase 2 (Keycloak + Forgejo) dĂ©ployĂ©e - â 3+ membres fondateurs disponibles - â Consensus Cercle OpĂ©rationnel ### Bloquants potentiels - â ïž DisponibilitĂ© 3 membres simultanĂ©ment (cĂ©rĂ©monie) - â ïž AccĂšs coffres bancaires (dĂ©lai ouverture) - â ïž ComplexitĂ© technique (formation requise) --- ## đ MAINTENANCE POST-DĂPLOIEMENT ### Quotidien - Monitoring step-ca (uptime, logs) - GĂ©nĂ©ration CRL automatique ### Mensuel - VĂ©rification backups - Review logs Ă©mission certificats - Test ACME auto-renewal ### Annuel - Audit interne PKI (peer review) - Revue CP/CPS - Test procĂ©dure incident response ### Bi-annuel - CĂ©rĂ©monie signature nouvelles CA IntermĂ©diaires --- ## đ RĂFĂRENCES - RFC 3647: Certificate Policy and Certification Practice Framework - RFC 5280: X.509 Public Key Infrastructure - NIST SP 800-57: Recommendation for Key Management - Smallstep step-ca documentation - WebTrust Principles (si inclusion stores, futur) --- **FIN DEVIS PHASE 2.5** --- # đ DEVIS PHASE 3 : ICINGA2 + FASTAPI PIVOT **Version :** 1.0 **Date :** 2025-11-01 **Projet :** Alliance BorĂ©ale - Monitoring & Pivot **Membre :** Chezlepro Inc. **Auteur :** Claude (Profils #4 Architecte RĂ©seau, #6 Architecte Logiciel, #10 Auditeur SĂ©curitĂ©) **Statut :** Devis pour nouveau fil de discussion **PrĂ©requis** : Phase 2.5 (PKI) dĂ©ployĂ©e --- ## đŻ OBJECTIF DĂ©ployer la **couche C5 (Pivot)** + **observabilitĂ© complĂšte (C3)** avec : 1. **Icinga2** : Monitoring fonctionnel + BPM (modĂ©lisation couches C1-C8) 2. **FastAPI Pivot** : API de gestion infrastructure + provisioning tenants 3. **Grafana** : Dashboards + visualisation (consomme Icinga2 + mĂ©triques) **Principe** : Respecter **adjacent-only** via agents Icinga2 + authentification mTLS (PKI Phase 2.5) --- ## đŠ LIVRABLES ### 1. INFRASTRUCTURE MONITORING (ICINGA2) #### 1.1 Serveur Icinga2 Master (VMID 03011) **VM** : `icinga.infra.chezlepro.ca` (10.0.3.10) **Specs** : - RAM : 4GB - CPU : 2 cores - Disk : 50GB - OS : Ubuntu 22.04 LTS **Composants** : - Icinga2 Master - Icinga2 Director (config as code) - Icingaweb2 (interface web) - Icinga2 Business Process Modeling (BPM) - PostgreSQL (backend) - Grafana integration --- #### 1.2 RĂŽle Ansible : `icinga2-master` **Structure** : ``` roles/icinga2-master/ âââ tasks/ â âââ main.yml # Orchestration â âââ install.yml # Installation Icinga2 â âââ postgresql.yml # Base donnĂ©es â âââ director.yml # Icinga Director â âââ icingaweb2.yml # Interface web â âââ bpm.yml # Business Process Modeling â âââ pki.yml # Certificats (PKI Phase 2.5) â âââ checks.yml # Checks de base â âââ notifications.yml # Alerting â âââ nginx.yml # Reverse proxy â âââ firewall.yml # nftables â âââ validate.yml # Tests â âââ templates/ â âââ icinga2.conf.j2 # Config master â âââ zones.conf.j2 # Zones (master + satellites) â âââ constants.conf.j2 # Constantes â âââ commands/ # Checks commands â â âââ dns-check.conf.j2 â â âââ http-check.conf.j2 â â âââ postgresql-check.conf.j2 â â âââ certificate-check.conf.j2 â âââ services/ # Service definitions â â âââ dns-services.conf.j2 â â âââ web-services.conf.j2 â â âââ db-services.conf.j2 â âââ notifications/ â â âââ email.conf.j2 â â âââ matrix.conf.j2 â âââ director/ â â âââ director.ini.j2 â â âââ kickstart.yml.j2 â âââ icingaweb2/ â â âââ config.ini.j2 â â âââ resources.ini.j2 â â âââ authentication.ini.j2 â âââ bpm/ # Business processes â â âââ infrastructure-c1-c8.conf.j2 â â âââ tenant-health.conf.j2 â â âââ pki-health.conf.j2 â âââ nginx-icinga.conf.j2 â âââ files/ â âââ checks/ # Scripts checks custom â â âââ check_powerdns.sh â â âââ check_keycloak.sh â â âââ check_forgejo.sh â â âââ check_step_ca.sh â âââ dashboards/ # Dashboards Grafana (export) â âââ infrastructure-overview.json â âââ icinga2-metrics.json â âââ handlers/ â âââ main.yml â âââ defaults/ âââ main.yml ``` **FonctionnalitĂ©s clĂ©s** : - â Checks fonctionnels (pas juste mĂ©triques) - â BPM : ModĂ©lisation dĂ©pendances C1âC8 - â Director : Config Git-backed (IaC) - â SSO Keycloak pour Icingaweb2 - â Agents authentifiĂ©s par certificats (PKI) - â Notifications Matrix + Email - â API REST complĂšte --- #### 1.3 RĂŽle Ansible : `icinga2-agent` **DĂ©ployĂ© sur** : TOUS les serveurs (Phase 1, 2, 2.5, 3) **Structure** : ``` roles/icinga2-agent/ âââ tasks/ â âââ main.yml # Installation agent â âââ pki.yml # Certificat agent (PKI) â âââ zones.yml # Configuration zone â âââ firewall.yml # Port 5665 â âââ validate.yml # Test connexion master â âââ templates/ â âââ zones.conf.j2 # Zone config â âââ constants.conf.j2 â âââ handlers/ â âââ main.yml â âââ defaults/ âââ main.yml ``` **Principe adjacent-only** : - Agents C1-C4 â remontent directement Ă Master (C3) - Agents C6-C8 (tenants) â remontent via Satellite Pivot (C5) â Master (C3) --- #### 1.4 Checks Icinga2 **Checks de base** (tous serveurs) : | Check | Seuil Warning | Seuil Critical | |-------------------|---------------|----------------| | CPU Load | \> 80% | \> 95% | | RAM Usage | \> 80% | \> 90% | | Disk Usage | \> 80% | \> 90% | | Swap Usage | \> 50% | \> 80% | | Processes | custom | custom | | Network Interface | down | down | **Checks spĂ©cifiques par service** : **DNS (PowerDNS)** : - Query resolution time - AXFR working (master â slave) - DNSSEC validation - Zone serial up-to-date - API responding **Keycloak** : - HTTP 200 on /health - Database connections - Realm availability - SSO flow test (synthetic) **Forgejo** : - HTTP 200 on / - Git clone test - SSH port 2222 open - Database connections - Webhooks working **step-ca (PKI)** : - ACME endpoint responding - Certificate issuance test - CRL up-to-date - OCSP responding **FastAPI Pivot** : - API /health endpoint - Database connections - Integration tests (PowerDNS, Keycloak APIs) --- #### 1.5 Business Process Modeling (BPM) **Process** : Infrastructure Alliance BorĂ©ale (C1-C8) ``` Infrastructure Globale (OK si 90%+ OK) âââ Couche C1 : Physique (OK si tous serveurs UP) â âââ ns1.infra.chezlepro.ca â âââ ns2.infra.chezlepro.ca â âââ sso.infra.chezlepro.ca â âââ git.infra.chezlepro.ca â âââ ca.infra.chezlepro.ca â âââ pivot.infra.chezlepro.ca â âââ icinga.infra.chezlepro.ca â âââ grafana.infra.chezlepro.ca â âââ Couche C2 : DNS & PKI (OK si 100% OK - critique) â âââ PowerDNS Master (ns1) [CRITICAL] â âââ PowerDNS Slave (ns2) â âââ DNSSEC Validation â âââ step-ca API [CRITICAL] â âââ ACME Renewal Working â âââ Couche C3 : Gouvernance & Supervision (OK si 80%+ OK) â âââ Keycloak SSO [CRITICAL] â âââ Icinga2 Master (self-check) â âââ Grafana â âââ Couche C4 : Forge & Mutualisation (OK si 100% OK) â âââ Forgejo Git [CRITICAL] â âââ Forgejo SSH â âââ Forgejo Actions (CI/CD) â âââ Couche C5 : Pivot (OK si API rĂ©pond) â âââ FastAPI /health â âââ Database Connections â âââ Integrations APIs â âââ Couches C6-C8 : Tenants (OK si 80%+ OK) âââ Tenant 001 (si dĂ©ployĂ©) âââ [Ă venir Phase 4] ``` **Visualisation BPM** : Icingaweb2 â Business Process --- ### 2. INFRASTRUCTURE PIVOT (FASTAPI) #### 2.1 Serveur FastAPI Pivot (VMID 05011) **VM** : `pivot.infra.chezlepro.ca` (10.0.4.10) **Specs** : - RAM : 4GB - CPU : 2 cores - Disk : 30GB - OS : Ubuntu 22.04 LTS --- #### 2.2 RĂŽle Ansible : `fastapi-pivot` **Structure complĂšte** : ``` roles/fastapi-pivot/ âââ tasks/ â âââ main.yml # Orchestration â âââ install.yml # Python, venv, deps â âââ database.yml # PostgreSQL â âââ app.yml # DĂ©ploiement app â âââ nginx.yml # Reverse proxy + mTLS â âââ pki.yml # Certificats â âââ systemd.yml # Service uvicorn â âââ firewall.yml # nftables â âââ validate.yml # Tests API â âââ templates/ â âââ .env.j2 # Variables d'environnement â âââ fastapi-pivot.service.j2 # Systemd â âââ nginx-pivot.conf.j2 # Nginx + mTLS â âââ alembic.ini.j2 # Migrations DB â âââ logging.conf.j2 # Logs structurĂ©s â âââ files/ â âââ app/ â â âââ main.py # FastAPI app principale â â âââ config.py # Configuration â â âââ database.py # SQLAlchemy setup â â âââ auth.py # OAuth2 Keycloak â â âââ dependencies.py # DĂ©pendances FastAPI â â â â â âââ models/ # SQLAlchemy models â â â âââ __init__.py â â â âââ tenant.py â â â âââ service.py â â â âââ audit_log.py â â â â â âââ schemas/ # Pydantic schemas â â â âââ __init__.py â â â âââ tenant.py â â â âââ service.py â â â âââ health.py â â â â â âââ crud/ # CRUD operations â â â âââ __init__.py â â â âââ tenant.py â â â âââ service.py â â â â â âââ routers/ # API routes â â â âââ __init__.py â â â âââ health.py # /health, /metrics â â â âââ services.py # /api/v1/services â â â âââ tenants.py # /api/v1/tenants â â â âââ dns.py # /api/v1/dns â â â âââ keycloak_mgmt.py # /api/v1/keycloak â â â âââ forgejo.py # /api/v1/forgejo â â â âââ pki.py # /api/v1/pki â â â âââ monitoring.py # /api/v1/monitoring â â â â â âââ integrations/ # Clients API externes â â â âââ __init__.py â â â âââ powerdns.py # Client PowerDNS API â â â âââ keycloak.py # Client Keycloak Admin â â â âââ forgejo.py # Client Forgejo API â â â âââ step_ca.py # Client step-ca API â â â âââ icinga2.py # Client Icinga2 API â â â â â âââ utils/ # Utilitaires â â âââ __init__.py â â âââ logging.py â â âââ exceptions.py â â âââ validators.py â â â âââ alembic/ # Migrations DB â â âââ env.py â â âââ script.py.mako â â âââ versions/ â â âââ 001_initial.py â â â âââ tests/ # Tests unitaires â â âââ __init__.py â â âââ test_health.py â â âââ test_tenants.py â â âââ test_integrations.py â â â âââ requirements.txt # DĂ©pendances Python â âââ handlers/ â âââ main.yml â âââ defaults/ âââ main.yml ``` --- #### 2.3 API FastAPI Pivot - Endpoints **SantĂ© & MĂ©triques** : ``` GET /health # Health check GET /metrics # Prometheus metrics GET /docs # OpenAPI docs (Swagger) ``` **Services Infrastructure** : ``` GET /api/v1/services # Liste tous services GET /api/v1/services/{service} # DĂ©tails un service GET /api/v1/services/{service}/health # Health check service ``` **Gestion Tenants** : ``` GET /api/v1/tenants # Liste tenants POST /api/v1/tenants # CrĂ©er tenant GET /api/v1/tenants/{id} # DĂ©tails tenant PATCH /api/v1/tenants/{id} # Modifier tenant DELETE /api/v1/tenants/{id} # Supprimer tenant POST /api/v1/tenants/{id}/deploy # DĂ©ployer tenant ``` **DNS (PowerDNS)** : ``` GET /api/v1/dns/zones # Liste zones POST /api/v1/dns/zones # CrĂ©er zone GET /api/v1/dns/zones/{zone}/records # Liste records POST /api/v1/dns/zones/{zone}/records # Ajouter record DELETE /api/v1/dns/zones/{zone}/records/{id} # Supprimer record ``` **Keycloak (Gestion utilisateurs)** : ``` GET /api/v1/keycloak/users # Liste utilisateurs POST /api/v1/keycloak/users # CrĂ©er utilisateur GET /api/v1/keycloak/realms # Liste realms GET /api/v1/keycloak/clients # Liste clients ``` **Forgejo (Gestion repos)** : ``` GET /api/v1/forgejo/repos # Liste repos POST /api/v1/forgejo/repos # CrĂ©er repo GET /api/v1/forgejo/orgs # Liste organisations GET /api/v1/forgejo/users # Liste utilisateurs ``` **PKI (Certificats)** : ``` GET /api/v1/pki/certificates # Liste certificats Ă©mis POST /api/v1/pki/certificates # Demander certificat DELETE /api/v1/pki/certificates/{id} # RĂ©voquer certificat GET /api/v1/pki/ca/status # Status CA ``` **Monitoring (Icinga2)** : ``` GET /api/v1/monitoring/services # Ătat services GET /api/v1/monitoring/hosts # Ătat hosts GET /api/v1/monitoring/bpm # Business processes GET /api/v1/monitoring/alerts # Alertes actives ``` **Authentification** : OAuth2 Keycloak (Bearer token) **Autorisation** : RĂŽles Keycloak - `alliance-admin` : AccĂšs complet - `alliance-operator` : Lecture + opĂ©rations courantes - `alliance-viewer` : Lecture seule --- #### 2.4 IntĂ©grations API **Client PowerDNS** (`integrations/powerdns.py`) : ```python class PowerDNSClient: def __init__(self, url: str, api_key: str): self.url = url self.api_key = api_key async def list_zones(self) -> List[Zone]: # GET /api/v1/servers/localhost/zones pass async def create_zone(self, zone: ZoneCreate) -> Zone: # POST /api/v1/servers/localhost/zones pass async def add_record(self, zone: str, record: Record) -> None: # PATCH /api/v1/servers/localhost/zones/{zone} pass ``` **Client Keycloak** (`integrations/keycloak.py`) : ```python class KeycloakAdminClient: def __init__(self, url: str, admin_user: str, admin_password: str): self.url = url self.admin_user = admin_user self.admin_password = admin_password async def get_admin_token(self) -> str: # POST /realms/master/protocol/openid-connect/token pass async def list_users(self, realm: str) -> List[User]: # GET /admin/realms/{realm}/users pass async def create_user(self, realm: str, user: UserCreate) -> User: # POST /admin/realms/{realm}/users pass ``` **Client Forgejo** (`integrations/forgejo.py`) : ```python class ForgejoClient: def __init__(self, url: str, admin_token: str): self.url = url self.admin_token = admin_token async def list_repos(self, org: str) -> List[Repo]: # GET /api/v1/orgs/{org}/repos pass async def create_repo(self, org: str, repo: RepoCreate) -> Repo: # POST /api/v1/orgs/{org}/repos pass ``` **Client step-ca** (`integrations/step_ca.py`) : ```python class StepCAClient: def __init__(self, url: str, provisioner: str, password: str): self.url = url self.provisioner = provisioner self.password = password async def request_certificate(self, csr: str) -> Certificate: # POST /sign pass async def revoke_certificate(self, serial: str) -> None: # POST /revoke pass ``` **Client Icinga2** (`integrations/icinga2.py`) : ```python class Icinga2Client: def __init__(self, url: str, api_user: str, api_password: str): self.url = url self.api_user = api_user self.api_password = api_password async def get_service_status(self, host: str, service: str) -> ServiceStatus: # GET /v1/objects/services pass async def get_bp_status(self, bp_name: str) -> BPStatus: # Custom endpoint via Icingaweb2 API pass ``` --- ### 3. VISUALISATION (GRAFANA) #### 3.1 Serveur Grafana (VMID 03012) **VM** : `grafana.infra.chezlepro.ca` (10.0.3.11) **Specs** : - RAM : 2GB - CPU : 2 cores - Disk : 20GB - OS : Ubuntu 22.04 LTS --- #### 3.2 RĂŽle Ansible : `grafana` **Structure** : ``` roles/grafana/ âââ tasks/ â âââ main.yml â âââ install.yml â âââ datasources.yml # Icinga2, PostgreSQL â âââ dashboards.yml # Import dashboards â âââ sso.yml # OAuth Keycloak â âââ nginx.yml # Reverse proxy â âââ pki.yml # Certificats â âââ firewall.yml â âââ validate.yml â âââ templates/ â âââ grafana.ini.j2 â âââ datasources/ â â âââ icinga2.yml.j2 â â âââ postgresql.yml.j2 â âââ nginx-grafana.conf.j2 â âââ files/ â âââ dashboards/ â âââ infrastructure-overview.json â âââ dns-servers.json â âââ pki-health.json â âââ keycloak-metrics.json â âââ forgejo-metrics.json â âââ icinga2-status.json â âââ bpm-processes.json â âââ handlers/ â âââ main.yml â âââ defaults/ âââ main.yml ``` **Datasources** : - Icinga2 (via plugin ou PostgreSQL IDO) - PostgreSQL (metrics Icinga2, PowerDNS, etc.) - FastAPI Pivot (custom metrics) **Dashboards** : - Infrastructure Overview (tous services) - DNS Performance (PowerDNS) - PKI Health (step-ca, cert expiry) - Keycloak Metrics (authentications, users) - Forgejo Activity (commits, repos, CI/CD) - Icinga2 Status (checks, notifications) - Business Processes (BPM from Icinga2) --- ## đ ARCHITECTURE MONITORING ### Flux de donnĂ©es ``` âââââââââââââââââââââââââââââââââââââââââââââââââââ â SERVEURS (C1-C8) â â âââ Icinga2 Agent (checks passifs + actifs) â â âââ Certificat PKI (authentification mTLS) â ââââââââââââââââââââŹâââââââââââââââââââââââââââââââ â Port 5665 (mTLS) ⌠âââââââââââââââââââââââââââââââââââââââââââââââââââ â ICINGA2 MASTER (C3) â â âââ Collecte checks â â âââ Ăvaluation BPM â â âââ Notifications (Matrix, Email) â â âââ API REST â ââââââââââââââââââââŹâââââââââââââââââââââââââââââââ â ââââââââââââŽâââââââââââ â â ⌠⌠ââââââââââââââââââââ ââââââââââââââââââââ â FASTAPI PIVOT â â GRAFANA â â (C5) â â (C3) â â â â â â Consomme API â â Dashboards â â Icinga2 pour â â + alerting â â provisioning â â â ââââââââââââââââââââ ââââââââââââââââââââ ``` --- ## đ PLAYBOOKS ANSIBLE ### Playbook : `phase3-deploy.yml` ```yaml --- # Alliance BorĂ©ale - Phase 3 : Monitoring & Pivot - name: "đ Phase 3 - DĂ©ploiement Icinga2 Master" hosts: icinga.infra.chezlepro.ca become: true roles: - common - postgresql - icinga2-master post_tasks: - name: "â Icinga2 Master dĂ©ployĂ©" ansible.builtin.debug: msg: | â Icinga2 Master opĂ©rationnel URL: https://icinga.infra.chezlepro.ca/icingaweb2 API: https://icinga.infra.chezlepro.ca:5665/v1 - name: "đĄ Phase 3 - DĂ©ploiement Agents Icinga2" hosts: all:!icinga.infra.chezlepro.ca become: true roles: - icinga2-agent post_tasks: - name: "â Agents dĂ©ployĂ©s" ansible.builtin.debug: msg: "â Agent Icinga2 installĂ© sur {{ inventory_hostname }}" - name: "đ§ Phase 3 - DĂ©ploiement FastAPI Pivot" hosts: pivot.infra.chezlepro.ca become: true roles: - common - postgresql - fastapi-pivot post_tasks: - name: "â FastAPI Pivot dĂ©ployĂ©" ansible.builtin.debug: msg: | â FastAPI Pivot opĂ©rationnel URL: https://pivot.infra.chezlepro.ca API Docs: https://pivot.infra.chezlepro.ca/docs - name: "đ Phase 3 - DĂ©ploiement Grafana" hosts: grafana.infra.chezlepro.ca become: true roles: - common - grafana post_tasks: - name: "â Grafana dĂ©ployĂ©" ansible.builtin.debug: msg: | â Grafana opĂ©rationnel URL: https://grafana.infra.chezlepro.ca - name: "đ§Ș Phase 3 - Validation" hosts: localhost gather_facts: false tasks: - name: "đ§Ș Tester endpoints" ansible.builtin.uri: url: "{{ item }}" validate_certs: true loop: - https://icinga.infra.chezlepro.ca/icingaweb2 - https://pivot.infra.chezlepro.ca/health - https://grafana.infra.chezlepro.ca - name: "â Phase 3 terminĂ©e" ansible.builtin.debug: msg: | âââââââââââââââââââââââââââââââââââââââ đČ PHASE 3 TERMINĂE âââââââââââââââââââââââââââââââââââââââ â Icinga2 : https://icinga.infra.chezlepro.ca â FastAPI : https://pivot.infra.chezlepro.ca â Grafana : https://grafana.infra.chezlepro.ca Infrastructure C1-C5 complĂšte ! Prochaine Ă©tape : DĂ©ployer premier tenant (C6-C8) ``` --- ## â±ïž TIMELINE **DurĂ©e totale** : **4 semaines** - Semaine 1 : Icinga2 Master + Agents - Semaine 2 : FastAPI Pivot (backend) - Semaine 3 : Grafana + Dashboards - Semaine 4 : Tests + Documentation --- ## đŻ CRITĂRES DE SUCCĂS - â Icinga2 supervise 100% serveurs Phases 1-2-2.5 - â BPM modĂ©lise couches C1-C8 - â FastAPI Pivot API complĂšte (tous endpoints) - â Grafana dashboards opĂ©rationnels - â SSO Keycloak fonctionne (Icingaweb2 + Grafana) - â Authentification mTLS (PKI Phase 2.5) - â Notifications alertes configurĂ©es (Matrix + Email) --- **FIN DEVIS PHASE 3** --- **Total pages devis** : Phase 2.5 (\~45 pages) + Phase 3 (\~35 pages) = **\~80 pages** PrĂȘt pour le prochain fil ! đđđ