# 📋 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

Incident PKI 2025-11-001

Statut: EN COURS

Sévérité: P0 (Critique)

Détecté: 2025-11-01 14:32 UTC

Description

[Description incident]

Impact

Actions utilisateurs

  1. Cesser utilisation certificats
  2. Attendre migration (ETA: 7j)

Timeline

Mises Ă  jour

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 ! 🚀🔐📊