diff --git a/INSTRUCTIONS.md b/INSTRUCTIONS.md index b3bf47b..b7777c0 100755 --- a/INSTRUCTIONS.md +++ b/INSTRUCTIONS.md @@ -1,4 +1,14 @@ -# INSTRUCTIONS POUR VIBE +# INSTRUCTIONS POUR AGENTS + +## đ Sommaire des agents + +- **[AGENT_devops.md](AGENT_devops.md)** : OpĂ©rations quotidiennes (Status Monitor, commandes SSH, corrections courantes) +- **[AGENT_MAJ_traefik_GIT_inventaire.md](AGENT_MAJ_traefik_GIT_inventaire.md)** : Synchronisation Traefik/GIT (procĂ©dure dĂ©taillĂ©e) +- **[AGENT-creation-lxc-proxmox.md](AGENT-creation-lxc-proxmox.md)** : CrĂ©ation de containers LXC sur Proxmox +- **[AGENT-TRAEFIK-https-homelab-infomaniak.md](AGENT-TRAEFIK-https-homelab-infomaniak.md)** : Configuration HTTPS/Traefik avec Let's Encrypt +- **[AGENT_Transfert_de_certificat_viaCT200.md](AGENT_Transfert_de_certificat_viaCT200.md)** : Transfert de certificats via CT200 comme bastion + +--- ## RĂGLES ABSOLUES @@ -6,7 +16,7 @@ cd ~/homelab-config git pull -2. TOUJOURS travailler depuis ~/homelab-config (WSL) Tu as WSL d'installĂ© avec ubuntu. utilise le pour cloner git... +2. TOUJOURS travailler depuis ~/homelab-config (WSL) - Tu as WSL d'installĂ© avec ubuntu. utilise le pour cloner git... 3. JAMAIS toucher aux fichiers locaux sur C:/Users/theo/.vibe/Proxmox/inventair/ @@ -36,4 +46,4 @@ --- Créé par : Theo -Pour : Mistral Vibe +Pour : Mistral Vibe et autres agents diff --git a/projet-authent/.env b/projet-authent/.env new file mode 100644 index 0000000..d3d8807 --- /dev/null +++ b/projet-authent/.env @@ -0,0 +1,5 @@ +PG_USER=authentik +PG_DB=authentik +PG_PASS=XCYbxE3+7LmL6pv++F31IVNiHSPNHyAC +AUTHENTIK_SECRET_KEY=EcJRrU3zmqKzt37gZgViQw4+SydEdPtg29rXCEScQVVFbI1nNROOdh+rQuWCqtic +AUTHENTIK_ERROR_REPORTING__ENABLED=false diff --git a/projet-authent/.secrets b/projet-authent/.secrets new file mode 100644 index 0000000..662be18 --- /dev/null +++ b/projet-authent/.secrets @@ -0,0 +1,3 @@ +ROOT_PASS= +PG_PASS= +AUTH_KEY= diff --git a/projet-authent/authentik-secrets.md b/projet-authent/authentik-secrets.md new file mode 100644 index 0000000..e870f59 --- /dev/null +++ b/projet-authent/authentik-secrets.md @@ -0,0 +1,9 @@ +# Secrets Authentik + +GĂ©nĂ©rĂ©s le 2026-07-21T01:03:29+02:00 + +- root CT203 : rj6cuKjHTP2WUHFE +- PG_PASS : XCYbxE3+7LmL6pv++F31IVNiHSPNHyAC +- AUTHENTIK_SECRET_KEY : EcJRrU3zmqKzt37gZgViQw4+SydEdPtg29rXCEScQVVFbI1nNROOdh+rQuWCqtic +- Authentik admin (akadmin) : PLytRPLmwa1+eemjKfAy +- Gateway CT203 : 192.168.0.254 diff --git a/projet-authent/docker-compose.yml b/projet-authent/docker-compose.yml new file mode 100644 index 0000000..f423b57 --- /dev/null +++ b/projet-authent/docker-compose.yml @@ -0,0 +1,73 @@ +version: '3.8' + +services: + postgresql: + image: docker.io/library/postgres:16-alpine + container_name: authentik-postgresql + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] + start_period: 20s + interval: 30s + retries: 5 + timeout: 5s + volumes: + - ./database:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: ${PG_PASS} + POSTGRES_USER: ${PG_USER} + POSTGRES_DB: ${PG_DB} + + redis: + image: docker.io/library/redis:alpine + container_name: authentik-redis + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "redis-cli ping | grep PONG"] + start_period: 20s + interval: 30s + retries: 5 + timeout: 3s + volumes: + - ./redis:/data + + server: + image: ghcr.io/goauthentik/server:2024.8.3 + container_name: authentik-server + restart: unless-stopped + command: server + environment: + AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY} + AUTHENTIK_REDIS__HOST: redis + AUTHENTIK_POSTGRESQL__HOST: postgresql + AUTHENTIK_POSTGRESQL__USER: ${PG_USER} + AUTHENTIK_POSTGRESQL__NAME: ${PG_DB} + AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS} + volumes: + - ./media:/media + - ./custom-templates:/templates + ports: + - "9000:9000" + depends_on: + - postgresql + - redis + + worker: + image: ghcr.io/goauthentik/server:2024.8.3 + container_name: authentik-worker + restart: unless-stopped + command: worker + environment: + AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY} + AUTHENTIK_REDIS__HOST: redis + AUTHENTIK_POSTGRESQL__HOST: postgresql + AUTHENTIK_POSTGRESQL__USER: ${PG_USER} + AUTHENTIK_POSTGRESQL__NAME: ${PG_DB} + AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS} + volumes: + - ./media:/media + - ./certs:/certs + - ./custom-templates:/templates + depends_on: + - postgresql + - redis diff --git a/projet-authent/readme.md b/projet-authent/readme.md new file mode 100644 index 0000000..55637be --- /dev/null +++ b/projet-authent/readme.md @@ -0,0 +1,62 @@ +# DĂ©ploiement Authentik - Projet Authent + +## Statut du 21/07/2026 + +DĂ©ploiement d'Authentik sur un LXC Proxmox `203` sur `prox2`. + +## Infos clĂ©s + +- **Container LXC** : `203` sur `prox2` (`192.168.0.95`) +- **IP du CT203** : `192.168.0.203/24` +- **Gateway** : `192.168.0.254` (corrigĂ©e, n'Ă©tait pas `192.168.0.1`) +- **DNS** : `192.168.0.92` (AdGuard) +- **Hostname** : `Authentik` +- **Domaine Authentik** : `https://auth.peis.fr` +- **Application cible** : `https://status.peis.fr` (Status Monitor) +- **Fichier des secrets** : `authentik-secrets.md` (mots de passe, clĂ©s) + +## Ce qui a Ă©tĂ© fait + +1. Suppression du LXC `203` existant. +2. RecrĂ©ation propre du LXC `203` sur `prox2` avec les paramĂštres demandĂ©s. +3. Configuration SSH par clĂ© (`id_ed25519`) depuis WSL. +4. Activation de `nesting=1` et `keyctl=1`. +5. Correction de la gateway : `192.168.0.1` â `192.168.0.254` (rĂ©cupĂ©rĂ©e depuis `vmbr0` de `prox2`). +6. Installation de Docker et Docker Compose dans le LXC. +7. DĂ©ploiement d'Authentik `2024.8.3` avec PostgreSQL et Redis via `docker-compose.yml`. +8. Correction des permissions du volume `/opt/authentik/media` (`chown 1000:1000`). +9. Configuration Traefik pour exposer `auth.peis.fr` (`dynamic.yml` sur `ct200`). +10. CrĂ©ation du compte admin `akadmin` et du provider/application `Status Monitor` dans Authentik. + +## VĂ©rifications actuelles + +| URL | RĂ©sultat | +|-----|----------| +| `https://auth.peis.fr` | `302` â page de login Authentik accessible | +| `https://status.peis.fr` | `200` â service restaurĂ© | + +## ProblĂšme restant + +Le `forwardAuth` pour protĂ©ger `status.peis.fr` a Ă©tĂ© configurĂ© dans Traefik, mais l'`outpost` intĂ©grĂ© d'Authentik retourne `404` sur `/outpost.goauthentik.io/auth/traefik`. + +Le middleware a donc Ă©tĂ© dĂ©sactivĂ© temporairement dans `traefik-config/config/dynamic.yml` pour ne pas casser `status.peis.fr`. + +## Ă faire demain + +1. Se connecter Ă `https://auth.peis.fr` avec `akadmin`. +2. VĂ©rifier dans l'UI Authentik : + - **Applications** â `Status Monitor` existe et est associĂ©e au provider `status-monitor` + - **Outposts** â `authentik Embedded Outpost` contient bien le provider `status-monitor` +3. Tester directement l'URL de l'outpost : + `curl -H "X-Forwarded-Host: status.peis.fr" -H "X-Forwarded-Proto: https" http://192.168.0.203:9000/outpost.goauthentik.io/auth/traefik` +4. Si l'outpost rĂ©pond correctement (401 ou 302), rĂ©activer le middleware dans `traefik-config/config/dynamic.yml` : + - DĂ©commenter les lignes `middlewares: - "authentik-forwardauth"` sous `status-monitor` + - Copier `dynamic.yml` sur `ct200:/opt/traefik/config/dynamic.yml` + - `docker restart traefik-proxy` sur `ct200` + +## Fichiers importants + +- `authentik-secrets.md` : mots de passe gĂ©nĂ©rĂ©s +- `.env` : variables d'environnement Authentik +- `docker-compose.yml` : stack Authentik +- `../traefik-config/config/dynamic.yml` : configuration Traefik diff --git a/status-monitor/app.py b/status-monitor/app.py index 6c26a92..88d1eb8 100755 --- a/status-monitor/app.py +++ b/status-monitor/app.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Homelab Status Monitor v1.1.0""" +"""Homelab Status Monitor v1.1.1""" import socket import ssl @@ -9,7 +9,7 @@ import threading from datetime import datetime from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer -VERSION = "1.1.0" +VERSION = "1.1.1" # Service configuration: name, type (ssh/http/https), host, port, url (for http/https), insecure (for https) SERVICES = { @@ -37,6 +37,9 @@ SERVICES = { "ct201-status": {"name": "Status Monitor", "type": "ssh", "host": "192.168.0.201", "port": 22}, "ct201-status-http": {"name": "Status Monitor Web", "type": "http", "host": "192.168.0.201", "port": 80, "url": "/"}, + "ct202-gitea": {"name": "Gitea", "type": "ssh", "host": "192.168.0.202", "port": 22}, + "ct202-gitea-http": {"name": "Gitea Web", "type": "http", "host": "192.168.0.202", "port": 3000, "url": "/"}, + # VM "vm100-ha": {"name": "Home Assistant", "type": "ssh", "host": "192.168.0.43", "port": 22}, "vm100-ha-http": {"name": "Home Assistant Web", "type": "http", "host": "192.168.0.43", "port": 8123, "url": "/"}, @@ -245,7 +248,7 @@ def generate_html(): function setGlobalLoad(b) { refreshInProgress = b; var elem = document.getElementById("global-loading"); - elem.innerHTML = b ? '' : ''; + elem.innerHTML = b ? '' : ''; } function render() { @@ -262,7 +265,7 @@ def generate_html(): const pi = c.url ? c.host + ":" + c.port + c.url : c.host + ":" + c.port; h += "