chore/restructuration-depot #1

Merged
danallaire merged 5 commits from chore/restructuration-depot into main 2026-06-25 18:48:45 -04:00
266 changed files with 5692 additions and 0 deletions

7
archives/README.md Normal file
View file

@ -0,0 +1,7 @@
# Archives
Contient :
- legacy
- variantes remplacées
- artefacts déplacés pendant migration

16
docs/README.md Normal file
View file

@ -0,0 +1,16 @@
# Documentation canonique
Ce dossier contient la documentation de référence de l'Alliance Boréale.
Branches principales :
- fondements
- modele
- architecture
- gouvernance
- decisions
- politiques
- ecosystemes
- guides
- corpus-a-integrer
- diffusion

View file

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 268 B

9
infrastructure/README.md Normal file
View file

@ -0,0 +1,9 @@
# Infrastructure
Contient l'implémentation opératoire :
- ansible
- opentofu
- cloud-init
- templates
- netbox

2
infrastructure/ansible/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.retry
.ansible/

View file

@ -0,0 +1,81 @@
# ansible/
Sous-arbre Ansible de l'Alliance Boréale pour la **mise en conformité post-provisionnement** des VMs.
## Responsabilités
Ce sous-arbre prend des VMs déjà créées et accessibles en SSH, puis applique :
- la baseline packages commune ;
- le hardening OS ;
- le pare-feu local ;
- les mises à jour de sécurité automatiques ;
- l'agent Icinga2 ;
- l'agent Wazuh en option.
## Hors périmètre
Ne relèvent **pas** de ce sous-arbre :
- la création des VMs ;
- le clonage de templates ;
- la gestion Proxmox ;
- la génération initiale des ressources cloud-init.
Ces responsabilités appartiennent au sous-arbre `opentofu/` du dépôt principal.
## Structure
```text
ansible/
├── ansible.cfg
├── requirements.yml
├── inventories/prod/
│ ├── hosts.yml
│ ├── group_vars/all.yml
│ └── host_vars/
├── playbooks/
│ ├── site.yml
│ ├── baseline.yml
│ └── hardening.yml
├── roles/
│ ├── baseline_common/
│ ├── hardening_common/
│ ├── firewall_nftables/
│ ├── monitoring_icinga_agent/
│ └── security_wazuh_agent/
└── docs/
```
## Démarrage
1. Laisser OpenTofu générer `inventories/prod/hosts.yml`.
2. Ajuster `inventories/prod/group_vars/all.yml`.
3. Vérifier les réseaux d'administration autorisés dans le firewall.
4. Lancer :
```bash
ansible-playbook playbooks/site.yml
```
## Intégration supplémentaire issue de `ansible2.zip`
Cette convergence incorpore maintenant une seconde lignée orientée services :
- `postgresql`
- `keycloak`
- `forgejo`
- `powerdns_authoritative`
Playbooks ajoutés :
- `playbooks/services/phase1_dns.yml`
- `playbooks/services/phase2_identity_forge.yml`
Un exemple d'inventaire généré par OpenTofu est fourni dans `inventories/prod/examples/tofu_generated.example.yml`.
Des exemples de `host_vars` et de `vault/` sont aussi inclus pour accélérer l'adaptation.
Les playbooks de baseline et hardening ciblent `all`. Les playbooks de services ciblent directement les groupes OpenTofu : `c3_services`, `c4_forge`, `c5_runner`, `c7_tenants`.
## Inventaire OpenTofu recommandé
Le dépôt consomme un inventaire généré par OpenTofu avec un groupe racine `boreale_all`, des groupes de couche (`c3_supervision`, `c3_core`, `c4_forge`, `c5_pivot`) et un sous-arbre `tenants/c7_products`. Des métadonnées minimales par hôte sont attendues : `boreale_layer`, `boreale_role`, `boreale_env`, `boreale_managed_by`.

View file

@ -0,0 +1,19 @@
[defaults]
inventory = inventories/prod/hosts.yml
roles_path = roles
host_key_checking = False
retry_files_enabled = False
interpreter_python = auto_silent
stdout_callback = ansible.builtin.default
result_format = yaml
bin_ansible_callbacks = True
timeout = 30
forks = 20
gathering = smart
fact_caching = jsonfile
fact_caching_connection = .ansible/facts
fact_caching_timeout = 7200
[ssh_connection]
pipelining = True
scp_if_ssh = True

View file

@ -0,0 +1,51 @@
# Rapport de convergence — sous-arbre ansible/
## Décision d'architecture
Le dépôt Ansible fusionné a été recentré pour jouer un rôle unique :
**configurer et durcir des VMs déjà provisionnées**.
La création des VMs, le template Debian 12, le clonage et l'écriture de l'inventaire relèvent désormais du dépôt OpenTofu.
## Ce qui a été retenu
- `baseline_common`
- `hardening_common`
- `firewall_nftables`
- `monitoring_icinga_agent`
- `security_wazuh_agent`
- inventaire YAML simple
- playbooks séparés `baseline`, `hardening`, `site`
## Ce qui a été retiré du chemin principal
- `proxmox_debian12_template`
- `proxmox_vm_clone`
- `playbooks/proxmox/*`
## Logique cible
Le sous-arbre `ansible/` vise une baseline VM commune :
1. petite ;
2. reproductible ;
3. fermée par défaut ;
4. compatible avec l'inventaire généré par OpenTofu ;
5. prête à recevoir ensuite les rôles applicatifs C2/C3/C4/C5.
## Intégration de `ansible2.zip`
Apports retenus :
- rôle `common` utilisé comme source secondaire d'idées, déjà absorbées en grande partie par `baseline_common` + `hardening_common` + `firewall_nftables`
- rôles applicatifs `postgresql`, `keycloak`, `forgejo`, `powerdns-authoritative` intégrés au dépôt convergé
- exemple concret d'inventaire OpenTofu (`inventory/tofu_generated.yml`) conservé comme gabarit
- exemples de vault Phase 1 / Phase 2 conservés
Décision d'architecture :
- le rôle `common` de `ansible2.zip` n'est pas repris tel quel pour éviter un doublon avec la baseline convergée
- les playbooks originaux ne sont pas repris à l'identique; ils sont réémis sous `playbooks/services/` pour s'aligner avec la séparation OpenTofu → inventaire, puis Ansible → convergence + service
## Inventaire OpenTofu recommandé
Le dépôt consomme un inventaire généré par OpenTofu avec un groupe racine `boreale_all`, des groupes de couche (`c3_supervision`, `c3_core`, `c4_forge`, `c5_pivot`) et un sous-arbre `tenants/c7_products`. Des métadonnées minimales par hôte sont attendues : `boreale_layer`, `boreale_role`, `boreale_env`, `boreale_managed_by`.

View file

@ -0,0 +1,66 @@
# ══════════════════════════════════════════════════════════════════
# Inventaire Ansible — généré par OpenTofu
# NE PAS MODIFIER MANUELLEMENT — regénéré à chaque tofu apply
# Forme cible recommandée pour l'Alliance Boréale
# ══════════════════════════════════════════════════════════════════
---
all:
children:
boreale_all:
children:
c3_supervision:
hosts:
c3-icinga-01:
ansible_host: 192.168.10.31
icinga_role: master
boreale_layer: c3
boreale_role: icinga
boreale_env: prod
boreale_managed_by: opentofu
c3_core:
hosts:
c3-netbox-01:
ansible_host: 192.168.10.30
boreale_layer: c3
boreale_role: netbox
boreale_env: prod
boreale_managed_by: opentofu
c4_forge:
hosts:
c4-forgejo-01:
ansible_host: 192.168.10.40
boreale_layer: c4
boreale_role: forgejo
boreale_env: prod
boreale_managed_by: opentofu
c5_pivot:
hosts:
c5-runner-01:
ansible_host: 192.168.10.50
boreale_layer: c5
boreale_role: runner
boreale_env: prod
boreale_managed_by: opentofu
tenants:
children:
c7_products:
hosts:
c7-87-16-01:
ansible_host: 192.168.12.45
boreale_layer: c7
boreale_role: tenant_app
boreale_env: prod
boreale_managed_by: opentofu
c7-life-noc-01:
ansible_host: 192.168.12.40
boreale_layer: c7
boreale_role: tenant_app
boreale_env: prod
boreale_managed_by: opentofu
vars:
ansible_ssh_private_key_file: ~/.ssh/id_ed25519_ansible_chezlepro
ansible_user: ansible

View file

@ -0,0 +1,83 @@
---
# Paramètres globaux de la baseline commune Alliance Boréale
# Les hôtes et groupes sont générés par OpenTofu dans inventories/prod/hosts.yml
ab_domain: chezlepro.local
ab_dns_servers:
- 192.168.10.30
ab_admin_networks:
- 192.168.10.0/24
- 192.168.12.0/24
ab_ntp_server: 192.168.10.1
ab_timezone: America/Montreal
ab_enable_wazuh_agent: false
# Baseline commune
baseline_common_enabled: true
baseline_common_upgrade: true
baseline_common_remove_packages: []
baseline_common_packages:
- apt-listchanges
- unattended-upgrades
- needrestart
- debsecan
- ca-certificates
- curl
- jq
- vim
- less
- git
- sudo
- rsync
- python3
- python3-apt
- acl
- chrony
- qemu-guest-agent
- nftables
- apparmor
- apparmor-utils
- fail2ban
- debian-archive-keyring
baseline_common_manage_sources: false
# Hardening commun
hardening_common_enabled: true
hardening_common_fail2ban_enabled: true
hardening_common_unattended_upgrades_enabled: true
hardening_common_debsecan_enabled: true
hardening_common_apparmor_enabled: true
hardening_common_journald_enabled: true
hardening_common_journald_system_max_use: 512M
hardening_common_journald_runtime_max_use: 128M
hardening_common_ssh_port: 22
hardening_common_ssh_allow_groups:
- sudo
hardening_common_ssh_listen_addresses: []
hardening_common_fail2ban_sshd_enabled: true
# Pare-feu local
firewall_nftables_enabled: true
firewall_nftables_allow_ipv6: true
firewall_nftables_policy_input: drop
firewall_nftables_policy_forward: drop
firewall_nftables_policy_output: accept
firewall_nftables_allowed_tcp_in:
- dport: 22
src: 192.168.10.0/24
- dport: 22
src: 192.168.12.0/24
firewall_nftables_allowed_udp_in: []
firewall_nftables_allow_icmp: true
# Monitoring commun
monitoring_icinga_agent_enabled: true
monitoring_icinga_agent_master: "{{ hostvars['c3-icinga-01'].ansible_host | default('c3-icinga-01') }}"
monitoring_icinga_agent_parent_zone: master
monitoring_icinga_agent_zone: "{{ inventory_hostname }}"
# Wazuh optionnel
security_wazuh_agent_enabled: "{{ ab_enable_wazuh_agent }}"
security_wazuh_agent_manager: c3-wazuh-01
security_wazuh_agent_registration_password: ""

View file

@ -0,0 +1,2 @@
---
monitoring_icinga_agent_enabled: false

View file

@ -0,0 +1,2 @@
---
ab_enable_wazuh_agent: true

View file

@ -0,0 +1,2 @@
---
# Override example for product-facing tenant nodes

View file

@ -0,0 +1,20 @@
---
keycloak:
hostname: sso.example.internal
admin_user: admin
admin_password: "{{ vault_keycloak_admin_password }}"
db_name: keycloak
db_user: keycloak
db_password: "{{ vault_keycloak_db_password }}"
http_port: 8080
https_enabled: false
postgresql:
version: 15
listen_addresses: localhost
databases:
- name: keycloak
owner: keycloak
users:
- name: keycloak
password: "{{ vault_keycloak_db_password }}"

View file

@ -0,0 +1,20 @@
---
pdns:
api_key: "{{ vault_pdns_api_key }}"
api_enabled: true
webserver_address: 0.0.0.0
webserver_allow_from:
- 127.0.0.1
gpgsql_dbname: pdns
gpgsql_user: pdns
gpgsql_password: "{{ vault_postgresql_pdns_password }}"
postgresql:
version: 15
listen_addresses: localhost
databases:
- name: pdns
owner: pdns
users:
- name: pdns
password: "{{ vault_postgresql_pdns_password }}"

View file

@ -0,0 +1,23 @@
---
forgejo:
hostname: git.example.internal
ssh_port: 2222
admin_username: admin
admin_email: admin@example.internal
admin_password: "{{ vault_forgejo_admin_password }}"
db_name: forgejo
db_user: forgejo
db_password: "{{ vault_forgejo_db_password }}"
secret_key: "{{ vault_forgejo_secret_key }}"
internal_token: "{{ vault_forgejo_internal_token }}"
jwt_secret: "{{ vault_forgejo_jwt_secret }}"
postgresql:
version: 15
listen_addresses: localhost
databases:
- name: forgejo
owner: forgejo
users:
- name: forgejo
password: "{{ vault_forgejo_db_password }}"

View file

@ -0,0 +1,50 @@
# ══════════════════════════════════════════════════════════════════
# Inventaire Ansible — généré par OpenTofu
# NE PAS MODIFIER MANUELLEMENT — regénéré à chaque tofu apply
# ══════════════════════════════════════════════════════════════════
---
"all":
"children":
"boreale_all":
"children":
"c2_edge":
"hosts": {}
"c3_core":
"hosts": {}
"c3_identity":
"hosts": {}
"c3_supervision":
"hosts": {}
"c4_forge":
"hosts": {}
"c5_pivot":
"hosts": {}
"tenants":
"children":
"c6_services":
"hosts": {}
"c7_products":
"hosts":
"c7-87-16-02":
"ansible_host": "192.168.12.46"
"boreale_env": null
"boreale_layer": "c7"
"boreale_managed_by": "opentofu"
"boreale_role": "87-16"
"c7-gestion-01":
"ansible_host": "192.168.8.30"
"boreale_env": null
"boreale_layer": "c7"
"boreale_managed_by": "opentofu"
"boreale_role": "gestion"
"c7-life-noc-01":
"ansible_host": "192.168.12.40"
"boreale_env": null
"boreale_layer": "c7"
"boreale_managed_by": "opentofu"
"boreale_role": "life-noc"
"c8_knowledge":
"hosts": {}
"vars":
"ansible_ssh_private_key_file": "~/.ssh/id_ed25519_ansible_chezlepro"
"ansible_user": "ansible"

View file

@ -0,0 +1,6 @@
---
- name: Baseline packages et services communs
hosts: boreale_all
become: true
roles:
- role: baseline_common

View file

@ -0,0 +1,9 @@
---
- name: Hardening commun Alliance Boréale
hosts: boreale_all
become: true
roles:
- role: hardening_common
- role: firewall_nftables
- role: monitoring_icinga_agent
- role: security_wazuh_agent

View file

@ -0,0 +1,11 @@
---
- name: Services C3 coeur / réseau
hosts: c3_core
become: true
roles:
- role: baseline_common
- role: hardening_common
- role: firewall_nftables
- role: monitoring_icinga_agent
- role: postgresql
- role: powerdns_authoritative

View file

@ -0,0 +1,22 @@
---
- name: Services C3 coeur / identité
hosts: c3_core
become: true
roles:
- role: baseline_common
- role: hardening_common
- role: firewall_nftables
- role: monitoring_icinga_agent
- role: postgresql
- role: keycloak
- name: Services C4 forge
hosts: c4_forge
become: true
roles:
- role: baseline_common
- role: hardening_common
- role: firewall_nftables
- role: monitoring_icinga_agent
- role: postgresql
- role: forgejo

View file

@ -0,0 +1,10 @@
---
- name: Services C5 pivot / exécution
hosts: c5_pivot
become: true
roles:
- role: baseline_common
- role: hardening_common
- role: firewall_nftables
- role: monitoring_icinga_agent
- role: security_wazuh_agent

View file

@ -0,0 +1,10 @@
---
- name: Services tenants C7
hosts: c7_products
become: true
roles:
- role: baseline_common
- role: hardening_common
- role: firewall_nftables
- role: monitoring_icinga_agent
- role: security_wazuh_agent

View file

@ -0,0 +1,10 @@
---
- name: Baseline complète Alliance Boréale
hosts: boreale_all
become: true
roles:
- role: baseline_common
- role: hardening_common
- role: firewall_nftables
- role: monitoring_icinga_agent
- role: security_wazuh_agent

View file

@ -0,0 +1,5 @@
---
collections:
- name: ansible.posix
- name: community.general
- name: community.postgresql

View file

@ -0,0 +1,8 @@
---
baseline_common_enabled: true
baseline_common_upgrade: true
baseline_common_packages: []
baseline_common_remove_packages: []
baseline_common_manage_chrony: true
baseline_common_manage_timezone: true
baseline_common_qemu_guest_agent_service: qemu-guest-agent

Some files were not shown because too many files have changed in this diff Show more