79a13f0919
Fachliche Fixes: - Easy-RSA: explizites --subject-alt-name (SAN) ergaenzt, sonst scheitert curl trotz CA-Import - HSTS: max-age auf 3600 reduziert, includeSubDomains erklaert, Warnung zur host-weiten Browser-Falle + Reset-Weg - Challenge 9: Backup-/Restore-Schritte fuer nginx.conf - Compose-Portwechsel: redeploy statt proxy-reload klargestellt - log_format-Platzierung (http-Block) dokumentiert - add_header-Vererbungsfalle erklaert (Ch. 4 + Abgrenzung Ch. 8) Angabe-Struktur (alle 13 Challenges): - Einheitliches Schema: Ausgangszustand, Schritte (Muss), Zielzustand/Akzeptanz, erwartete Done-Check-Ausgaben - Arbeitsweise global geklaert (additiv, Ausnahme Ch. 9, Reset) Robustheit/Kosmetik: - Load-Balancing: eindeutiger INSTANCE-Marker statt fragilem grep - Challenge-3-Titel auf "Alias-Route" korrigiert - HTTPS_PORT in .env.example parametrisiert - Umlaut-Konsistenz (ASCII) Windows-Tauglichkeit: - Klargestellt: Test-Kommandos laufen in WSL bash, nicht PowerShell (curl-Alias-Falle), Stack-Steuerung per Wrapper oder WSL - Wireshark: empfohlener Capture-Weg in WSL (tshark), npcap-Hinweis - CA-Import: Linux-Trust-Store (WSL) vs Windows-Browser (certutil) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
138 lines
3.7 KiB
Markdown
138 lines
3.7 KiB
Markdown
# HTL Workshop - Reverse Proxy & TLS Lab
|
|
|
|
Dieses Repo ist ein **leichtes HTTP-Basissetup** fuer einen Workshop mit Fokus auf:
|
|
|
|
- Reverse Proxy Grundlagen (Nginx)
|
|
- Routing auf mehrere Backends
|
|
- TLS/HTTPS manuell umsetzen (z. B. Easy-RSA)
|
|
- Security-Hardening im Proxy
|
|
|
|
Die Aufgaben sind absichtlich auf **manuelle Konfiguration** ausgelegt, nicht auf App-Entwicklung.
|
|
|
|
## Architektur
|
|
|
|
- `reverse-proxy` (Nginx, Port `8080`)
|
|
- `backend-a` (einfaches statisches Backend)
|
|
- `backend-b` (einfaches statisches Backend)
|
|
|
|
Basisrouten nach dem Start:
|
|
|
|
- `http://localhost:8080/` -> Startseite
|
|
- `http://localhost:8080/service/a` -> Backend A via Proxy
|
|
- `http://localhost:8080/service/b` -> Backend B via Proxy
|
|
|
|
## WebUI Struktur
|
|
|
|
- `http://localhost:8080/` -> Ueberblick + Navigation
|
|
- `http://localhost:8080/challenges.html` -> Detaillierte Challenges
|
|
- `http://localhost:8080/hints.html` -> Hint Cheatsheet
|
|
- `http://localhost:8080/solutions.html` -> Musterloesungen
|
|
|
|
## Voraussetzungen (Linux / macOS / Windows WSL)
|
|
|
|
1. Docker + Compose (`docker compose` oder `docker-compose`)
|
|
2. Optional fuer TLS-Challenges: `easy-rsa`, `openssl`, `wireshark`
|
|
|
|
Plattformhinweise:
|
|
|
|
- Linux: Docker Engine oder Docker Desktop
|
|
- macOS: Docker Desktop (falls `make` fehlt -> `xcode-select --install`)
|
|
- Windows: Docker Desktop + WSL Integration aktiv
|
|
|
|
## Schnellstart
|
|
|
|
### Linux / macOS
|
|
|
|
```bash
|
|
./scripts/bootstrap.sh
|
|
```
|
|
|
|
### Windows (WSL)
|
|
|
|
Option A (im WSL-Terminal):
|
|
|
|
```bash
|
|
./scripts/bootstrap.sh
|
|
```
|
|
|
|
Option B (PowerShell Wrapper):
|
|
|
|
```powershell
|
|
./scripts/workshop.ps1 -Action bootstrap
|
|
```
|
|
|
|
Der PowerShell-Wrapper braucht kein `make` und ruft Linux-Skripte direkt in WSL auf.
|
|
|
|
Falls PowerShell das Script blockiert:
|
|
|
|
```powershell
|
|
Set-ExecutionPolicy -Scope Process Bypass
|
|
```
|
|
|
|
Weitere Aktionen in PowerShell:
|
|
|
|
```powershell
|
|
./scripts/workshop.ps1 -Action redeploy
|
|
./scripts/workshop.ps1 -Action proxy-reload
|
|
./scripts/workshop.ps1 -Action reset
|
|
./scripts/workshop.ps1 -Action reset-hard
|
|
./scripts/workshop.ps1 -Action reset-origin
|
|
```
|
|
|
|
Wenn mehrere Distros installiert sind:
|
|
|
|
```powershell
|
|
./scripts/workshop.ps1 -Action bootstrap -Distro Ubuntu-24.04
|
|
```
|
|
|
|
Das Skript:
|
|
|
|
- prueft Docker + Compose
|
|
- erstellt `.env` aus `.env.example` (falls nicht vorhanden)
|
|
- startet den Stack
|
|
|
|
Hinweis zu Skriptnamen:
|
|
|
|
- `scripts/bootstrap.sh` ist der empfohlene Einstieg
|
|
- intern nutzt es `scripts/bootstrap-unix.sh`
|
|
- `scripts/bootstrap-wsl.sh` existiert nur noch als Kompatibilitaets-Wrapper
|
|
|
|
## Neu deployen / resetten
|
|
|
|
```bash
|
|
make redeploy
|
|
make proxy-reload
|
|
make reset
|
|
make reset-hard
|
|
make reset-origin
|
|
```
|
|
|
|
- `redeploy`: build + restart aller Services
|
|
- `proxy-reload`: nur Reverse Proxy restart
|
|
- `reset`: Container/Netzwerk/Volumes aufraeumen
|
|
- `reset-hard`: wie `reset`, plus lokale Git-Aenderungen verwerfen (falls Git-Repo)
|
|
- `reset-origin`: wie `reset-hard`, aber bevorzugt Ruecksetzen auf `origin/main`
|
|
|
|
Hinweis: `make redeploy` startet zusaetzlich den Reverse Proxy neu, damit Nginx-Config-Aenderungen sicher aktiv sind.
|
|
|
|
## Kurz testen
|
|
|
|
```bash
|
|
curl http://localhost:8080/service/a
|
|
curl http://localhost:8080/service/b
|
|
```
|
|
|
|
> **Windows:** Diese und alle weiteren Test-Kommandos (`curl`, `openssl`, `grep`, Schleifen) im **WSL-Terminal (bash)** ausfuehren, nicht in PowerShell. In PowerShell ist `curl` ein Alias fuer `Invoke-WebRequest` und versteht die genutzten Flags (`-I`, `-k`, `--cacert`) nicht. PowerShell nur fuer den Stack-Wrapper `scripts/workshop.ps1`.
|
|
|
|
## Fokus im Workshop
|
|
|
|
Die Basis ist bewusst nur HTTP. HTTPS ist Teil der Aufgaben:
|
|
|
|
- CA + Server-Zertifikat selbst erstellen
|
|
- Nginx auf 443 erweitern
|
|
- Root-CA importieren
|
|
- HSTS und TLS-Haertung umsetzen
|
|
- TLS mitschneiden und analysieren
|
|
|
|
Vollstaendige TLS-Beispielkonfiguration mit HSTS: `proxy/nginx.tls.example.conf`.
|