diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 0000000..c706c85 --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,118 @@ +# Architecture + +## Schéma global + +``` +┌──────────────────────────────────────────────────────────────────┐ +│ PROXMOX (Machine INFRA) │ +│ │ +│ deploy-vm.sh (script autonome) │ +│ ├── Clone template Rocky Linux 9 (VMID 9000) │ +│ ├── Configure CPU / RAM / Disque │ +│ ├── Réseau : net0 (VLAN N) + net1 (VLAN 100 admin) │ +│ ├── Cloud-Init : IP statique, SSH custom port, hostname │ +│ └── Démarrage VM │ +└───────────────────────────┬──────────────────────────────────────┘ + │ VM démarrée, SSH accessible + ▼ +┌──────────────────────────────────────────────────────────────────┐ +│ MACHINE ADMIN (10.100.0.10) │ +│ │ +│ run-all.sh │ +│ │ │ +│ ├─[01]─ 01-pfsense.sh ──────────────────────► pfSense │ +│ │ expect → provision_pfsense_vlan_v2.sh 10.11.0.1:2266 │ +│ │ Crée VLAN + interface OPT + règles FW │ +│ │ php /etc/rc.reload_all (reload complet) │ +│ │ │ +│ ├─[02]─ 02-dns.sh ──────────────────────────► NS1 │ +│ │ expect → dns1maj.sh ns1.adm:2260 │ +│ │ A records : svc.ephaitek.com + adm.ephaitek.com │ +│ │ │ +│ ├─[03]─ 03-pki.sh ──────────────────────────► VM │ +│ │ Attente SSH (max 300s) 10.100.0.N:22N │ +│ │ SCP root.crt Vault → trust-store │ +│ │ update-ca-trust extract │ +│ │ │ +│ ├─[04]─ 04-splitdns.sh ─────────────────────► VM │ +│ │ CSV temporaire → deploy-dns-keyv3.sh 10.100.0.N:22N │ +│ │ dnsmasq + split-dns.conf + resolv.conf │ +│ │ │ +│ └─[05]─ 05-sssd.sh ─────────────────────────► VM │ +│ Vérifie Internet (3 essais) 10.100.0.N:22N │ +│ sssd.conf (600) + authselect │ +│ oddjobd + mkhomedir │ +│ LDAP → iam-kc (10.100.0.40:389) │ +└──────────────────────────────────────────────────────────────────┘ +``` + +## Infrastructure réseau Ephaitek + +``` +Internet (51.68.97.144) + │ + ▼ + ┌───────────┐ + │ pfSense │ ephafw (VMID 200) + │ ephafw │ SSH: admin@10.11.0.1:2266 + └─────┬─────┘ + │ vmbr1 (trunk VLANs 1-4094, bridge-vlan-aware) + │ + ├── VLAN 100 10.100.0.0/24 ── Réseau Admin/Management + │ ├── admin 10.100.0.10 SSH: 22100 + │ ├── ns1 10.100.0.60 SSH: 2260 + │ ├── ns2 10.100.0.61 SSH: 2261 + │ ├── iam-kc 10.100.0.40 LDAP: 389 + │ └── vault 10.100.0.42 API: 8200 + │ + ├── VLAN 60 10.60.0.0/24 ── DNS Services (SVC) + │ ├── ns1-svc 10.60.0.10 + │ └── ns2-svc 10.60.0.11 + │ + ├── VLAN 90 10.90.0.0/24 ── Services exposés + │ └── rp 10.90.0.10 Reverse Proxy + │ + └── VLAN 10.N.0.0/24 ── VM (créé dynamiquement) + └── vm 10.N.0.10 SSH: 22N + 10.100.0.N (interface admin) +``` + +## Composants clés + +| Composant | VMID | IP ADM | Port SSH | Rôle | +|-----------|------|---------------|----------|-----------------------------| +| ephafw | 200 | 10.11.0.1 | 2266 | pfSense — FW/VLAN/NAT | +| admin | 1110 | 10.100.0.10 | 22100 | Machine d'administration | +| ns1 | 1060 | 10.100.0.60 | 2260 | DNS primaire (PowerDNS) | +| ns2 | 1061 | 10.100.0.61 | 2261 | DNS secondaire | +| iam-kc | 1040 | 10.100.0.40 | 2240 | OpenLDAP + Keycloak | +| vault | 1042 | 10.100.0.42 | 2242 | HashiCorp Vault (PKI) | +| rp | 102 | 10.100.0.90 | 2223 | Reverse Proxy | + +## Zones DNS + +| Zone | Serveurs | Usage | +|---------------------|------------------------|--------------------------| +| `svc.ephaitek.com` | 10.60.0.10, 10.60.0.11 | Réseau services internes | +| `adm.ephaitek.com` | 10.100.0.60, 10.100.0.61 | Réseau admin/management | + +Chaque VM reçoit deux enregistrements A : +- `.svc.ephaitek.com` → `10..0.10` (IP SVC) +- `.adm.ephaitek.com` → `10.100.0.` (IP ADM) + +## Split DNS sur les VMs + +Chaque VM déployée configure `dnsmasq` en mode split DNS : + +``` +Requête DNS vers adm.ephaitek.com → NS ADM (10.100.0.60/61) +Requête DNS vers tout le reste → NS SVC (10.60.0.10/11) +``` + +Configuration dans `/etc/dnsmasq.d/split-dns.conf` : +``` +server=10.60.0.10@ +server=10.60.0.11@ +server=/adm.ephaitek.com/10.100.0.60@ +server=/adm.ephaitek.com/10.100.0.61@ +``` \ No newline at end of file