2626abb0dc
# Conflicts: # README.md
156 lines
4.0 KiB
Markdown
156 lines
4.0 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 die WSL-Integration in den Einstellungen aktivieren.
|
|
|
|
### Linux / macOS
|
|
|
|
Docker Engine oder Docker Desktop installieren.
|
|
|
|
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
|
|
```
|
|
|
|
Wenn mehrere WSL-Distros installiert sind:
|
|
|
|
```powershell
|
|
./scripts/workshop.ps1 -Action bootstrap -Distro Ubuntu-24.04
|
|
```
|
|
|
|
Alternativ direkt im WSL-Terminal:
|
|
|
|
```bash
|
|
./scripts/bootstrap.sh
|
|
```
|
|
|
|
### Linux / macOS
|
|
|
|
```bash
|
|
./scripts/bootstrap.sh
|
|
```
|
|
|
|
Das Skript:
|
|
|
|
- prueft Docker + Compose
|
|
- startet den Stack
|
|
|
|
Der PowerShell-Wrapper ruft intern `./scripts/lab.sh` in WSL auf - dieselbe Steuer-Oberflaeche wie unter Linux/WSL.
|
|
|
|
## 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`.
|