e639aa4f88
Schein-Konfigurierbarkeit beseitigt: HTTP_PORT/HTTPS_PORT liessen sich
zwar im Compose-Mapping setzen, aber nginx (statische Config) und alle
Test-Kommandos in MD/HTML waren auf 8080/8443 hartkodiert. Der einzige
reale Grund die Vars zu aendern (Port-Konflikt) brach also still die
gesamte Doku. Ports sind im Lab feste Konstanten -> hartkodieren.
- docker-compose.yml + Snippets (easyrsa-hints.md, solutions.html):
${HTTP_PORT:-8080}/${HTTPS_PORT:-8443} -> feste 8080/8443
- .env.example entfernt (enthielt nur diese zwei Vars), .env-Erzeugung
aus bootstrap.sh entfernt; .gitignore behaelt .env als Vorsorge
- README: .env-Bullet raus
Doku-Luecke geschlossen:
- README: up/down/logs ergaenzt (vorher nur in lab.sh usage()),
jeweils mit Kurzbeschreibung
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
139 lines
3.9 KiB
Markdown
139 lines
3.9 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
|
|
- 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 ruft intern `./scripts/lab.sh` in WSL auf - die gleiche Steuer-Oberflaeche wie unter Linux/WSL.
|
|
|
|
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
|
|
- startet den Stack
|
|
|
|
## Neu deployen / resetten
|
|
|
|
Alle Aktionen laufen ueber `./scripts/lab.sh <aktion>` (in WSL/Linux). Windows-PowerShell-Nutzer nehmen `./scripts/workshop.ps1 -Action <aktion>` - dahinter steckt dasselbe Skript.
|
|
|
|
```bash
|
|
./scripts/lab.sh up
|
|
./scripts/lab.sh redeploy
|
|
./scripts/lab.sh proxy-reload
|
|
./scripts/lab.sh down
|
|
./scripts/lab.sh logs
|
|
./scripts/lab.sh reset
|
|
./scripts/lab.sh reset-hard
|
|
./scripts/lab.sh reset-origin
|
|
```
|
|
|
|
- `up`: build + start (entspricht dem, was `bootstrap` am Ende macht)
|
|
- `redeploy`: build + restart aller Services
|
|
- `proxy-reload`: nur Reverse Proxy restart
|
|
- `down`: Stack stoppen (Container entfernen, Volumes bleiben)
|
|
- `logs`: Logs aller Services folgen (`Strg+C` zum Beenden)
|
|
- `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: `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`.
|