๐Ÿ“‹ Crumbforest Migration Changelog

Von chaotischer Multi-Path Config zu sauberer Subdomain-Architektur

Version: 2.0
Date: 2025-01-14
Migration: HTTP-based Mixed โ†’ HTTPS-only Subdomain Architecture


๐ŸŽฏ Executive Summary

Problem: Mehrfach-Konfigurationen, vermischte Services, HTTP noch aktiv, keine durchgรคngige Auth

Lรถsung: Saubere Subdomain-Trennung, HTTPS-only, Multi-Layer Auth, keine Duplikate

Impact:
- โœ… Security: Von teilweise offen โ†’ Vollstรคndig geschรผtzt
- โœ… Maintainability: Von 3+ Configs pro Service โ†’ 1 Config pro Service
- โœ… Architecture: Von Path-based โ†’ Subdomain-based
- โœ… Auth: Von gemischt โ†’ Einheitlich auf allen Services


๐Ÿ”„ Was wurde geรคndert

VORHER - Problematische Architektur

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ HTTP & HTTPS Gemischt                               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”œโ”€ crumbforest.194-164-194-191.sslip.io
โ”‚  โ”œโ”€ HTTP: โœ“ (OFFEN!)
โ”‚  โ”œโ”€ HTTPS: โœ“
โ”‚  โ”œโ”€ /terminal/ (via crumbforest-locations.conf) โŒ Duplikat
โ”‚  โ”œโ”€ /git/ (via crumbforest-locations.conf) โŒ Duplikat
โ”‚  โ””โ”€ /qdrant/ (via crumbforest-locations.conf) โŒ Duplikat
โ”‚
โ”œโ”€ 194-164-194-191.sslip.io (ttyd_sslip)
โ”‚  โ”œโ”€ /terminal/ โŒ Duplikat
โ”‚  โ”œโ”€ /git/ โŒ Duplikat
โ”‚  โ”œโ”€ /qdrant/ โŒ Duplikat
โ”‚  โ””โ”€ server_name _; โŒ Catch-all Konflikt
โ”‚
โ”œโ”€ qdrant.194-164-194-191.sslip.io
โ”‚  โ””โ”€ Qdrant โŒ Duplikat (3. Mal!)
โ”‚
โ””โ”€ 00_catch_all
   โ””โ”€ server_name _; โŒ Catch-all Konflikt

โŒ Terminal/Git/Qdrant 2-3x konfiguriert
โŒ HTTP ohne Redirect auf crumbforest
โŒ Zwei catch-all server_name _;
โŒ Keine Auth auf crumbforest (sensible Daten!)

NACHHER - Saubere Architektur

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ HTTPS-ONLY (HTTP โ†’ 301 Redirect)                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”œโ”€ ๐ŸŒณ crumbforest.194-164-194-191.sslip.io
โ”‚  โ”œโ”€ NUR Crumbforest App
โ”‚  โ”œโ”€ HTTPS: โœ“
โ”‚  โ”œโ”€ Auth: โœ“ Basic Auth (.htpasswd)
โ”‚  โ””โ”€ KEINE anderen Services mehr
โ”‚
โ”œโ”€ ๐Ÿ’ป ttyd.194-164-194-191.sslip.io
โ”‚  โ”œโ”€ NUR Terminal (TTYD)
โ”‚  โ”œโ”€ HTTPS: โœ“
โ”‚  โ””โ”€ Auth: โœ“ Basic Auth (.htpasswd)
โ”‚
โ”œโ”€ ๐Ÿ“ฆ git.194-164-194-191.sslip.io
โ”‚  โ”œโ”€ NUR Gitea
โ”‚  โ”œโ”€ HTTPS: โœ“
โ”‚  โ””โ”€ Auth: โœ“ Basic Auth (.htpasswd)
โ”‚
โ”œโ”€ ๐Ÿ” qdrant.194-164-194-191.sslip.io
โ”‚  โ”œโ”€ NUR Qdrant
โ”‚  โ”œโ”€ HTTPS: โœ“
โ”‚  โ”œโ”€ Auth: โœ“ Basic Auth (.htpasswd_qdrant)
โ”‚  โ””โ”€ API: โœ“ Token Auth (X-Crumb-Token)
โ”‚
โ”œโ”€ ๐Ÿ”€ 194-164-194-191.sslip.io
โ”‚  โ””โ”€ Redirect โ†’ crumbforest
โ”‚
โ””โ”€ ๐Ÿšซ 00_catch_all
   โ”œโ”€ HTTP โ†’ HTTPS
   โ””โ”€ Unknown โ†’ 444

โœ… Jeder Service eine Subdomain
โœ… Kein HTTP mehr (nur 301 Redirect)
โœ… Ein catch-all
โœ… Auth auf ALLEN Services

๐Ÿ“Š Detailed Changes

1. Nginx Configs

Entfernt/Ersetzt:

  • โŒ sites-available/crumbforest (alte Version mit Duplikaten)
  • โŒ sites-available/ttyd_sslip (vermischte mehrere Services)
  • โŒ sites-available/qdrant_sslip (ersetzt durch neue qdrant)
  • โŒ sites-available/default (nicht verwendet)
  • โŒ sites-available/crumbforest-locations.conf (Duplikate!)

Neu erstellt:

  • โœ… sites-available/crumbforest (nur App, sauber)
  • โœ… sites-available/ttyd (eigene Subdomain)
  • โœ… sites-available/gitea (eigene Subdomain)
  • โœ… sites-available/qdrant (aufgerรคumt, eigene Subdomain)
  • โœ… sites-available/main_redirect (194-164-194-191.sslip.io โ†’ crumbforest)
  • โœ… sites-available/00_catch_all (HTTPโ†’HTTPS, Unknownโ†’444)

2. Security Changes

VORHER:

crumbforest:  โŒ Kein Auth (HTTP offen!)
terminal:     โœ“ Basic Auth
gitea:        โŒ Kein Auth
qdrant:       โœ“ Basic Auth

NACHHER:

crumbforest:  โœ… Basic Auth + HTTPS-only
terminal:     โœ… Basic Auth + HTTPS-only
gitea:        โœ… Basic Auth + HTTPS-only
qdrant:       โœ… Basic Auth + Token Auth + HTTPS-only

3. SSL/TLS

VORHER:

crumbforest:  โœ“ HTTPS (aber HTTP auch offen)
ttyd_sslip:   โœ“ HTTPS
qdrant:       โœ“ HTTPS
git/terminal: โŒ Keine eigenen Certs

NACHHER:

crumbforest:  โœ… HTTPS-only + HSTS
ttyd:         โœ… HTTPS-only + HSTS + eigenes Cert
git:          โœ… HTTPS-only + HSTS + eigenes Cert
qdrant:       โœ… HTTPS-only + HSTS
main:         โœ… HTTPS-only + HSTS

4. URL Structure

VORHER:

https://crumbforest.194-164-194-191.sslip.io/
https://crumbforest.194-164-194-191.sslip.io/terminal/
https://crumbforest.194-164-194-191.sslip.io/git/
https://crumbforest.194-164-194-191.sslip.io/qdrant/
https://194-164-194-191.sslip.io/terminal/
https://194-164-194-191.sslip.io/git/
https://194-164-194-191.sslip.io/qdrant/
https://qdrant.194-164-194-191.sslip.io/

NACHHER:

https://crumbforest.194-164-194-191.sslip.io/  (nur App)
https://ttyd.194-164-194-191.sslip.io/
https://git.194-164-194-191.sslip.io/
https://qdrant.194-164-194-191.sslip.io/

๐Ÿ” Security Improvements

1. HTTPS Enforcement

  • Vorher: Crumbforest auch รผber HTTP erreichbar (Zeile auskommentiert)
  • Nachher: Alles nur HTTPS, HTTP โ†’ 301 Redirect

2. Authentication

  • Vorher: Crumbforest ohne Auth (sensible Kinder-Daten!)
  • Nachher: Alle Services mit Basic Auth geschรผtzt

3. HSTS

  • Vorher: Teilweise aktiviert, teilweise auskommentiert
  • Nachher: รœberall aktiv (max-age=31536000; includeSubDomains)

4. Token-Auth fรผr API

  • Vorher: Placeholder <DEIN-GEHEIMER-TOKEN>
  • Nachher: Setup-Script generiert echten Token

5. Separate Auth-Domains

  • Vorher: Alles mit .htpasswd
  • Nachher: .htpasswd fรผr Haupt-Services, .htpasswd_qdrant fรผr Qdrant

๐Ÿ“ File Changes

Neue Dateien:

/etc/nginx/sites-available/
โ”œโ”€โ”€ 00_catch_all         (NEU)
โ”œโ”€โ”€ crumbforest          (ERSETZT)
โ”œโ”€โ”€ ttyd                 (NEU - war in ttyd_sslip)
โ”œโ”€โ”€ gitea                (NEU)
โ”œโ”€โ”€ qdrant               (ERSETZT qdrant_sslip)
โ””โ”€โ”€ main_redirect        (NEU)

/etc/nginx/sites-enabled/
โ”œโ”€โ”€ 00_catch_all -> ../sites-available/00_catch_all
โ”œโ”€โ”€ crumbforest -> ../sites-available/crumbforest
โ”œโ”€โ”€ ttyd -> ../sites-available/ttyd
โ”œโ”€โ”€ gitea -> ../sites-available/gitea
โ”œโ”€โ”€ qdrant -> ../sites-available/qdrant
โ””โ”€โ”€ main_redirect -> ../sites-available/main_redirect

/root/
โ”œโ”€โ”€ setup_subdomains.sh           (NEU - Auto-Deployment)
โ”œโ”€โ”€ run_all_tests.sh              (NEU - Test-Suite)
โ”œโ”€โ”€ FINAL_DEPLOYMENT_GUIDE.md     (NEU - Doku)
โ”œโ”€โ”€ AUTH_SETUP.md                 (NEU - Auth-Anleitung)
โ”œโ”€โ”€ SECURITY_CHECKLIST.md         (NEU - Security-Check)
โ”œโ”€โ”€ QUICK_REFERENCE.md            (NEU - Daily Ops)
โ””โ”€โ”€ nginx-backup-*/               (AUTO - Backups)

Gelรถschte/Deaktivierte:

/etc/nginx/sites-enabled/
โ”œโ”€โ”€ default              (ENTFERNT)
โ”œโ”€โ”€ ttyd_sslip           (ERSETZT durch ttyd)
โ”œโ”€โ”€ qdrant_sslip         (ERSETZT durch qdrant)
โ””โ”€โ”€ crumbforest          (ERSETZT - neue Version)

/etc/nginx/sites-available/
โ””โ”€โ”€ crumbforest-locations.conf   (NICHT MEHR VERWENDET)

๐Ÿ”„ Migration Path

Phase 1: Preparation โœ…

  • [x] Backup der aktuellen Configs
  • [x] SSL-Zertifikate prรผfen
  • [x] Auth-Dateien vorbereiten
  • [x] Neue Configs erstellen

Phase 2: Deployment โœ…

  • [x] Setup-Script ausfรผhren
  • [x] Fehlende SSL-Certs erstellen
  • [x] Alte Configs entfernen
  • [x] Neue Configs aktivieren
  • [x] Nginx testen & reload

Phase 3: Testing โœ…

  • [x] HTTPS Erreichbarkeit
  • [x] HTTP Redirects
  • [x] Auth-Protection
  • [x] Backend Services
  • [x] SSL/TLS Config
  • [x] Token-Auth

Phase 4: Monitoring ๐Ÿ”„

  • [ ] Logs รผberwachen (erste 24h)
  • [ ] Performance prรผfen
  • [ ] SSL Cert Auto-Renewal testen
  • [ ] Backup-Rotation einrichten

โš ๏ธ Breaking Changes

URLs haben sich geรคndert:

ALT (funktioniert nicht mehr):

https://crumbforest.194-164-194-191.sslip.io/terminal/
https://crumbforest.194-164-194-191.sslip.io/git/
https://crumbforest.194-164-194-191.sslip.io/qdrant/
https://194-164-194-191.sslip.io/terminal/
https://194-164-194-191.sslip.io/git/
https://194-164-194-191.sslip.io/qdrant/

NEU:

https://ttyd.194-164-194-191.sslip.io/
https://git.194-164-194-191.sslip.io/
https://qdrant.194-164-194-191.sslip.io/

Auth ist jetzt Pflicht:

ALLE Services benรถtigen jetzt Login:
- Crumbforest (vorher: offen)
- Gitea (vorher: offen)
- Terminal (schon vorher: geschรผtzt)
- Qdrant (schon vorher: geschรผtzt)


๐Ÿ“ˆ Metrics

Config Complexity:

  • Vorher: 4 Configs mit Duplikaten, ~150 Zeilen pro Service
  • Nachher: 6 saubere Configs, ~50 Zeilen pro Service

Security Score:

  • Vorher: 3/5 (HTTP offen, keine Auth auf 2 Services)
  • Nachher: 5/5 (HTTPS-only, Auth รผberall, HSTS, Token-Auth)

Maintainability:

  • Vorher: ร„nderung = 2-3 Configs anpassen
  • Nachher: ร„nderung = 1 Config anpassen

Deployment Time:

  • Vorher: Manuell, fehleranfรคllig, ~30min
  • Nachher: Automatisch, getestet, ~5min

๐ŸŽฏ Success Metrics

Metric Target Status
HTTPS-only 100% โœ…
Auth Coverage 100% โœ…
Config Duplicates 0 โœ…
Auto-Deployment Yes โœ…
Auto-Testing Yes โœ…
Backup on Deploy Yes โœ…
HSTS Enabled Yes โœ…
Cert Auto-Renewal Yes โœ…

๐Ÿ”ฎ Future Improvements

Potential Additions:

  • [ ] Rate Limiting per Subdomain
  • [ ] Fail2ban Integration
  • [ ] Centralized Logging (ELK/Loki)
  • [ ] Monitoring (Prometheus/Grafana)
  • [ ] CDN Integration
  • [ ] IPv6 Support
  • [ ] HTTP/3 Support

Maintenance:

  • [ ] Cert Renewal Alerting
  • [ ] Log Rotation Optimization
  • [ ] Backup Cleanup Automation
  • [ ] Health Check Automation

๐Ÿ“ž Rollback Instructions

Falls Probleme auftreten:

# 1. Letztes Backup finden
BACKUP=$(ls -td /root/nginx-backup-* | head -1)
echo "Rolling back to: $BACKUP"

# 2. Wiederherstellen
rm -f /etc/nginx/sites-enabled/*
cp -r $BACKUP/sites-available/* /etc/nginx/sites-available/
cp -r $BACKUP/sites-enabled/* /etc/nginx/sites-enabled/

# 3. Testen & Reload
nginx -t && systemctl reload nginx

# 4. Verify
curl -I https://crumbforest.194-164-194-191.sslip.io/

๐Ÿ“ Documentation

Neue Dokumente:

  • FINAL_DEPLOYMENT_GUIDE.md - Komplettes Deployment-Handbuch
  • AUTH_SETUP.md - Authentication Setup
  • SECURITY_CHECKLIST.md - Security Verification
  • QUICK_REFERENCE.md - Daily Operations
  • CHANGELOG.md - Diese Datei

Scripts:

  • setup_subdomains.sh - Automatisches Deployment
  • run_all_tests.sh - Umfassende Test-Suite

โœ… Sign-Off

Migration Status: โœ… COMPLETE
Testing Status: โœ… PASSED
Production Ready: โœ… YES

Date: 2025-01-14
Version: 2.0
Security: #ckl ๐Ÿ›ก๏ธ


Von Chaos zu Ordnung - Mission accomplished! ๐ŸŒณ