Address workshop issues and expand challenge guidance

This commit is contained in:
hkoeck
2026-03-07 17:51:46 +01:00
parent 3047413a41
commit 314b63242f
12 changed files with 459 additions and 192 deletions
+25 -10
View File
@@ -28,23 +28,29 @@ Basisrouten nach dem Start:
- `http://localhost:8080/hints.html` -> Hint Cheatsheet
- `http://localhost:8080/solutions.html` -> Musterloesungen
## Voraussetzungen (WSL oder Linux)
## Voraussetzungen (Linux / macOS / Windows WSL)
1. Docker + Compose (`docker compose` oder `docker-compose`)
2. Bei Windows: Docker Desktop + WSL Integration aktiv
3. Optional fuer TLS-Challenges: `easy-rsa`, `openssl`, `wireshark`
2. Optional fuer TLS-Challenges: `easy-rsa`, `openssl`, `wireshark`
Plattformhinweise:
- Linux: Docker Engine oder Docker Desktop
- macOS: Docker Desktop
- Windows: Docker Desktop + WSL Integration aktiv
- macOS: falls `make` fehlt -> `xcode-select --install`
## Schnellstart
### Linux / macOS
```bash
./scripts/bootstrap.sh
```
### Start auf Windows
### Windows (WSL)
Empfohlen: ueber WSL starten (nicht nativ in PowerShell ohne WSL).
Option A (WSL Terminal):
Option A (im WSL-Terminal):
```bash
./scripts/bootstrap.sh
@@ -56,7 +62,7 @@ Option B (PowerShell Wrapper):
./scripts/workshop.ps1 -Action bootstrap
```
Der PowerShell-Wrapper braucht kein `make` und ruft die Linux-Skripte direkt in WSL auf.
Der PowerShell-Wrapper braucht kein `make` und ruft Linux-Skripte direkt in WSL auf.
Falls PowerShell das Script blockiert:
@@ -64,12 +70,13 @@ Falls PowerShell das Script blockiert:
Set-ExecutionPolicy -Scope Process Bypass
```
Weitere Aktionen aus PowerShell:
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
```
Wenn mehrere Distros installiert sind:
@@ -78,23 +85,31 @@ Wenn mehrere Distros installiert sind:
./scripts/workshop.ps1 -Action bootstrap -Distro Ubuntu-24.04
```
Der Script:
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
```
- `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)
Hinweis: `make redeploy` startet zusaetzlich den Reverse Proxy neu, damit Nginx-Config-Aenderungen sicher aktiv sind.
+47
View File
@@ -0,0 +1,47 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Backend A2</title>
<style>
:root {
--bg: #102335;
--card: #1d3f61;
--line: #4f86b3;
--text: #e9f2fb;
--muted: #c0d5e8;
}
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
padding: 1rem;
font-family: "Fira Sans", "Segoe UI", sans-serif;
color: var(--text);
background: radial-gradient(circle at top left, #315e86, var(--bg) 60%);
}
main {
width: min(760px, 100%);
background: var(--card);
border: 1px solid var(--line);
border-radius: 14px;
padding: 1.1rem;
}
h1 { margin-top: 0; }
p { color: var(--muted); }
</style>
</head>
<body>
<main>
<h1>Reverse Proxy Target A2</h1>
<p>Use this page to validate load balancing between backend-a and backend-a2.</p>
</main>
</body>
</html>
+74
View File
@@ -0,0 +1,74 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Backend C</title>
<style>
:root {
--bg: #0b1f10;
--card: #174028;
--line: #2e7a47;
--text: #e7f9ec;
--muted: #b5dec1;
--accent: #84e3a1;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
padding: 1rem;
font-family: "Fira Sans", "Segoe UI", sans-serif;
color: var(--text);
background: radial-gradient(circle at top center, #245939, var(--bg) 60%);
}
main {
width: min(760px, 100%);
background: var(--card);
border: 1px solid var(--line);
border-radius: 14px;
padding: 1.1rem;
}
h1 {
margin-top: 0;
}
p {
color: var(--muted);
}
code {
background: #113121;
border: 1px solid #2f7047;
border-radius: 6px;
padding: 0.1rem 0.35rem;
}
.tag {
display: inline-block;
background: var(--accent);
color: #083117;
border-radius: 999px;
padding: 0.15rem 0.55rem;
font-weight: 700;
font-size: 0.85rem;
}
</style>
</head>
<body>
<main>
<span class="tag">Backend C</span>
<h1>Reverse Proxy Target C</h1>
<p>This is a starter page for challenge 2.</p>
<p>Route example: <code>/service/c</code></p>
</main>
</body>
</html>
+127 -48
View File
@@ -1,32 +1,33 @@
# Workshop Challenges (Reverse Proxy + TLS Focus)
Diese Aufgaben sind auf **manuelle Proxy-Konfiguration** ausgelegt.
Diese Aufgaben sind bewusst auf **manuelle Proxy-Konfiguration** ausgelegt.
Abgabe pro Aufgabe:
## Abgabe-Format pro Challenge
- kurzer Demo-Run (1-3 Minuten)
- Done-Check Command
- 2-3 Saetze: Was wurde geaendert und warum?
- 1-3 Minuten Demo
- Done-Check Command live ausfuehren
- 2-3 Saetze erklaeren: was geaendert, warum, welche Wirkung
## Arbeitsmodus
1. Datei anpassen (`proxy/nginx.conf`, `docker-compose.yml`).
1. Dateien 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`.
3. Testen mit `curl` / `openssl` / Wireshark.
4. Bei Problemen: `./scripts/compose.sh logs reverse-proxy`.
---
## Easy
### 1) Routing verstehen
### 1) Routing verstehen (aktiv)
**Ziel**
- Reverse Proxy leitet Requests auf unterschiedliche Backends.
- Verstehen, wie Nginx Requests per Pfad an unterschiedliche Upstreams schickt.
**Muss**
- `service/a` und `service/b` aufrufen.
- Unterschiede in den Antworten erklaeren.
- Vor dem Test in `proxy/nginx.conf` nachsehen, welche `location` auf welchen `upstream` zeigt.
- Dann erst Requests ausfuehren.
- In eigenen Worten erklaeren, warum die Antworten unterschiedlich sind.
**Done-Check**
```bash
@@ -37,32 +38,36 @@ curl http://localhost:8080/service/b
### 2) Drittes Backend manuell hinzufuegen
**Ziel**
- Proxy auf ein neues Backend erweitern.
- Setup sicher erweitern, ohne bestehende Routen kaputt zu machen.
**Dateien**
- `docker-compose.yml`
- `proxy/nginx.conf`
- `backends/c/index.html` (vorhanden, darf angepasst werden)
**Muss**
- Service `backend-c` anlegen.
- Upstream + Route `/service/c` konfigurieren.
- Service `backend-c` in Compose einbauen.
- Upstream + Route `/service/c` in Nginx anlegen.
- A/B muessen weiterhin funktionieren.
**Done-Check**
```bash
curl http://localhost:8080/service/c
curl http://localhost:8080/service/a
curl http://localhost:8080/service/b
```
### 3) Eigene Route mit Rewrite
### 3) Eigene Route mit Rewrite oder Alias-Route
**Ziel**
- URL-Struktur im Proxy gestalten.
- URL-Design vom Backend-Pfad entkoppeln.
**Datei**
- `proxy/nginx.conf`
**Muss**
- Route `/demo/a` soll intern auf Backend A zeigen.
- Implementierung ueber `rewrite` oder eigene `location`.
- Route `/demo/a` anbieten, die auf Backend A fuehrt.
- Entweder per rewrite oder per eigener proxy-Route loesen.
**Done-Check**
```bash
@@ -76,13 +81,13 @@ curl http://localhost:8080/demo/a
### 4) Security Headers setzen
**Ziel**
- Grundlegende Header-Haertung im Proxy.
- Browserseitige Basishaertung aktivieren.
**Datei**
- `proxy/nginx.conf`
**Muss**
- Setze mindestens:
- Mindestens setzen:
- `X-Content-Type-Options: nosniff`
- `X-Frame-Options: DENY`
- `Referrer-Policy: no-referrer`
@@ -95,31 +100,38 @@ curl -I http://localhost:8080/
### 5) Interne Route absichern
**Ziel**
- Route nur lokal erreichbar machen.
- Zugriff auf eine interne Route gezielt begrenzen.
**Datei**
- `proxy/nginx.conf`
**Muss**
- Neue Route `/internal/status` bauen.
- Route `/internal/status` bauen.
- Nur `127.0.0.1` erlauben, alle anderen verbieten.
**Wichtiger Hinweis**
- Host-Request ueber `localhost:8080` kommt aus Docker-Sicht oft **nicht** von `127.0.0.1`.
**Done-Check**
```bash
# Erwartet typischerweise 403 vom Host (by design)
curl -i http://localhost:8080/internal/status
# Muss innerhalb des Proxy-Containers funktionieren
./scripts/compose.sh exec -T reverse-proxy sh -lc "wget -qO- http://127.0.0.1/internal/status"
```
### 6) Logging verbessern
**Ziel**
- Proxy-Debugging ueber bessere Logs.
- Besser debuggen koennen.
**Datei**
- `proxy/nginx.conf`
**Muss**
- Eigenes `log_format` mit Upstream-Infos erstellen.
- Access Log auf dieses Format umstellen.
- Eigenes `log_format` mit Upstream-Infos anlegen.
- Access-Log auf das neue Format umstellen.
**Done-Check**
```bash
@@ -127,6 +139,65 @@ curl http://localhost:8080/service/a
./scripts/compose.sh logs reverse-proxy
```
### 6a) Load Balancing konfigurieren
**Ziel**
- Kernfunktion eines Reverse Proxys praktisch zeigen.
**Dateien**
- `docker-compose.yml`
- `proxy/nginx.conf`
**Muss**
- Zweite Instanz von Backend A (`backend-a2`) anlegen.
- `upstream backend_a` auf beide Instanzen erweitern.
- Mehrfach-Requests zeigen, dass beide Instanzen antworten.
**Done-Check (Beispiel)**
```bash
for i in $(seq 1 8); do
curl -s http://localhost:8080/service/a | grep -o "Target A2\|Target A"
done
```
### 6b) Header Stripping (Response)
**Ziel**
- Unnoetige Header aus Upstream-Responses entfernen.
**Datei**
- `proxy/nginx.conf`
**Muss**
- Mit `proxy_hide_header` mindestens einen durchgereichten Backend-Header ausblenden
(z. B. `ETag`, `Last-Modified`).
- Kurz erklaeren, warum weniger Fingerprinting-Infos hilfreich sind.
**Done-Check**
```bash
curl -I http://localhost:8080/service/a
```
### 6c) Debugging Challenge (kaputte Config reparieren)
**Ziel**
- Fehlerdiagnose in Nginx ueben.
**Datei**
- `proxy/nginx.broken.conf`
**Muss**
- Defekte Config testweise als aktive Config verwenden.
- Mindestens 2-3 Fehler finden und fixen.
- Symptome und Diagnoseweg erklaeren.
**Done-Check**
```bash
curl http://localhost:8080/service/a
curl http://localhost:8080/service/b
./scripts/compose.sh logs reverse-proxy
```
---
## Hard (TLS)
@@ -134,16 +205,16 @@ curl http://localhost:8080/service/a
### 7) HTTPS von 0 mit Easy-RSA
**Ziel**
- Eigene CA + Server-Zertifikat fuer `localhost`.
- Eigene CA + Server-Zertifikat fuer `localhost` erstellen.
**Dateien**
- `docker-compose.yml`
- `proxy/nginx.conf`
**Muss**
- Cert fuer `localhost` erzeugen.
- Proxy auf `443` aktivieren (z. B. `8443:443`).
- Root-CA importieren.
- Zertifikat fuer `localhost` erstellen.
- Proxy auf `443` erweitern (z. B. `8443:443`).
- Root-CA importieren und ohne `-k` testen.
**Done-Check**
```bash
@@ -152,14 +223,18 @@ curl https://localhost:8443/service/a
### 8) HTTP -> HTTPS Redirect
**Voraussetzung**
- Challenge 7 muss abgeschlossen sein.
- Nutze deine bestehende `nginx.conf` aus Challenge 7 als Basis.
**Ziel**
- Klarer Redirect-Flow.
- HTTP sauber auf HTTPS umlenken.
**Datei**
- `proxy/nginx.conf`
**Muss**
- HTTP Requests auf HTTPS umleiten.
- HTTP Requests auf HTTPS redirecten.
- `/healthz` darf optional auf HTTP bleiben.
**Done-Check**
@@ -167,20 +242,25 @@ curl https://localhost:8443/service/a
curl -I http://localhost:8080/service/a
```
### 9) TLS Haertung + Chain Check
### 9) TLS Haertung + Chain Check + HSTS
**Voraussetzung**
- Challenge 7 und 8 muessen abgeschlossen sein.
- Erweitere dieselbe `nginx.conf` weiter.
**Ziel**
- Bessere TLS-Defaults + saubere Validierung.
- TLS nicht nur aktivieren, sondern sauber haerten.
**Datei**
- `proxy/nginx.conf`
**Muss**
- TLS auf 1.2/1.3 beschraenken.
- HSTS aktivieren (`Strict-Transport-Security`).
- Zertifikatskette pruefen.
- HSTS setzen (`Strict-Transport-Security`).
- Zertifikatskette pruefen und kurz erklaeren.
Hinweis: Im HTTP-Basissetup ist HSTS absichtlich **noch nicht** aktiv. Das ist Teil der Aufgabe.
**Hinweis**
- Im HTTP-Basissetup ist HSTS absichtlich **noch nicht** aktiv. Das ist Teil der Aufgabe.
**Done-Check**
```bash
@@ -192,23 +272,22 @@ openssl s_client -connect localhost:8443 -servername localhost
## Bonus Expert
### 10) Wireshark: HTTP vs HTTPS
### 10) Wireshark: HTTP vs HTTPS sauber analysieren
**Ziel**
- Sichtbar machen, was verschluesselt ist und was nicht.
- Nachweisbar zeigen, was im Klartext sichtbar ist und was durch TLS geschuetzt wird.
**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.
- HTTP auf `8080` mitschneiden.
- HTTPS auf `8443` mitschneiden.
- `ClientHello`, `ServerHello`, `Certificate` markieren.
- Technisch erklaeren, warum HTTP lesbar ist und HTTPS ohne Keys 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.
1. Capture auf passendem Interface starten (lokal meist `lo`).
2. HTTP Request senden und lesbaren Stream zeigen.
3. HTTPS Request senden und TLS Handshake analysieren.
4. Ergebnisse in 3-5 Bulletpoints zusammenfassen.
**Optional**
- TLS Decrypt mit `SSLKEYLOGFILE`.
+53 -97
View File
@@ -150,7 +150,7 @@
<main>
<section class="panel">
<h1>Challenges - Reverse Proxy & TLS</h1>
<p>Fokus: manuelle Proxy-Konfiguration, saubere Security-Entscheidungen, TLS von Grund auf.</p>
<p>Manuelle Proxy-Konfiguration, Security-Entscheidungen und TLS von Grund auf.</p>
<div class="top-links">
<a class="pill" href="/">Startseite</a>
<a class="pill" href="/hints.html">Hints</a>
@@ -161,11 +161,11 @@
</section>
<section class="panel">
<h2>Abgabe-Format (fuer jede Challenge)</h2>
<h2>Abgabe-Format</h2>
<ul>
<li><span class="kw">1) Demo:</span> 1-3 Minuten, live zeigen.</li>
<li><span class="kw">2) Check:</span> Done-Check Command ausfuehren.</li>
<li><span class="kw">3) Erklaerung:</span> 2-3 Saetze: was, warum, Sicherheitswirkung.</li>
<li>1-3 Minuten Demo</li>
<li>Done-Check live ausfuehren</li>
<li>2-3 Saetze: was, warum, welche Wirkung</li>
</ul>
</section>
@@ -173,45 +173,28 @@
<h2>Easy</h2>
<details open>
<summary><span class="badge easy">Easy</span> 1) Routing verstehen</summary>
<p><span class="kw">Ziel:</span> Verstehen, wie der Reverse Proxy Requests anhand des Pfads verteilt.</p>
<p><span class="kw">Muss:</span></p>
<summary><span class="badge easy">Easy</span> 1) Routing verstehen (aktiv)</summary>
<p><span class="kw">Muss:</span> zuerst in <code>proxy/nginx.conf</code> nachsehen, dann testen.</p>
<ul>
<li><code>/service/a</code> und <code>/service/b</code> aufrufen.</li>
<li>Unterschied der Antworten erklaeren.</li>
<li>In 1 Satz erklaeren, welche <code>location</code> auf welchen <code>upstream</code> zeigt.</li>
<li>Welche <code>location</code> matched <code>/service/a</code>?</li>
<li>Welcher <code>upstream</code> wird verwendet?</li>
</ul>
<p><span class="kw">Done-Check:</span></p>
<pre><code>curl http://localhost:8080/service/a
curl http://localhost:8080/service/b</code></pre>
</details>
<details>
<summary><span class="badge easy">Easy</span> 2) backend-c manuell hinzufuegen</summary>
<p><span class="kw">Ziel:</span> Proxy-Setup sinnvoll erweitern, ohne bestehenden Traffic zu brechen.</p>
<p><span class="kw">Dateien:</span> <code>docker-compose.yml</code>, <code>proxy/nginx.conf</code></p>
<p><span class="kw">Muss:</span></p>
<ul>
<li>Service <code>backend-c</code> in Compose anlegen.</li>
<li>In Nginx <code>upstream backend_c</code> und <code>location /service/c</code> konfigurieren.</li>
<li>Routing fuer A/B darf danach nicht kaputt sein.</li>
</ul>
<p><span class="kw">Done-Check:</span></p>
<summary><span class="badge easy">Easy</span> 2) backend-c hinzufuegen</summary>
<p><span class="kw">Muss:</span> Compose-Service + Upstream + Route <code>/service/c</code>.</p>
<p><span class="kw">Zusatz:</span> <code>backends/c/index.html</code> ist vorhanden und darf angepasst werden.</p>
<pre><code>curl http://localhost:8080/service/c
curl http://localhost:8080/service/a
curl http://localhost:8080/service/b</code></pre>
</details>
<details>
<summary><span class="badge easy">Easy</span> 3) Eigene Route mit Rewrite</summary>
<p><span class="kw">Ziel:</span> URL-Design vom Backend entkoppeln.</p>
<p><span class="kw">Muss:</span></p>
<ul>
<li>Neue public Route (z. B. <code>/demo/a</code>) einbauen.</li>
<li>Intern auf bestehenden Backend-Pfad umbiegen (Rewrite oder eigene Route).</li>
<li>In der Demo erklaeren, warum solche Pfad-Abstraktion nuetzlich ist.</li>
</ul>
<p><span class="kw">Done-Check:</span></p>
<summary><span class="badge easy">Easy</span> 3) Eigene Route /demo/a</summary>
<p><span class="kw">Muss:</span> Alias-Route bauen, die auf Backend A fuehrt.</p>
<pre><code>curl http://localhost:8080/demo/a</code></pre>
</details>
</section>
@@ -220,43 +203,45 @@ curl http://localhost:8080/service/b</code></pre>
<h2>Medium</h2>
<details>
<summary><span class="badge medium">Medium</span> 4) Security Headers setzen</summary>
<p><span class="kw">Ziel:</span> Browser-Schutzmechanismen bewusst aktivieren.</p>
<p><span class="kw">Muss:</span></p>
<ul>
<li><code>X-Content-Type-Options: nosniff</code></li>
<li><code>X-Frame-Options: DENY</code></li>
<li><code>Referrer-Policy: no-referrer</code></li>
</ul>
<p><span class="kw">Done-Check:</span></p>
<summary><span class="badge medium">Medium</span> 4) Security Headers</summary>
<p>Setze mindestens <code>nosniff</code>, <code>DENY</code>, <code>no-referrer</code>.</p>
<pre><code>curl -I http://localhost:8080/</code></pre>
<p><span class="kw">Abgabe:</span> kurz erklaeren, welchen Angriff jeder Header erschwert.</p>
</details>
<details>
<summary><span class="badge medium">Medium</span> 5) Interne Route absichern</summary>
<p><span class="kw">Ziel:</span> Zugangskontrolle direkt im Proxy umsetzen.</p>
<p><span class="kw">Muss:</span></p>
<ul>
<li>Route <code>/internal/status</code> einbauen.</li>
<li>Nur <code>127.0.0.1</code> erlauben, alle anderen verbieten.</li>
<li>Sinn der Route erklaeren (z. B. intern fuer Ops/Monitoring).</li>
</ul>
<p><span class="kw">Done-Check:</span></p>
<pre><code>curl -i http://localhost:8080/internal/status</code></pre>
<p><span class="kw">Muss:</span> <code>/internal/status</code> nur fuer <code>127.0.0.1</code>.</p>
<p><span class="kw">Wichtig:</span> Host-Request zeigt typischerweise 403 (Docker-Netzwerk).</p>
<pre><code>curl -i http://localhost:8080/internal/status
./scripts/compose.sh exec -T reverse-proxy sh -lc "wget -qO- http://127.0.0.1/internal/status"</code></pre>
</details>
<details>
<summary><span class="badge medium">Medium</span> 6) Logging verbessern</summary>
<p><span class="kw">Ziel:</span> Fehler schneller eingrenzen koennen.</p>
<p><span class="kw">Muss:</span></p>
<ul>
<li>Eigenes <code>log_format</code> mit Upstream-Daten erstellen.</li>
<li>Mindestens enthalten: <code>status</code>, <code>upstream_addr</code>, Timing.</li>
<li>Access Log auf das neue Format stellen.</li>
</ul>
<p><span class="kw">Done-Check:</span></p>
<p>Eigenes <code>log_format</code> mit Upstream-Infos einbauen.</p>
<pre><code>curl http://localhost:8080/service/a
./scripts/compose.sh logs reverse-proxy</code></pre>
</details>
<details>
<summary><span class="badge medium">Medium</span> 6a) Load Balancing</summary>
<p>Zweite Instanz von Backend A (<code>backend-a2</code>) einbauen und Round-Robin zeigen.</p>
<pre><code>for i in $(seq 1 8); do
curl -s http://localhost:8080/service/a | grep -o "Target A2\|Target A"
done</code></pre>
</details>
<details>
<summary><span class="badge medium">Medium</span> 6b) Header Stripping</summary>
<p>Mindestens einen Backend-Response-Header per <code>proxy_hide_header</code> ausblenden.</p>
<pre><code>curl -I http://localhost:8080/service/a</code></pre>
</details>
<details>
<summary><span class="badge medium">Medium</span> 6c) Debugging Challenge</summary>
<p>Mit <code>proxy/nginx.broken.conf</code> arbeiten, Fehler finden und reparieren.</p>
<pre><code>curl http://localhost:8080/service/a
curl http://localhost:8080/service/b
./scripts/compose.sh logs reverse-proxy</code></pre>
</details>
</section>
@@ -266,41 +251,19 @@ curl http://localhost:8080/service/b</code></pre>
<details>
<summary><span class="badge hard">Hard</span> 7) HTTPS von 0 (Easy-RSA)</summary>
<p><span class="kw">Ziel:</span> Eigene PKI und TLS-Endpoint fuer den Proxy aufbauen.</p>
<p><span class="kw">Muss:</span></p>
<ul>
<li>Server-Zertifikat fuer <code>localhost</code> erstellen.</li>
<li>Proxy auf <code>443</code> erweitern (z. B. <code>8443:443</code>).</li>
<li>Root-CA importieren und ohne <code>-k</code> testen.</li>
</ul>
<p><span class="kw">Done-Check:</span></p>
<p>Zertifikat fuer <code>localhost</code>, Port <code>8443:443</code>, Root-CA importiert.</p>
<pre><code>curl https://localhost:8443/service/a</code></pre>
</details>
<details>
<summary><span class="badge hard">Hard</span> 8) HTTP -&gt; HTTPS Redirect</summary>
<p><span class="kw">Ziel:</span> Client sauber auf TLS umleiten.</p>
<p><span class="kw">Muss:</span></p>
<ul>
<li>Alle HTTP Requests nach HTTPS redirecten.</li>
<li><code>/healthz</code> darf optional auf HTTP bleiben.</li>
<li>Redirect-Statuscode + Location Header erklaeren.</li>
</ul>
<p><span class="kw">Done-Check:</span></p>
<p><span class="kw">Voraussetzung:</span> Challenge 7 abgeschlossen. Bestehende Config weiterverwenden.</p>
<pre><code>curl -I http://localhost:8080/service/a</code></pre>
</details>
<details>
<summary><span class="badge hard">Hard</span> 9) TLS Haertung + Chain Check + HSTS</summary>
<p><span class="kw">Ziel:</span> TLS nicht nur aktivieren, sondern sinnvoll haerten.</p>
<p><span class="kw">Muss:</span></p>
<ul>
<li>TLS auf 1.2/1.3 beschraenken.</li>
<li>HSTS Header setzen: <code>Strict-Transport-Security</code>.</li>
<li>Zertifikatskette pruefen und in der Demo erklaeren.</li>
</ul>
<p><span class="kw">Hinweis:</span> Im HTTP-Basissetup ist HSTS absichtlich noch nicht aktiv.</p>
<p><span class="kw">Done-Check:</span></p>
<summary><span class="badge hard">Hard</span> 9) TLS Haertung + Chain + HSTS</summary>
<p><span class="kw">Voraussetzung:</span> Challenge 7 und 8 abgeschlossen. Gleiche Config weiter erweitern.</p>
<pre><code>curl -I https://localhost:8443/service/a
openssl s_client -connect localhost:8443 -servername localhost</code></pre>
</details>
@@ -311,21 +274,14 @@ openssl s_client -connect localhost:8443 -servername localhost</code></pre>
<details open>
<summary><span class="badge expert">Expert</span> 10) Wireshark: HTTP vs HTTPS sauber ausarbeiten</summary>
<p><span class="kw">Ziel:</span> Nachweisbar zeigen, was bei HTTP lesbar und bei HTTPS geschuetzt ist.</p>
<p><span class="kw">Muss:</span></p>
<ol>
<li>HTTP Capture auf Port <code>8080</code>, Request erzeugen, Klartext markieren.</li>
<li>HTTPS Capture auf Port <code>8443</code>, TLS Handshake markieren.</li>
<li>Pakete mit <code>ClientHello</code>, <code>ServerHello</code>, <code>Certificate</code> zeigen.</li>
<li>Kurze Analyse: Was sieht ein Angreifer im HTTP-Fall vs im HTTPS-Fall?</li>
<li>HTTP auf <code>8080</code> mitschneiden und Klartext zeigen.</li>
<li>HTTPS auf <code>8443</code> mitschneiden.</li>
<li><code>ClientHello</code>, <code>ServerHello</code>, <code>Certificate</code> markieren.</li>
<li>3-5 Bulletpoints: was ist sichtbar, was ist geschuetzt?</li>
</ol>
<p><span class="kw">Optional:</span> TLS Decrypt via <code>SSLKEYLOGFILE</code> und Unterschied vorher/nachher erklaeren.</p>
<p><span class="kw">Done-Check / Abgabe:</span></p>
<ul>
<li>Mindestens 3 Screenshots mit Markierungen.</li>
<li>3-5 Bulletpoints als technische Schlussfolgerung.</li>
<li>Ein Satz zu Grenzen der Methode (z. B. nur mit Keylog decryption).</li>
</ul>
<p><span class="kw">Optional:</span> TLS Decrypt mit <code>SSLKEYLOGFILE</code>.</p>
<p><span class="kw">Abgabe:</span> mind. 3 Screenshots + technische Interpretation.</p>
</details>
</section>
</main>
+44 -2
View File
@@ -190,12 +190,12 @@ location /service/c {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}</code></pre>
<p><span class="kw">Check:</span> <code>curl http://localhost:8080/service/c</code></p>
<p><span class="kw">Hinweis:</span> Stelle sicher, dass <code>backends/c/index.html</code> existiert (Starterdatei liegt bereits im Repo).</p>
</details>
<details>
<summary><span class="badge easy">Easy</span> 3) Rewrite Route</summary>
<pre><code>location = /demo/a {
rewrite ^ /service/a break;
proxy_pass http://backend_a/;
}</code></pre>
<p><span class="kw">Check:</span> <code>curl http://localhost:8080/demo/a</code></p>
@@ -221,7 +221,9 @@ add_header Referrer-Policy "no-referrer" always;</code></pre>
default_type text/plain;
return 200 "internal ok\n";
}</code></pre>
<p><span class="kw">Check:</span> <code>curl -i http://localhost:8080/internal/status</code></p>
<p><span class="kw">Check (Host):</span> <code>curl -i http://localhost:8080/internal/status</code> (typisch 403)</p>
<p><span class="kw">Check (Container-intern):</span></p>
<pre><code>./scripts/compose.sh exec -T reverse-proxy sh -lc "wget -qO- http://127.0.0.1/internal/status"</code></pre>
</details>
<details>
@@ -235,6 +237,44 @@ access_log /var/log/nginx/access.log workshop;</code></pre>
<pre><code>curl http://localhost:8080/service/a
./scripts/compose.sh logs reverse-proxy</code></pre>
</details>
<details>
<summary><span class="badge medium">Medium</span> 6a) Load Balancing</summary>
<p><span class="kw">Compose (backend-a2):</span></p>
<pre><code>backend-a2:
image: nginx:1.27-alpine
container_name: workshop-backend-a2
volumes:
- ./backends/a2:/usr/share/nginx/html:ro,z</code></pre>
<p><span class="kw">Nginx (upstream erweitern):</span></p>
<pre><code>upstream backend_a {
server backend-a:80;
server backend-a2:80;
}</code></pre>
<p><span class="kw">Check:</span></p>
<pre><code>for i in $(seq 1 8); do
curl -s http://localhost:8080/service/a | grep -o "Target A2\|Target A"
done</code></pre>
</details>
<details>
<summary><span class="badge medium">Medium</span> 6b) Header Stripping</summary>
<pre><code>location /service/a {
proxy_pass http://backend_a/;
proxy_hide_header ETag;
proxy_hide_header Last-Modified;
}</code></pre>
<p><span class="kw">Check:</span> <code>curl -I http://localhost:8080/service/a</code></p>
</details>
<details>
<summary><span class="badge medium">Medium</span> 6c) Debugging Challenge</summary>
<p>Kopiere testweise <code>proxy/nginx.broken.conf</code> auf <code>proxy/nginx.conf</code>, behebe die Fehler und stelle danach die funktionierende Konfiguration wieder her.</p>
<pre><code>cp proxy/nginx.broken.conf proxy/nginx.conf
make proxy-reload
./scripts/compose.sh logs reverse-proxy</code></pre>
<p><span class="kw">Check:</span> beide Routen funktionieren wieder.</p>
</details>
</section>
<section class="panel">
@@ -261,6 +301,7 @@ cd certs/easyrsa
<details>
<summary><span class="badge hard">Hard</span> 8) HTTP -&gt; HTTPS Redirect</summary>
<p><span class="kw">Voraussetzung:</span> Challenge 7 abgeschlossen (gleiches Config-File weiterverwenden).</p>
<pre><code>server {
listen 80;
server_name _;
@@ -279,6 +320,7 @@ cd certs/easyrsa
<details>
<summary><span class="badge hard">Hard</span> 9) TLS Haertung + HSTS</summary>
<p><span class="kw">Voraussetzung:</span> Challenge 7 und 8 abgeschlossen.</p>
<pre><code>ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;</code></pre>
+47
View File
@@ -0,0 +1,47 @@
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
server_tokens off;
upstream backend_a_typo {
server backend-a:8080;
}
upstream backend_b {
server backend-b:80;
}
server {
listen 80;
server_name _;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
location /service/a {
proxy_pass http://backend_a/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto http;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /service/b {
proxy_pass http://backend_b;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto http;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location = /healthz {
default_type text/plain;
return 200 "ok\n";
}
}
}
+1 -1
View File
@@ -39,7 +39,7 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /healthz {
location = /healthz {
default_type text/plain;
return 200 "ok\n";
}
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
if ! command -v docker >/dev/null 2>&1; then
echo "[error] docker nicht gefunden. Bitte Docker installieren (Linux/macOS) oder Docker Desktop + WSL Integration aktivieren."
exit 1
fi
if ! docker info >/dev/null 2>&1; then
echo "[error] Docker Daemon nicht erreichbar. Bitte Docker starten."
exit 1
fi
if ! "$SCRIPT_DIR/compose.sh" version >/dev/null 2>&1; then
echo "[error] Weder docker compose noch docker-compose verfuegbar."
exit 1
fi
if [[ ! -f .env ]]; then
cp .env.example .env
echo "[ok] .env aus .env.example erstellt"
else
echo "[skip] .env existiert bereits"
fi
"$SCRIPT_DIR/compose.sh" up -d --build
echo
echo "[ok] Workshop-Stack laeuft"
echo " Landing Page: http://localhost:8080"
echo " Test (backend-a): curl http://localhost:8080/service/a"
+2 -32
View File
@@ -2,35 +2,5 @@
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
if ! command -v docker >/dev/null 2>&1; then
echo "[error] docker nicht gefunden. Bitte Docker installieren (Linux) oder Docker Desktop + WSL Integration aktivieren."
exit 1
fi
if ! docker info >/dev/null 2>&1; then
echo "[error] Docker Daemon nicht erreichbar. Bitte Docker starten."
exit 1
fi
if ! "$SCRIPT_DIR/compose.sh" version >/dev/null 2>&1; then
echo "[error] Weder docker compose noch docker-compose verfuegbar."
exit 1
fi
if [[ ! -f .env ]]; then
cp .env.example .env
echo "[ok] .env aus .env.example erstellt"
else
echo "[skip] .env existiert bereits"
fi
"$SCRIPT_DIR/compose.sh" up -d --build
echo
echo "[ok] Workshop-Stack laeuft"
echo " Landing Page: http://localhost:8080"
echo " Test (backend-a): curl http://localhost:8080/service/a"
echo "[warn] scripts/bootstrap-wsl.sh ist deprecated. Nutze bitte scripts/bootstrap.sh"
"$SCRIPT_DIR/bootstrap-unix.sh"
+1 -1
View File
@@ -2,4 +2,4 @@
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
"$SCRIPT_DIR/bootstrap-wsl.sh"
"$SCRIPT_DIR/bootstrap-unix.sh"
+2 -1
View File
@@ -1,5 +1,5 @@
param(
[ValidateSet("bootstrap", "up", "redeploy", "proxy-reload", "down", "logs", "reset")]
[ValidateSet("bootstrap", "up", "redeploy", "proxy-reload", "down", "logs", "reset", "reset-hard")]
[string]$Action = "bootstrap",
[string]$Distro = ""
)
@@ -25,6 +25,7 @@ switch ($Action) {
"down" { $linuxCommand = "./scripts/compose.sh down" }
"logs" { $linuxCommand = "./scripts/compose.sh logs -f" }
"reset" { $linuxCommand = "./scripts/reset-lab.sh" }
"reset-hard" { $linuxCommand = "./scripts/reset-lab.sh --hard" }
}
$wslArgs = @()