152 lines
3.8 KiB
Markdown
152 lines
3.8 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`
|
|
|
|
Docker muss in Linux installiert sein oder Docker Desktop mit WSL-Integration muss verfuegbar sein.
|
|
|
|
### Installation
|
|
|
|
#### Windows
|
|
|
|
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
|
|
```
|
|
|
|
Nach der Installation von Docker Desktop aktiviere die WSL-Integration in den Einstellungen.
|
|
|
|
Plattformhinweise:
|
|
|
|
- Linux: Docker Engine oder Docker Desktop
|
|
- macOS: Docker Desktop (falls `make` fehlt -> `xcode-select --install`)
|
|
- Windows: Docker Desktop mit aktivierter WSL-Integration
|
|
|
|
## 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
|
|
```
|
|
|
|
## 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`.
|