Address workshop issues and expand challenge guidance
This commit is contained in:
@@ -28,23 +28,29 @@ Basisrouten nach dem Start:
|
|||||||
- `http://localhost:8080/hints.html` -> Hint Cheatsheet
|
- `http://localhost:8080/hints.html` -> Hint Cheatsheet
|
||||||
- `http://localhost:8080/solutions.html` -> Musterloesungen
|
- `http://localhost:8080/solutions.html` -> Musterloesungen
|
||||||
|
|
||||||
## Voraussetzungen (WSL oder Linux)
|
## Voraussetzungen (Linux / macOS / Windows WSL)
|
||||||
|
|
||||||
1. Docker + Compose (`docker compose` oder `docker-compose`)
|
1. Docker + Compose (`docker compose` oder `docker-compose`)
|
||||||
2. Bei Windows: Docker Desktop + WSL Integration aktiv
|
2. Optional fuer TLS-Challenges: `easy-rsa`, `openssl`, `wireshark`
|
||||||
3. 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
|
## Schnellstart
|
||||||
|
|
||||||
|
### Linux / macOS
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/bootstrap.sh
|
./scripts/bootstrap.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### Start auf Windows
|
### Windows (WSL)
|
||||||
|
|
||||||
Empfohlen: ueber WSL starten (nicht nativ in PowerShell ohne WSL).
|
Option A (im WSL-Terminal):
|
||||||
|
|
||||||
Option A (WSL Terminal):
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/bootstrap.sh
|
./scripts/bootstrap.sh
|
||||||
@@ -56,7 +62,7 @@ Option B (PowerShell Wrapper):
|
|||||||
./scripts/workshop.ps1 -Action bootstrap
|
./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:
|
Falls PowerShell das Script blockiert:
|
||||||
|
|
||||||
@@ -64,12 +70,13 @@ Falls PowerShell das Script blockiert:
|
|||||||
Set-ExecutionPolicy -Scope Process Bypass
|
Set-ExecutionPolicy -Scope Process Bypass
|
||||||
```
|
```
|
||||||
|
|
||||||
Weitere Aktionen aus PowerShell:
|
Weitere Aktionen in PowerShell:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
./scripts/workshop.ps1 -Action redeploy
|
./scripts/workshop.ps1 -Action redeploy
|
||||||
./scripts/workshop.ps1 -Action proxy-reload
|
./scripts/workshop.ps1 -Action proxy-reload
|
||||||
./scripts/workshop.ps1 -Action reset
|
./scripts/workshop.ps1 -Action reset
|
||||||
|
./scripts/workshop.ps1 -Action reset-hard
|
||||||
```
|
```
|
||||||
|
|
||||||
Wenn mehrere Distros installiert sind:
|
Wenn mehrere Distros installiert sind:
|
||||||
@@ -78,23 +85,31 @@ Wenn mehrere Distros installiert sind:
|
|||||||
./scripts/workshop.ps1 -Action bootstrap -Distro Ubuntu-24.04
|
./scripts/workshop.ps1 -Action bootstrap -Distro Ubuntu-24.04
|
||||||
```
|
```
|
||||||
|
|
||||||
Der Script:
|
Das Skript:
|
||||||
|
|
||||||
- prueft Docker + Compose
|
- prueft Docker + Compose
|
||||||
- erstellt `.env` aus `.env.example` (falls nicht vorhanden)
|
- erstellt `.env` aus `.env.example` (falls nicht vorhanden)
|
||||||
- startet den Stack
|
- 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
|
## Neu deployen / resetten
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make redeploy
|
make redeploy
|
||||||
make proxy-reload
|
make proxy-reload
|
||||||
make reset
|
make reset
|
||||||
|
make reset-hard
|
||||||
```
|
```
|
||||||
|
|
||||||
- `redeploy`: build + restart aller Services
|
- `redeploy`: build + restart aller Services
|
||||||
- `proxy-reload`: nur Reverse Proxy restart
|
- `proxy-reload`: nur Reverse Proxy restart
|
||||||
- `reset`: Container/Netzwerk/Volumes aufraeumen
|
- `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.
|
Hinweis: `make redeploy` startet zusaetzlich den Reverse Proxy neu, damit Nginx-Config-Aenderungen sicher aktiv sind.
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -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
@@ -1,32 +1,33 @@
|
|||||||
# Workshop Challenges (Reverse Proxy + TLS Focus)
|
# 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)
|
- 1-3 Minuten Demo
|
||||||
- Done-Check Command
|
- Done-Check Command live ausfuehren
|
||||||
- 2-3 Saetze: Was wurde geaendert und warum?
|
- 2-3 Saetze erklaeren: was geaendert, warum, welche Wirkung
|
||||||
|
|
||||||
## Arbeitsmodus
|
## 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`.
|
2. Deployen mit `make redeploy` oder `make proxy-reload`.
|
||||||
3. Testen mit `curl`/`openssl`.
|
3. Testen mit `curl` / `openssl` / Wireshark.
|
||||||
4. Wenn etwas kaputt ist: `./scripts/compose.sh logs reverse-proxy`.
|
4. Bei Problemen: `./scripts/compose.sh logs reverse-proxy`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Easy
|
## Easy
|
||||||
|
|
||||||
### 1) Routing verstehen
|
### 1) Routing verstehen (aktiv)
|
||||||
|
|
||||||
**Ziel**
|
**Ziel**
|
||||||
- Reverse Proxy leitet Requests auf unterschiedliche Backends.
|
- Verstehen, wie Nginx Requests per Pfad an unterschiedliche Upstreams schickt.
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- `service/a` und `service/b` aufrufen.
|
- Vor dem Test in `proxy/nginx.conf` nachsehen, welche `location` auf welchen `upstream` zeigt.
|
||||||
- Unterschiede in den Antworten erklaeren.
|
- Dann erst Requests ausfuehren.
|
||||||
|
- In eigenen Worten erklaeren, warum die Antworten unterschiedlich sind.
|
||||||
|
|
||||||
**Done-Check**
|
**Done-Check**
|
||||||
```bash
|
```bash
|
||||||
@@ -37,32 +38,36 @@ curl http://localhost:8080/service/b
|
|||||||
### 2) Drittes Backend manuell hinzufuegen
|
### 2) Drittes Backend manuell hinzufuegen
|
||||||
|
|
||||||
**Ziel**
|
**Ziel**
|
||||||
- Proxy auf ein neues Backend erweitern.
|
- Setup sicher erweitern, ohne bestehende Routen kaputt zu machen.
|
||||||
|
|
||||||
**Dateien**
|
**Dateien**
|
||||||
- `docker-compose.yml`
|
- `docker-compose.yml`
|
||||||
- `proxy/nginx.conf`
|
- `proxy/nginx.conf`
|
||||||
|
- `backends/c/index.html` (vorhanden, darf angepasst werden)
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- Service `backend-c` anlegen.
|
- Service `backend-c` in Compose einbauen.
|
||||||
- Upstream + Route `/service/c` konfigurieren.
|
- Upstream + Route `/service/c` in Nginx anlegen.
|
||||||
|
- A/B muessen weiterhin funktionieren.
|
||||||
|
|
||||||
**Done-Check**
|
**Done-Check**
|
||||||
```bash
|
```bash
|
||||||
curl http://localhost:8080/service/c
|
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**
|
**Ziel**
|
||||||
- URL-Struktur im Proxy gestalten.
|
- URL-Design vom Backend-Pfad entkoppeln.
|
||||||
|
|
||||||
**Datei**
|
**Datei**
|
||||||
- `proxy/nginx.conf`
|
- `proxy/nginx.conf`
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- Route `/demo/a` soll intern auf Backend A zeigen.
|
- Route `/demo/a` anbieten, die auf Backend A fuehrt.
|
||||||
- Implementierung ueber `rewrite` oder eigene `location`.
|
- Entweder per rewrite oder per eigener proxy-Route loesen.
|
||||||
|
|
||||||
**Done-Check**
|
**Done-Check**
|
||||||
```bash
|
```bash
|
||||||
@@ -76,13 +81,13 @@ curl http://localhost:8080/demo/a
|
|||||||
### 4) Security Headers setzen
|
### 4) Security Headers setzen
|
||||||
|
|
||||||
**Ziel**
|
**Ziel**
|
||||||
- Grundlegende Header-Haertung im Proxy.
|
- Browserseitige Basishaertung aktivieren.
|
||||||
|
|
||||||
**Datei**
|
**Datei**
|
||||||
- `proxy/nginx.conf`
|
- `proxy/nginx.conf`
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- Setze mindestens:
|
- Mindestens setzen:
|
||||||
- `X-Content-Type-Options: nosniff`
|
- `X-Content-Type-Options: nosniff`
|
||||||
- `X-Frame-Options: DENY`
|
- `X-Frame-Options: DENY`
|
||||||
- `Referrer-Policy: no-referrer`
|
- `Referrer-Policy: no-referrer`
|
||||||
@@ -95,31 +100,38 @@ curl -I http://localhost:8080/
|
|||||||
### 5) Interne Route absichern
|
### 5) Interne Route absichern
|
||||||
|
|
||||||
**Ziel**
|
**Ziel**
|
||||||
- Route nur lokal erreichbar machen.
|
- Zugriff auf eine interne Route gezielt begrenzen.
|
||||||
|
|
||||||
**Datei**
|
**Datei**
|
||||||
- `proxy/nginx.conf`
|
- `proxy/nginx.conf`
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- Neue Route `/internal/status` bauen.
|
- Route `/internal/status` bauen.
|
||||||
- Nur `127.0.0.1` erlauben, alle anderen verbieten.
|
- 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**
|
**Done-Check**
|
||||||
```bash
|
```bash
|
||||||
|
# Erwartet typischerweise 403 vom Host (by design)
|
||||||
curl -i http://localhost:8080/internal/status
|
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
|
### 6) Logging verbessern
|
||||||
|
|
||||||
**Ziel**
|
**Ziel**
|
||||||
- Proxy-Debugging ueber bessere Logs.
|
- Besser debuggen koennen.
|
||||||
|
|
||||||
**Datei**
|
**Datei**
|
||||||
- `proxy/nginx.conf`
|
- `proxy/nginx.conf`
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- Eigenes `log_format` mit Upstream-Infos erstellen.
|
- Eigenes `log_format` mit Upstream-Infos anlegen.
|
||||||
- Access Log auf dieses Format umstellen.
|
- Access-Log auf das neue Format umstellen.
|
||||||
|
|
||||||
**Done-Check**
|
**Done-Check**
|
||||||
```bash
|
```bash
|
||||||
@@ -127,6 +139,65 @@ curl http://localhost:8080/service/a
|
|||||||
./scripts/compose.sh logs reverse-proxy
|
./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)
|
## Hard (TLS)
|
||||||
@@ -134,16 +205,16 @@ curl http://localhost:8080/service/a
|
|||||||
### 7) HTTPS von 0 mit Easy-RSA
|
### 7) HTTPS von 0 mit Easy-RSA
|
||||||
|
|
||||||
**Ziel**
|
**Ziel**
|
||||||
- Eigene CA + Server-Zertifikat fuer `localhost`.
|
- Eigene CA + Server-Zertifikat fuer `localhost` erstellen.
|
||||||
|
|
||||||
**Dateien**
|
**Dateien**
|
||||||
- `docker-compose.yml`
|
- `docker-compose.yml`
|
||||||
- `proxy/nginx.conf`
|
- `proxy/nginx.conf`
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- Cert fuer `localhost` erzeugen.
|
- Zertifikat fuer `localhost` erstellen.
|
||||||
- Proxy auf `443` aktivieren (z. B. `8443:443`).
|
- Proxy auf `443` erweitern (z. B. `8443:443`).
|
||||||
- Root-CA importieren.
|
- Root-CA importieren und ohne `-k` testen.
|
||||||
|
|
||||||
**Done-Check**
|
**Done-Check**
|
||||||
```bash
|
```bash
|
||||||
@@ -152,14 +223,18 @@ curl https://localhost:8443/service/a
|
|||||||
|
|
||||||
### 8) HTTP -> HTTPS Redirect
|
### 8) HTTP -> HTTPS Redirect
|
||||||
|
|
||||||
|
**Voraussetzung**
|
||||||
|
- Challenge 7 muss abgeschlossen sein.
|
||||||
|
- Nutze deine bestehende `nginx.conf` aus Challenge 7 als Basis.
|
||||||
|
|
||||||
**Ziel**
|
**Ziel**
|
||||||
- Klarer Redirect-Flow.
|
- HTTP sauber auf HTTPS umlenken.
|
||||||
|
|
||||||
**Datei**
|
**Datei**
|
||||||
- `proxy/nginx.conf`
|
- `proxy/nginx.conf`
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- HTTP Requests auf HTTPS umleiten.
|
- HTTP Requests auf HTTPS redirecten.
|
||||||
- `/healthz` darf optional auf HTTP bleiben.
|
- `/healthz` darf optional auf HTTP bleiben.
|
||||||
|
|
||||||
**Done-Check**
|
**Done-Check**
|
||||||
@@ -167,20 +242,25 @@ curl https://localhost:8443/service/a
|
|||||||
curl -I http://localhost:8080/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**
|
**Ziel**
|
||||||
- Bessere TLS-Defaults + saubere Validierung.
|
- TLS nicht nur aktivieren, sondern sauber haerten.
|
||||||
|
|
||||||
**Datei**
|
**Datei**
|
||||||
- `proxy/nginx.conf`
|
- `proxy/nginx.conf`
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- TLS auf 1.2/1.3 beschraenken.
|
- TLS auf 1.2/1.3 beschraenken.
|
||||||
- HSTS aktivieren (`Strict-Transport-Security`).
|
- HSTS setzen (`Strict-Transport-Security`).
|
||||||
- Zertifikatskette pruefen.
|
- 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**
|
**Done-Check**
|
||||||
```bash
|
```bash
|
||||||
@@ -192,23 +272,22 @@ openssl s_client -connect localhost:8443 -servername localhost
|
|||||||
|
|
||||||
## Bonus Expert
|
## Bonus Expert
|
||||||
|
|
||||||
### 10) Wireshark: HTTP vs HTTPS
|
### 10) Wireshark: HTTP vs HTTPS sauber analysieren
|
||||||
|
|
||||||
**Ziel**
|
**Ziel**
|
||||||
- Sichtbar machen, was verschluesselt ist und was nicht.
|
- Nachweisbar zeigen, was im Klartext sichtbar ist und was durch TLS geschuetzt wird.
|
||||||
|
|
||||||
**Muss**
|
**Muss**
|
||||||
- HTTP Traffic auf `8080` mitschneiden.
|
- HTTP auf `8080` mitschneiden.
|
||||||
- HTTPS Traffic auf `8443` mitschneiden.
|
- HTTPS auf `8443` mitschneiden.
|
||||||
- TLS Handshake markieren (`ClientHello`, `ServerHello`, `Certificate`).
|
- `ClientHello`, `ServerHello`, `Certificate` markieren.
|
||||||
- Technisch erklaeren, warum HTTP lesbar ist und HTTPS nicht.
|
- Technisch erklaeren, warum HTTP lesbar ist und HTTPS ohne Keys nicht.
|
||||||
|
|
||||||
**Vorgehen (empfohlen)**
|
**Vorgehen (empfohlen)**
|
||||||
1. Capture auf `lo` (oder passendes Interface) starten, Filter `tcp.port == 8080`.
|
1. Capture auf passendem Interface starten (lokal meist `lo`).
|
||||||
2. `curl http://localhost:8080/service/a` senden und HTTP-Stream zeigen.
|
2. HTTP Request senden und lesbaren Stream zeigen.
|
||||||
3. Capture auf `tcp.port == 8443` oder `tls` umstellen.
|
3. HTTPS Request senden und TLS Handshake analysieren.
|
||||||
4. `curl https://localhost:8443/service/a` senden.
|
4. Ergebnisse in 3-5 Bulletpoints zusammenfassen.
|
||||||
5. Handshake-Pakete markieren und kurz erklaeren.
|
|
||||||
|
|
||||||
**Optional**
|
**Optional**
|
||||||
- TLS Decrypt mit `SSLKEYLOGFILE`.
|
- TLS Decrypt mit `SSLKEYLOGFILE`.
|
||||||
|
|||||||
+53
-97
@@ -150,7 +150,7 @@
|
|||||||
<main>
|
<main>
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
<h1>Challenges - Reverse Proxy & TLS</h1>
|
<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">
|
<div class="top-links">
|
||||||
<a class="pill" href="/">Startseite</a>
|
<a class="pill" href="/">Startseite</a>
|
||||||
<a class="pill" href="/hints.html">Hints</a>
|
<a class="pill" href="/hints.html">Hints</a>
|
||||||
@@ -161,11 +161,11 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
<h2>Abgabe-Format (fuer jede Challenge)</h2>
|
<h2>Abgabe-Format</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li><span class="kw">1) Demo:</span> 1-3 Minuten, live zeigen.</li>
|
<li>1-3 Minuten Demo</li>
|
||||||
<li><span class="kw">2) Check:</span> Done-Check Command ausfuehren.</li>
|
<li>Done-Check live ausfuehren</li>
|
||||||
<li><span class="kw">3) Erklaerung:</span> 2-3 Saetze: was, warum, Sicherheitswirkung.</li>
|
<li>2-3 Saetze: was, warum, welche Wirkung</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -173,45 +173,28 @@
|
|||||||
<h2>Easy</h2>
|
<h2>Easy</h2>
|
||||||
|
|
||||||
<details open>
|
<details open>
|
||||||
<summary><span class="badge easy">Easy</span> 1) Routing verstehen</summary>
|
<summary><span class="badge easy">Easy</span> 1) Routing verstehen (aktiv)</summary>
|
||||||
<p><span class="kw">Ziel:</span> Verstehen, wie der Reverse Proxy Requests anhand des Pfads verteilt.</p>
|
<p><span class="kw">Muss:</span> zuerst in <code>proxy/nginx.conf</code> nachsehen, dann testen.</p>
|
||||||
<p><span class="kw">Muss:</span></p>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>/service/a</code> und <code>/service/b</code> aufrufen.</li>
|
<li>Welche <code>location</code> matched <code>/service/a</code>?</li>
|
||||||
<li>Unterschied der Antworten erklaeren.</li>
|
<li>Welcher <code>upstream</code> wird verwendet?</li>
|
||||||
<li>In 1 Satz erklaeren, welche <code>location</code> auf welchen <code>upstream</code> zeigt.</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<p><span class="kw">Done-Check:</span></p>
|
|
||||||
<pre><code>curl http://localhost:8080/service/a
|
<pre><code>curl http://localhost:8080/service/a
|
||||||
curl http://localhost:8080/service/b</code></pre>
|
curl http://localhost:8080/service/b</code></pre>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge easy">Easy</span> 2) backend-c manuell hinzufuegen</summary>
|
<summary><span class="badge easy">Easy</span> 2) backend-c hinzufuegen</summary>
|
||||||
<p><span class="kw">Ziel:</span> Proxy-Setup sinnvoll erweitern, ohne bestehenden Traffic zu brechen.</p>
|
<p><span class="kw">Muss:</span> Compose-Service + Upstream + Route <code>/service/c</code>.</p>
|
||||||
<p><span class="kw">Dateien:</span> <code>docker-compose.yml</code>, <code>proxy/nginx.conf</code></p>
|
<p><span class="kw">Zusatz:</span> <code>backends/c/index.html</code> ist vorhanden und darf angepasst werden.</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>
|
|
||||||
<pre><code>curl http://localhost:8080/service/c
|
<pre><code>curl http://localhost:8080/service/c
|
||||||
curl http://localhost:8080/service/a
|
curl http://localhost:8080/service/a
|
||||||
curl http://localhost:8080/service/b</code></pre>
|
curl http://localhost:8080/service/b</code></pre>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge easy">Easy</span> 3) Eigene Route mit Rewrite</summary>
|
<summary><span class="badge easy">Easy</span> 3) Eigene Route /demo/a</summary>
|
||||||
<p><span class="kw">Ziel:</span> URL-Design vom Backend entkoppeln.</p>
|
<p><span class="kw">Muss:</span> Alias-Route bauen, die auf Backend A fuehrt.</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>
|
|
||||||
<pre><code>curl http://localhost:8080/demo/a</code></pre>
|
<pre><code>curl http://localhost:8080/demo/a</code></pre>
|
||||||
</details>
|
</details>
|
||||||
</section>
|
</section>
|
||||||
@@ -220,43 +203,45 @@ curl http://localhost:8080/service/b</code></pre>
|
|||||||
<h2>Medium</h2>
|
<h2>Medium</h2>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge medium">Medium</span> 4) Security Headers setzen</summary>
|
<summary><span class="badge medium">Medium</span> 4) Security Headers</summary>
|
||||||
<p><span class="kw">Ziel:</span> Browser-Schutzmechanismen bewusst aktivieren.</p>
|
<p>Setze mindestens <code>nosniff</code>, <code>DENY</code>, <code>no-referrer</code>.</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>
|
|
||||||
<pre><code>curl -I http://localhost:8080/</code></pre>
|
<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>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge medium">Medium</span> 5) Interne Route absichern</summary>
|
<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> <code>/internal/status</code> nur fuer <code>127.0.0.1</code>.</p>
|
||||||
<p><span class="kw">Muss:</span></p>
|
<p><span class="kw">Wichtig:</span> Host-Request zeigt typischerweise 403 (Docker-Netzwerk).</p>
|
||||||
<ul>
|
<pre><code>curl -i http://localhost:8080/internal/status
|
||||||
<li>Route <code>/internal/status</code> einbauen.</li>
|
./scripts/compose.sh exec -T reverse-proxy sh -lc "wget -qO- http://127.0.0.1/internal/status"</code></pre>
|
||||||
<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>
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge medium">Medium</span> 6) Logging verbessern</summary>
|
<summary><span class="badge medium">Medium</span> 6) Logging verbessern</summary>
|
||||||
<p><span class="kw">Ziel:</span> Fehler schneller eingrenzen koennen.</p>
|
<p>Eigenes <code>log_format</code> mit Upstream-Infos einbauen.</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>
|
|
||||||
<pre><code>curl http://localhost:8080/service/a
|
<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>
|
./scripts/compose.sh logs reverse-proxy</code></pre>
|
||||||
</details>
|
</details>
|
||||||
</section>
|
</section>
|
||||||
@@ -266,41 +251,19 @@ curl http://localhost:8080/service/b</code></pre>
|
|||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge hard">Hard</span> 7) HTTPS von 0 (Easy-RSA)</summary>
|
<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>Zertifikat fuer <code>localhost</code>, Port <code>8443:443</code>, Root-CA importiert.</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>
|
|
||||||
<pre><code>curl https://localhost:8443/service/a</code></pre>
|
<pre><code>curl https://localhost:8443/service/a</code></pre>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge hard">Hard</span> 8) HTTP -> HTTPS Redirect</summary>
|
<summary><span class="badge hard">Hard</span> 8) HTTP -> HTTPS Redirect</summary>
|
||||||
<p><span class="kw">Ziel:</span> Client sauber auf TLS umleiten.</p>
|
<p><span class="kw">Voraussetzung:</span> Challenge 7 abgeschlossen. Bestehende Config weiterverwenden.</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>
|
|
||||||
<pre><code>curl -I http://localhost:8080/service/a</code></pre>
|
<pre><code>curl -I http://localhost:8080/service/a</code></pre>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge hard">Hard</span> 9) TLS Haertung + Chain Check + HSTS</summary>
|
<summary><span class="badge hard">Hard</span> 9) TLS Haertung + Chain + HSTS</summary>
|
||||||
<p><span class="kw">Ziel:</span> TLS nicht nur aktivieren, sondern sinnvoll haerten.</p>
|
<p><span class="kw">Voraussetzung:</span> Challenge 7 und 8 abgeschlossen. Gleiche Config weiter erweitern.</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>
|
|
||||||
<pre><code>curl -I https://localhost:8443/service/a
|
<pre><code>curl -I https://localhost:8443/service/a
|
||||||
openssl s_client -connect localhost:8443 -servername localhost</code></pre>
|
openssl s_client -connect localhost:8443 -servername localhost</code></pre>
|
||||||
</details>
|
</details>
|
||||||
@@ -311,21 +274,14 @@ openssl s_client -connect localhost:8443 -servername localhost</code></pre>
|
|||||||
|
|
||||||
<details open>
|
<details open>
|
||||||
<summary><span class="badge expert">Expert</span> 10) Wireshark: HTTP vs HTTPS sauber ausarbeiten</summary>
|
<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>
|
<ol>
|
||||||
<li>HTTP Capture auf Port <code>8080</code>, Request erzeugen, Klartext markieren.</li>
|
<li>HTTP auf <code>8080</code> mitschneiden und Klartext zeigen.</li>
|
||||||
<li>HTTPS Capture auf Port <code>8443</code>, TLS Handshake markieren.</li>
|
<li>HTTPS auf <code>8443</code> mitschneiden.</li>
|
||||||
<li>Pakete mit <code>ClientHello</code>, <code>ServerHello</code>, <code>Certificate</code> zeigen.</li>
|
<li><code>ClientHello</code>, <code>ServerHello</code>, <code>Certificate</code> markieren.</li>
|
||||||
<li>Kurze Analyse: Was sieht ein Angreifer im HTTP-Fall vs im HTTPS-Fall?</li>
|
<li>3-5 Bulletpoints: was ist sichtbar, was ist geschuetzt?</li>
|
||||||
</ol>
|
</ol>
|
||||||
<p><span class="kw">Optional:</span> TLS Decrypt via <code>SSLKEYLOGFILE</code> und Unterschied vorher/nachher erklaeren.</p>
|
<p><span class="kw">Optional:</span> TLS Decrypt mit <code>SSLKEYLOGFILE</code>.</p>
|
||||||
<p><span class="kw">Done-Check / Abgabe:</span></p>
|
<p><span class="kw">Abgabe:</span> mind. 3 Screenshots + technische Interpretation.</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>
|
|
||||||
</details>
|
</details>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -190,12 +190,12 @@ location /service/c {
|
|||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p><span class="kw">Check:</span> <code>curl http://localhost:8080/service/c</code></p>
|
<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>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge easy">Easy</span> 3) Rewrite Route</summary>
|
<summary><span class="badge easy">Easy</span> 3) Rewrite Route</summary>
|
||||||
<pre><code>location = /demo/a {
|
<pre><code>location = /demo/a {
|
||||||
rewrite ^ /service/a break;
|
|
||||||
proxy_pass http://backend_a/;
|
proxy_pass http://backend_a/;
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p><span class="kw">Check:</span> <code>curl http://localhost:8080/demo/a</code></p>
|
<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;
|
default_type text/plain;
|
||||||
return 200 "internal ok\n";
|
return 200 "internal ok\n";
|
||||||
}</code></pre>
|
}</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>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@@ -235,6 +237,44 @@ access_log /var/log/nginx/access.log workshop;</code></pre>
|
|||||||
<pre><code>curl http://localhost:8080/service/a
|
<pre><code>curl http://localhost:8080/service/a
|
||||||
./scripts/compose.sh logs reverse-proxy</code></pre>
|
./scripts/compose.sh logs reverse-proxy</code></pre>
|
||||||
</details>
|
</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>
|
||||||
|
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
@@ -261,6 +301,7 @@ cd certs/easyrsa
|
|||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge hard">Hard</span> 8) HTTP -> HTTPS Redirect</summary>
|
<summary><span class="badge hard">Hard</span> 8) HTTP -> HTTPS Redirect</summary>
|
||||||
|
<p><span class="kw">Voraussetzung:</span> Challenge 7 abgeschlossen (gleiches Config-File weiterverwenden).</p>
|
||||||
<pre><code>server {
|
<pre><code>server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name _;
|
server_name _;
|
||||||
@@ -279,6 +320,7 @@ cd certs/easyrsa
|
|||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><span class="badge hard">Hard</span> 9) TLS Haertung + HSTS</summary>
|
<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;
|
<pre><code>ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
ssl_prefer_server_ciphers on;
|
ssl_prefer_server_ciphers on;
|
||||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;</code></pre>
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;</code></pre>
|
||||||
|
|||||||
@@ -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
@@ -39,7 +39,7 @@ http {
|
|||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /healthz {
|
location = /healthz {
|
||||||
default_type text/plain;
|
default_type text/plain;
|
||||||
return 200 "ok\n";
|
return 200 "ok\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+36
@@ -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,35 +2,5 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
PROJECT_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
|
echo "[warn] scripts/bootstrap-wsl.sh ist deprecated. Nutze bitte scripts/bootstrap.sh"
|
||||||
|
"$SCRIPT_DIR/bootstrap-unix.sh"
|
||||||
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"
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
"$SCRIPT_DIR/bootstrap-wsl.sh"
|
"$SCRIPT_DIR/bootstrap-unix.sh"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
param(
|
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]$Action = "bootstrap",
|
||||||
[string]$Distro = ""
|
[string]$Distro = ""
|
||||||
)
|
)
|
||||||
@@ -25,6 +25,7 @@ switch ($Action) {
|
|||||||
"down" { $linuxCommand = "./scripts/compose.sh down" }
|
"down" { $linuxCommand = "./scripts/compose.sh down" }
|
||||||
"logs" { $linuxCommand = "./scripts/compose.sh logs -f" }
|
"logs" { $linuxCommand = "./scripts/compose.sh logs -f" }
|
||||||
"reset" { $linuxCommand = "./scripts/reset-lab.sh" }
|
"reset" { $linuxCommand = "./scripts/reset-lab.sh" }
|
||||||
|
"reset-hard" { $linuxCommand = "./scripts/reset-lab.sh --hard" }
|
||||||
}
|
}
|
||||||
|
|
||||||
$wslArgs = @()
|
$wslArgs = @()
|
||||||
|
|||||||
Reference in New Issue
Block a user