# Workshop Challenges (Reverse Proxy + TLS Focus) Diese Aufgaben sind auf **manuelle Proxy-Konfiguration** ausgelegt. Abgabe pro Aufgabe: - kurzer Demo-Run (1-3 Minuten) - Done-Check Command - 2-3 Saetze: Was wurde geaendert und warum? ## Arbeitsmodus 1. Datei anpassen (`proxy/nginx.conf`, `docker-compose.yml`). 2. Deployen mit `make redeploy` oder `make proxy-reload`. 3. Testen mit `curl`/`openssl`. 4. Wenn etwas kaputt ist: `./scripts/compose.sh logs reverse-proxy`. --- ## Easy ### 1) Routing verstehen **Ziel** - Reverse Proxy leitet Requests auf unterschiedliche Backends. **Muss** - `service/a` und `service/b` aufrufen. - Unterschiede in den Antworten erklaeren. **Done-Check** ```bash curl http://localhost:8080/service/a curl http://localhost:8080/service/b ``` ### 2) Drittes Backend manuell hinzufuegen **Ziel** - Proxy auf ein neues Backend erweitern. **Dateien** - `docker-compose.yml` - `proxy/nginx.conf` **Muss** - Service `backend-c` anlegen. - Upstream + Route `/service/c` konfigurieren. **Done-Check** ```bash curl http://localhost:8080/service/c ``` ### 3) Eigene Route mit Rewrite **Ziel** - URL-Struktur im Proxy gestalten. **Datei** - `proxy/nginx.conf` **Muss** - Route `/demo/a` soll intern auf Backend A zeigen. - Implementierung ueber `rewrite` oder eigene `location`. **Done-Check** ```bash curl http://localhost:8080/demo/a ``` --- ## Medium ### 4) Security Headers setzen **Ziel** - Grundlegende Header-Haertung im Proxy. **Datei** - `proxy/nginx.conf` **Muss** - Setze mindestens: - `X-Content-Type-Options: nosniff` - `X-Frame-Options: DENY` - `Referrer-Policy: no-referrer` **Done-Check** ```bash curl -I http://localhost:8080/ ``` ### 5) Interne Route absichern **Ziel** - Route nur lokal erreichbar machen. **Datei** - `proxy/nginx.conf` **Muss** - Neue Route `/internal/status` bauen. - Nur `127.0.0.1` erlauben, alle anderen verbieten. **Done-Check** ```bash curl -i http://localhost:8080/internal/status ``` ### 6) Logging verbessern **Ziel** - Proxy-Debugging ueber bessere Logs. **Datei** - `proxy/nginx.conf` **Muss** - Eigenes `log_format` mit Upstream-Infos erstellen. - Access Log auf dieses Format umstellen. **Done-Check** ```bash curl http://localhost:8080/service/a ./scripts/compose.sh logs reverse-proxy ``` --- ## Hard (TLS) ### 7) HTTPS von 0 mit Easy-RSA **Ziel** - Eigene CA + Server-Zertifikat fuer `localhost`. **Dateien** - `docker-compose.yml` - `proxy/nginx.conf` **Muss** - Cert fuer `localhost` erzeugen. - Proxy auf `443` aktivieren (z. B. `8443:443`). - Root-CA importieren. **Done-Check** ```bash curl https://localhost:8443/service/a ``` ### 8) HTTP -> HTTPS Redirect **Ziel** - Klarer Redirect-Flow. **Datei** - `proxy/nginx.conf` **Muss** - HTTP Requests auf HTTPS umleiten. - `/healthz` darf optional auf HTTP bleiben. **Done-Check** ```bash curl -I http://localhost:8080/service/a ``` ### 9) TLS Haertung + Chain Check **Ziel** - Bessere TLS-Defaults + saubere Validierung. **Datei** - `proxy/nginx.conf` **Muss** - TLS auf 1.2/1.3 beschraenken. - HSTS aktivieren (`Strict-Transport-Security`). - Zertifikatskette pruefen. Hinweis: Im HTTP-Basissetup ist HSTS absichtlich **noch nicht** aktiv. Das ist Teil der Aufgabe. **Done-Check** ```bash curl -I https://localhost:8443/service/a openssl s_client -connect localhost:8443 -servername localhost ``` --- ## Bonus Expert ### 10) Wireshark: HTTP vs HTTPS **Ziel** - Sichtbar machen, was verschluesselt ist und was nicht. **Muss** - HTTP Traffic auf `8080` mitschneiden. - HTTPS Traffic auf `8443` mitschneiden. - TLS Handshake markieren (`ClientHello`, `ServerHello`, `Certificate`). - Technisch erklaeren, warum HTTP lesbar ist und HTTPS nicht. **Vorgehen (empfohlen)** 1. Capture auf `lo` (oder passendes Interface) starten, Filter `tcp.port == 8080`. 2. `curl http://localhost:8080/service/a` senden und HTTP-Stream zeigen. 3. Capture auf `tcp.port == 8443` oder `tls` umstellen. 4. `curl https://localhost:8443/service/a` senden. 5. Handshake-Pakete markieren und kurz erklaeren. **Optional** - TLS Decrypt mit `SSLKEYLOGFILE`. **Done-Check** - 3-4 Screenshots + 3-5 Bulletpoints Auswertung. **Typische Fehler** - falsches Interface gewaehlt - HTTPS noch nicht korrekt aktiv - Keylog gesetzt, aber Browser nicht aus derselben Shell gestartet --- ## Zusatz-Hints - `challenges/easyrsa-hints.md` - `challenges/wireshark-hints.md`