Files
htl-reverse-proxy-tls-lab/README.md
T

165 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
### Windows (empfohlen)
Installiere die erforderlichen Tools mit winget:
```powershell
winget install --id Microsoft.VisualStudioCode -e
winget install --id Git.Git -e
winget install --id Docker.DockerDesktop -e
```
Optional fuer TLS-Challenges:
```powershell
winget install --id OpenSSL.OpenSSL -e
winget install --id WiresharkFoundation.Wireshark -e
```
Nach der Installation von Docker Desktop aktiviere die WSL-Integration in den Einstellungen.
### Linux / macOS
Docker Engine oder Docker Desktop installieren (falls `make` fehlt auf macOS: `xcode-select --install`).
Optional fuer TLS-Challenges:
#### Ubuntu/Debian (apt)
```bash
sudo apt update
sudo apt install easy-rsa openssl wireshark
```
#### Fedora/RHEL (dnf)
```bash
sudo dnf install easy-rsa openssl wireshark
```
## Schnellstart
### Windows
```powershell
./scripts/workshop.ps1 -Action bootstrap
```
Falls PowerShell das Script blockiert:
```powershell
Set-ExecutionPolicy -Scope Process Bypass
```
Alternativ im WSL-Terminal:
```bash
./scripts/bootstrap.sh
```
### Linux / macOS
```bash
./scripts/bootstrap.sh
```
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
### Windows
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
```
### Linux / macOS
```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
```
## 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`.