From 92a833ec50a68931dc494b02c46b266e3bac7a48 Mon Sep 17 00:00:00 2001 From: hkoeck Date: Sat, 7 Mar 2026 19:21:13 +0100 Subject: [PATCH] Refine workshop UI navigation and hardening guidance --- Makefile | 5 ++- README.md | 3 ++ challenges/README.md | 51 ++++++++++++++++++++++++++++-- proxy/html/challenges.html | 42 +++++++++++++++++++++---- proxy/html/hints.html | 30 ++++++++++++++++-- proxy/html/index.html | 11 ++++--- proxy/html/solutions.html | 60 ++++++++++++++++++++++++++++++++---- proxy/nginx.tls.example.conf | 6 +++- scripts/reset-lab.sh | 22 ++++++++++--- scripts/workshop.ps1 | 3 +- 10 files changed, 205 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 1fbe5bc..69ee4e9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: bootstrap up down logs redeploy proxy-reload reset reset-hard +.PHONY: bootstrap up down logs redeploy proxy-reload reset reset-hard reset-origin bootstrap: ./scripts/bootstrap.sh @@ -24,3 +24,6 @@ reset: reset-hard: ./scripts/reset-lab.sh --hard + +reset-origin: + ./scripts/reset-lab.sh --hard-origin diff --git a/README.md b/README.md index ac2f5c3..c2f3a91 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ Weitere Aktionen in PowerShell: ./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: @@ -104,12 +105,14 @@ 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. diff --git a/challenges/README.md b/challenges/README.md index dda1d91..13e2011 100644 --- a/challenges/README.md +++ b/challenges/README.md @@ -29,6 +29,9 @@ Diese Aufgaben sind bewusst auf **manuelle Proxy-Konfiguration** ausgelegt. - Dann erst Requests ausfuehren. - In eigenen Worten erklaeren, warum die Antworten unterschiedlich sind. +**Warum wichtig** +- Das ist die Kernkompetenz bei Reverse Proxys: Request-Fluss lesen und korrekt begruenden. + **Done-Check** ```bash curl http://localhost:8080/service/a @@ -50,6 +53,9 @@ curl http://localhost:8080/service/b - Upstream + Route `/service/c` in Nginx anlegen. - A/B muessen weiterhin funktionieren. +**Warum wichtig** +- In realen Umgebungen kommen neue Services laufend dazu. Saubere Erweiterung ohne Regression ist entscheidend. + **Done-Check** ```bash curl http://localhost:8080/service/c @@ -69,6 +75,9 @@ curl http://localhost:8080/service/b - Route `/demo/a` anbieten, die auf Backend A fuehrt. - Entweder per rewrite oder per eigener proxy-Route loesen. +**Warum wichtig** +- Der Proxy entkoppelt externe API-Pfade von internen Service-Pfaden und ermoeglicht saubere Migrationen. + **Done-Check** ```bash curl http://localhost:8080/demo/a @@ -90,7 +99,14 @@ curl http://localhost:8080/demo/a - Mindestens setzen: - `X-Content-Type-Options: nosniff` - `X-Frame-Options: DENY` - - `Referrer-Policy: no-referrer` + - `Referrer-Policy: strict-origin-when-cross-origin` + - `Permissions-Policy: camera=(), microphone=(), geolocation=()` + - `Cross-Origin-Opener-Policy: same-origin` + - `Cross-Origin-Resource-Policy: same-origin` +- Optional (Bonus): `Content-Security-Policy` fuer statische Seiten (mit Inline-Styles bewusst beruecksichtigen) + +**Warum wichtig** +- Diese Header reduzieren typische Browser-Angriffsvektoren und gehoeren zu Security-Baselines. **Done-Check** ```bash @@ -109,6 +125,9 @@ curl -I http://localhost:8080/ - Route `/internal/status` bauen. - Nur `127.0.0.1` erlauben, alle anderen verbieten. +**Warum wichtig** +- Nicht jeder Endpoint soll oeffentlich sein; Zugriffskontrolle direkt am Proxy ist oft die erste Schutzschicht. + **Wichtiger Hinweis** - Host-Request ueber `localhost:8080` kommt aus Docker-Sicht oft **nicht** von `127.0.0.1`. @@ -133,6 +152,9 @@ curl -i http://localhost:8080/internal/status - Eigenes `log_format` mit Upstream-Infos anlegen. - Access-Log auf das neue Format umstellen. +**Warum wichtig** +- Gute Logs verkuerzen Incident- und Debug-Zeit drastisch und sind zentral fuer Betrieb/Security. + **Done-Check** ```bash curl http://localhost:8080/service/a @@ -153,6 +175,9 @@ curl http://localhost:8080/service/a - `upstream backend_a` auf beide Instanzen erweitern. - Mehrfach-Requests zeigen, dass beide Instanzen antworten. +**Warum wichtig** +- Lastverteilung ist eine der wichtigsten Funktionen eines Reverse Proxys fuer Skalierung und Verfuegbarkeit. + **Done-Check (Beispiel)** ```bash for i in $(seq 1 8); do @@ -160,7 +185,7 @@ for i in $(seq 1 8); do done ``` -### 6b) Header Stripping (Response) +### 6b) Response Header Minimization **Ziel** - Unnoetige Header aus Upstream-Responses entfernen. @@ -173,6 +198,13 @@ done (z. B. `ETag`, `Last-Modified`). - Kurz erklaeren, warum weniger Fingerprinting-Infos hilfreich sind. +**Abgrenzung zu Challenge 4** +- Challenge 4 setzt aktive Schutz-Header. +- Challenge 6b entfernt unnoetige Header aus Upstream-Responses. + +**Warum wichtig** +- Weniger Response-Metadaten bedeuten weniger Angriffsoberflaeche fuer Fingerprinting und Reconnaissance. + **Done-Check** ```bash curl -I http://localhost:8080/service/a @@ -191,6 +223,9 @@ curl -I http://localhost:8080/service/a - Mindestens 2-3 Fehler finden und fixen. - Symptome und Diagnoseweg erklaeren. +**Warum wichtig** +- Debugging unter Druck ist Praxisalltag; diese Aufgabe trainiert systematisches Vorgehen mit Logs und Config-Tests. + **Done-Check** ```bash curl http://localhost:8080/service/a @@ -216,6 +251,9 @@ curl http://localhost:8080/service/b - Proxy auf `443` erweitern (z. B. `8443:443`). - Root-CA importieren und ohne `-k` testen. +**Warum wichtig** +- TLS korrekt einzurichten ist Basis fuer Vertraulichkeit, Integritaet und Vertrauensaufbau im Netzwerk. + **Done-Check** ```bash curl https://localhost:8443/service/a @@ -237,6 +275,9 @@ curl https://localhost:8443/service/a - HTTP Requests auf HTTPS redirecten. - `/healthz` darf optional auf HTTP bleiben. +**Warum wichtig** +- Redirect erzwingt verschluesselten Zugriff und verhindert versehentliche Nutzung unsicherer HTTP-Endpunkte. + **Done-Check** ```bash curl -I http://localhost:8080/service/a @@ -259,6 +300,9 @@ curl -I http://localhost:8080/service/a - HSTS setzen (`Strict-Transport-Security`). - Zertifikatskette pruefen und kurz erklaeren. +**Warum wichtig** +- Reines "HTTPS an" reicht nicht: erst Haertung + HSTS reduzieren Downgrade- und Fehlkonfigurationsrisiken. + **Hinweis** - Im HTTP-Basissetup ist HSTS absichtlich **noch nicht** aktiv. Das ist Teil der Aufgabe. @@ -283,6 +327,9 @@ openssl s_client -connect localhost:8443 -servername localhost - `ClientHello`, `ServerHello`, `Certificate` markieren. - Technisch erklaeren, warum HTTP lesbar ist und HTTPS ohne Keys nicht. +**Warum wichtig** +- Wer den Unterschied auf Paketebene gesehen hat, versteht TLS nicht nur theoretisch, sondern praktisch. + **Vorgehen (empfohlen)** 1. Capture auf passendem Interface starten (lokal meist `lo`). 2. HTTP Request senden und lesbaren Stream zeigen. diff --git a/proxy/html/challenges.html b/proxy/html/challenges.html index 54d58b7..0b5c3c7 100644 --- a/proxy/html/challenges.html +++ b/proxy/html/challenges.html @@ -65,6 +65,8 @@ } code { + font-family: "JetBrains Mono", "Fira Code", "Consolas", "Liberation Mono", monospace; + font-size: 0.92em; background: #0d1f31; border: 1px solid #2d4f6e; border-radius: 6px; @@ -75,8 +77,20 @@ background: #0b2133; border: 1px solid #2b5578; border-radius: 10px; - padding: 0.7rem; - overflow: auto; + padding: 0.75rem 0.85rem; + overflow-x: auto; + margin: 0.65rem 0; + } + + pre code { + display: block; + background: transparent; + border: 0; + border-radius: 0; + padding: 0; + font-size: 0.92rem; + line-height: 1.45; + white-space: pre; } .top-links { @@ -153,6 +167,7 @@

Manuelle Proxy-Konfiguration, Security-Entscheidungen und TLS von Grund auf.

diff --git a/proxy/html/index.html b/proxy/html/index.html index 9d63438..e1b88f9 100644 --- a/proxy/html/index.html +++ b/proxy/html/index.html @@ -58,6 +58,8 @@ } code { + font-family: "JetBrains Mono", "Fira Code", "Consolas", "Liberation Mono", monospace; + font-size: 0.92em; background: #0d1f31; border: 1px solid #2d4f6e; border-radius: 6px; @@ -68,7 +70,7 @@ color: var(--accent); } - .links { + .top-links { display: flex; flex-wrap: wrap; gap: 0.5rem; @@ -105,12 +107,13 @@ Basis läuft mit HTTP. Ziel im Workshop: Reverse Proxy verstehen und HTTPS/TLS manuell aufbauen.

-