From a9c15eb9c6587054237b27175daec768526fce63 Mon Sep 17 00:00:00 2001 From: overcuriousity Date: Sat, 26 Jul 2025 10:41:50 +0200 Subject: [PATCH] prod preps --- .env.example | 69 ++-- README.md | 809 +++++++++++++++++++++------------------------- src/utils/auth.ts | 1 - 3 files changed, 392 insertions(+), 487 deletions(-) diff --git a/.env.example b/.env.example index df4fa4a..d08ae25 100644 --- a/.env.example +++ b/.env.example @@ -1,43 +1,36 @@ -# AI Configuration -AI_API_ENDPOINT=https://aiendpoint.org -AI_API_KEY=your_apikey_here -AI_MODEL='ai_model_name_here' -AI_RATE_LIMIT_DELAY_MS=2000 +# =========================================== +# CC24-Hub Environment Configuration +# =========================================== -# Git Repository -GIT_REPO_URL=https://git.cc24.dev/mstoeck3/cc24-hub.git -GIT_API_ENDPOINT=https://git.cc24.dev/api/v1 -GIT_API_TOKEN= -LOCAL_REPO_PATH=/var/git/cc24-hub +# Authentication & OIDC (Required) +AUTH_SECRET=change-this-to-a-strong-secret-key-in-production +OIDC_ENDPOINT=https://your-oidc-provider.com +OIDC_CLIENT_ID=your-oidc-client-id +OIDC_CLIENT_SECRET=your-oidc-client-secret +AUTHENTICATION_NECESSARY=true + +# Application Configuration (Required) +PUBLIC_BASE_URL=https://your-domain.com +NODE_ENV=production + +# AI Service Configuration (Required for AI features) +AI_MODEL=mistral-large-latest +AI_API_ENDPOINT=https://api.mistral.ai +AI_API_KEY=your-mistral-api-key +AI_RATE_LIMIT_DELAY_MS=1000 + +# Git Integration (Required for contributions) +GIT_REPO_URL=https://git.cc24.dev/mstoeck3/cc24-hub GIT_PROVIDER=gitea +GIT_API_ENDPOINT=https://git.cc24.dev/api/v1 +GIT_API_TOKEN=your-git-api-token -# OIDC Configuration -OIDC_ENDPOINT=https://oidc-provider.org -OIDC_CLIENT_ID=your_oidc_client_id -OIDC_CLIENT_SECRET=your_oidc_client_secret -AUTH_SECRET=your_super_secret_jwt_key_that_should_be_at_least_32_characters_long_for_security - -AUTHENTICATION_NECESSARY=false # Always set this to true in prod - - -# Application -PUBLIC_BASE_URL=http://localhost:4321 - -# Media Storage +# File Upload Configuration (Optional) LOCAL_UPLOAD_PATH=./public/uploads -# Nextcloud integration (optional) -NEXTCLOUD_ENDPOINT= -NEXTCLOUD_USERNAME= -NEXTCLOUD_PASSWORD= + +# Nextcloud Integration (Optional) +NEXTCLOUD_ENDPOINT=https://your-nextcloud.com +NEXTCLOUD_USERNAME=your-username +NEXTCLOUD_PASSWORD=your-password NEXTCLOUD_UPLOAD_PATH=/kb-media -NEXTCLOUD_PUBLIC_URL= - -# Custom upload limits (optional) -MAX_FILE_SIZE=52428800 # 50MB in bytes -MAX_UPLOADS_PER_HOUR=100 - -# Development/Production mode -NODE_ENV=development - -# Logging level -LOG_LEVEL=info \ No newline at end of file +NEXTCLOUD_PUBLIC_URL=https://your-nextcloud.com/s/ \ No newline at end of file diff --git a/README.md b/README.md index dc1153c..7e9edf9 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,78 @@ # CC24-Hub -Ein kuratiertes Verzeichnis für digitale Forensik- und Incident-Response-Tools mit KI-gestützten Empfehlungen, entwickelt für die Seminargruppe CC24-w1. +Ein kuratiertes Verzeichnis für Digital Forensics und Incident Response (DFIR) Tools, Methoden und Konzepte mit KI-gestützten Workflow-Empfehlungen. -## 🎯 Projektübersicht +## ✨ Funktionen -CC24-Hub bietet eine strukturierte Übersicht über bewährte DFIR-Tools, -Methoden und -Konzepte mit intelligenten Empfehlungsfunktionen. Das Projekt orientiert sich am NIST-Framework (SP 800-86) und kategorisiert nach forensischen Domänen und Untersuchungsphasen. +### 🎯 Hauptansichten +- **Kachelansicht (Grid View):** Übersichtliche Kartenansicht aller Tools/Methoden +- **Matrix-Ansicht:** Interaktive Matrix nach forensischen Domänen und Untersuchungsphasen (NIST Framework) +- **KI-Empfehlungen:** AI-gestützte Workflow-Empfehlungen basierend auf Szenario-Beschreibungen -### Hauptfunktionen +### 🔍 Navigation & Filterung +- **Tag-System:** Intelligente Filterung nach Kategorien und Eigenschaften +- **Volltext-Suche:** Durchsuchen von Namen, Beschreibungen und Tags +- **Domain/Phase-Filter:** Filterung nach forensischen Bereichen und Ermittlungsphasen -- **KI-gestützte Empfehlungen**: Workflow- und Tool-Vorschläge basierend auf forensischen Szenarien -- **Drei Kategorien**: Software-Tools, forensische Methoden UND Grundlagenkonzepte -- **Matrix-Ansicht**: Visualisierung nach Domänen × Prozess-Phasen -- **Erweiterte Filter**: Suche nach Name, Tags, Domäne, Phase, Lizenz -- **CC24-Server Integration**: Direkte SSO-Links zu gehosteten Instanzen -- **Knowledgebase**: Erweiterte Dokumentation mit praktischen Erkenntnissen -- **Konzept-Verlinkung**: Automatische Verknüpfung zwischen Tools und Grundlagenkonzepten -- **Status-Monitoring**: Live-Überwachung verfügbarer Services -- **Responsive Design**: Dark/Light Mode, Mobile-optimiert +### 📚 Inhaltstypen +- **Software/Tools:** Open Source und proprietäre forensische Software +- **Methoden:** Bewährte forensische Verfahren und Prozesse +- **Konzepte:** Grundlegendes Fachwissen und theoretische Grundlagen -## 🛠️ Technischer Stack +### 📖 Knowledgebase +- **Erweiterte Dokumentation:** Detaillierte Artikel zu Tools und Methoden +- **Praktische Anleitungen:** Installation, Konfiguration und Best Practices +- **Markdown-basiert:** Einfache Erstellung und Wartung von Inhalten -- **Framework**: [Astro](https://astro.build/) mit Server-Side Rendering -- **Backend**: Node.js mit API-Routen für KI und Authentifizierung -- **Styling**: Vanilla CSS mit CSS Custom Properties -- **Datenformat**: YAML für Tool-/Methoden-/Konzept-Definitionen -- **KI-Integration**: Mistral AI über OpenAI-kompatible API -- **Authentifizierung**: OIDC (OpenID Connect) mit JWT-Sessions -- **Node.js**: >=18.0.0 +### 🤝 Contribution-System +- **Tool/Methoden-Beiträge:** Webformular für neue Einträge +- **Knowledgebase-Artikel:** Artikel-Editor mit Datei-Upload +- **Git-Integration:** Automatische Issue-Erstellung für Review-Prozess +- **File-Management:** Nextcloud-Integration für Medien-Uploads -## 🚀 Installation & Deployment +### 🔐 Authentifizierung +- **OIDC-Integration:** Single Sign-On mit OpenID Connect +- **Berechtigungssteuerung:** Schutz für AI-Features und Contribution-System +- **Session-Management:** Sichere JWT-basierte Sessions + +## 🛠 Technische Grundlage + +- **Framework:** Astro 5.x mit TypeScript +- **Styling:** CSS Custom Properties mit Dark/Light Mode +- **API:** Node.js Backend mit Astro API Routes +- **Datenbank:** YAML-basierte Konfiguration (tools.yaml) + +## 📋 Voraussetzungen + +- **Node.js:** Version 18.x oder höher +- **npm:** Version 8.x oder höher +- **Nginx:** Für Reverse Proxy (Produktion) + +## 🔧 Externe Abhängigkeiten (Optional) + +### OIDC Provider +- **Zweck:** Benutzerauthentifizierung +- **Beispiel:** Nextcloud, Keycloak, Auth0 +- **Konfiguration:** `OIDC_ENDPOINT`, `OIDC_CLIENT_ID`, `OIDC_CLIENT_SECRET` + +### Nextcloud +- **Zweck:** File-Upload für Knowledgebase-Beiträge +- **Features:** Medien-Management, öffentliche Links +- **Konfiguration:** `NEXTCLOUD_ENDPOINT`, `NEXTCLOUD_USERNAME`, `NEXTCLOUD_PASSWORD` + +### AI Service (Mistral/OpenAI-kompatibel) +- **Zweck:** KI-gestützte Tool-Empfehlungen +- **Konfiguration:** `AI_API_ENDPOINT`, `AI_API_KEY`, `AI_MODEL` + +### Uptime Kuma +- **Zweck:** Status-Monitoring für gehostete Services +- **Integration:** Status-Badges in der Service-Übersicht + +### Git Provider (Gitea/GitHub/GitLab) +- **Zweck:** Issue-Erstellung für Contributions +- **Konfiguration:** `GIT_PROVIDER`, `GIT_API_ENDPOINT`, `GIT_API_TOKEN` + +## 🚀 Installation ### Lokale Entwicklung @@ -40,6 +84,10 @@ cd cc24-hub # Dependencies installieren npm install +# Umgebungsvariablen konfigurieren +cp .env.example .env +# .env bearbeiten (siehe Konfiguration unten) + # Development Server starten npm run dev ``` @@ -48,150 +96,128 @@ Die Seite ist dann unter `http://localhost:4321` verfügbar. ### Produktions-Deployment -#### Voraussetzungen +#### 1. System vorbereiten -- Ubuntu/Debian server -- Node.js 18+ -- Nginx -- Domain -- SSL Zertifikat +```bash +# System-Updates +sudo apt update && sudo apt upgrade -y -#### Installationsschritte +# Node.js installieren (Ubuntu/Debian) +curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - +sudo apt-get install -y nodejs -##### 1. Vorbereitung +# Nginx installieren +sudo apt install nginx -y + +# Systemd für Service-Management +sudo systemctl enable nginx +``` + +#### 2. Anwendung installieren ```bash # Klonen des Repositorys -git clone https://git.cc24.dev/mstoeck3/cc24-hub -cd cc24-hub +sudo git clone https://git.cc24.dev/mstoeck3/cc24-hub /var/www/cc24-hub +cd /var/www/cc24-hub # Abhängigkeiten installieren -npm install +sudo npm install -# Production-Build anstoßen -npm run build -``` - -##### 2. Webroot vorbereiten - -```bash -# Webroot erstellen und Berechtigungen setzen -sudo mkdir -p /var/www/cc24-hub -sudo chown -R $USER:$USER /var/www/cc24-hub - -# Build in Webroot kopieren -sudo cp -r ./dist/* /var/www/cc24-hub/ -sudo cp ./src/data/tools.yaml /var/www/cc24-hub/src/data/ -sudo cp package.json /var/www/cc24-hub/ - -# Prod-Abhängigkeiten installieren -cd /var/www/cc24-hub -npm install --omit=dev +# Production-Build erstellen +sudo npm run build # Berechtigungen setzen sudo chown -R www-data:www-data /var/www/cc24-hub ``` -##### 3. Umgebungsvariablen setzen +#### 3. Umgebungsvariablen konfigurieren Erstelle `/var/www/cc24-hub/.env`: ```bash -# AI Konfiguration -AI_API_ENDPOINT=https://llm.mikoshi.de # hier geeigneten Endpunkt setzen -AI_API_KEY=your_ai_api_key -AI_MODEL=mistral/mistral-small-latest # hier geeignetes KI-Modell wählen +# === GRUNDKONFIGURATION === +NODE_ENV=production +PUBLIC_BASE_URL=https://ihre-domain.de -# Authentifizierung ("false" setzen für Tests, oder wenn kostenlose KI verwendet wird) +# === AI-KONFIGURATION (Optional) === +AI_API_ENDPOINT=https://api.mistral.ai/v1 +AI_API_KEY=your_mistral_api_key +AI_MODEL=mistral-small-latest +AI_RATE_LIMIT_DELAY_MS=2000 + +# === AUTHENTIFIZIERUNG === AUTHENTICATION_NECESSARY=true -OIDC_ENDPOINT=https://cloud.cc24.dev -OIDC_CLIENT_ID=your_oidc_client_id -OIDC_CLIENT_SECRET=your_oidc_client_secret -AUTH_SECRET=your_super_secret_jwt_key_min_32_chars +OIDC_ENDPOINT=https://ihr-oidc-provider.de +OIDC_CLIENT_ID=cc24-hub-client +OIDC_CLIENT_SECRET=your_super_secret_client_secret +AUTH_SECRET=your_jwt_secret_min_32_characters_long -# Public Configuration -PUBLIC_BASE_URL=https://your-domain.com # hier die URL setzen, mit der von außen zugegriffen wird +# === NEXTCLOUD (Optional) === +NEXTCLOUD_ENDPOINT=https://ihre-nextcloud.de +NEXTCLOUD_USERNAME=cc24-hub-user +NEXTCLOUD_PASSWORD=nextcloud_app_password +NEXTCLOUD_UPLOAD_PATH=/kb-media +NEXTCLOUD_PUBLIC_URL=https://ihre-nextcloud.de/s + +# === GIT-INTEGRATION (Optional) === +GIT_PROVIDER=gitea +GIT_API_ENDPOINT=https://ihr-git-server.de/api/v1 +GIT_API_TOKEN=your_git_api_token +GIT_REPO_URL=https://ihr-git-server.de/user/cc24-hub + +# === UPLOAD-KONFIGURATION === +LOCAL_UPLOAD_PATH=/var/www/cc24-hub/public/uploads ``` ```bash -# .env sichern +# Berechtigungen sichern sudo chmod 600 /var/www/cc24-hub/.env sudo chown www-data:www-data /var/www/cc24-hub/.env ``` -##### 4. Systemd-Service erstellen - -Create `/etc/systemd/system/cc24-hub.service`: - -```ini -[Unit] -Description=CC24-Hub DFIR Tool Directory -After=network.target -Wants=network.target - -[Service] -Type=simple -User=www-data -Group=www-data -WorkingDirectory=/var/www/cc24-hub -ExecStart=/usr/bin/node server/entry.mjs -Restart=always -RestartSec=5 -StartLimitInterval=60s -StartLimitBurst=3 - -# Environment -Environment=NODE_ENV=production -Environment=PORT=3000 - -# Security -NoNewPrivileges=true -PrivateTmp=true -ProtectSystem=strict -ReadWritePaths=/var/www/cc24-hub - -# Logging -StandardOutput=journal -StandardError=journal -SyslogIdentifier=cc24-hub - -[Install] -WantedBy=multi-user.target -``` - -##### 5. Nginx Reverse Proxy konfigurieren +#### 4. Nginx konfigurieren Erstelle `/etc/nginx/sites-available/cc24-hub`: ```nginx server { listen 80; - server_name your-domain.com; + server_name ihre-domain.de; + + # Redirect HTTP to HTTPS return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; - server_name your-domain.com; - - # SSL Configuration (adjust paths for your certificates) - ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem; + server_name ihre-domain.de; + + # SSL Konfiguration (Let's Encrypt empfohlen) + ssl_certificate /etc/letsencrypt/live/ihre-domain.de/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/ihre-domain.de/privkey.pem; - # SSL Security - ssl_protocols TLSv1.2 TLSv1.3; - ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384; - ssl_prefer_server_ciphers off; - # Security Headers add_header X-Frame-Options DENY; add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; - - # Proxy to Node.js application + add_header Referrer-Policy "strict-origin-when-cross-origin"; + + # Static Files location / { - proxy_pass http://localhost:3000; + try_files $uri $uri/ @nodejs; + root /var/www/cc24-hub/dist; + index index.html; + + # Cache static assets + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|ttf)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } + } + + # API Routes to Node.js + location @nodejs { + proxy_pass http://localhost:4321; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; @@ -203,360 +229,247 @@ server { proxy_read_timeout 300s; proxy_connect_timeout 75s; } - - # Optional: Serve static assets directly (performance optimization) - location /_astro/ { - proxy_pass http://localhost:3000; - expires 1y; - add_header Cache-Control "public, immutable"; - } + + # Upload limit + client_max_body_size 50M; } ``` -##### 6. Daemon starten und Autostart setzen - ```bash -# Enable Nginx site +# Site aktivieren sudo ln -s /etc/nginx/sites-available/cc24-hub /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl reload nginx +``` -# Enable and start CC24-Hub service +#### 5. Systemd Service einrichten + +Erstelle `/etc/systemd/system/cc24-hub.service`: + +```ini +[Unit] +Description=CC24-Hub DFIR Guide +After=network.target nginx.service +Wants=nginx.service + +[Service] +Type=exec +User=www-data +Group=www-data +WorkingDirectory=/var/www/cc24-hub +Environment=NODE_ENV=production +ExecStart=/usr/bin/node ./dist/server/entry.mjs +Restart=always +RestartSec=10 +StandardOutput=journal +StandardError=journal + +# Security +NoNewPrivileges=yes +PrivateTmp=yes +ProtectSystem=strict +ProtectHome=yes +ReadWritePaths=/var/www/cc24-hub +CapabilityBoundingSet= + +# Resource Limits +LimitNOFILE=65536 +MemoryMax=512M + +[Install] +WantedBy=multi-user.target +``` + +```bash +# Service aktivieren und starten sudo systemctl daemon-reload sudo systemctl enable cc24-hub sudo systemctl start cc24-hub -# Check status +# Status prüfen sudo systemctl status cc24-hub ``` -##### 7. Deployment verifizieren +## 🔧 Konfiguration + +### Minimalkonfiguration (ohne Auth) ```bash -# Check application logs -sudo journalctl -u cc24-hub -f - -# Check if app is responding -curl http://localhost:3000 - -# Check external access -curl https://your-domain.com +# Nur für Tests geeignet +AUTHENTICATION_NECESSARY=false +PUBLIC_BASE_URL=http://localhost:4321 ``` -#### OIDC Konfigurieren +### Tools-Datenbank -Nextcloud OIDC Einstellungen (sollte auch mit anderen OIDC-Anwendungen klappen): -- **Redirect URI**: `https://your-domain.com/auth/callback` -- **Logout URI**: `https://your-domain.com` - -## 🔧 Datenformat & Kategorien - -Die CC24-Hub verwaltet drei Kategorien von Einträgen in `src/data/tools.yaml`: - -### 1. Software-Tools +Die Tools werden in `src/data/tools.yaml` verwaltet. Vollständiges Beispiel: ```yaml tools: - - name: "Autopsy" - icon: "📦" - type: "software" - description: "Die führende Open-Source-Alternative zu kommerziellen Forensik-Suiten" - domains: ["incident-response", "static-investigations"] - phases: ["examination", "analysis"] - platforms: ["Windows", "Linux"] - skillLevel: "intermediate" - accessType: "download" - url: "https://www.autopsy.com/" - projectUrl: "https://autopsy.cc24.dev" # CC24-Server URL (optional) - license: "Apache 2.0" - knowledgebase: true # Hat erweiterte Dokumentation - related_concepts: ["Hash Functions & Digital Signatures", "SQL Query Fundamentals"] # Verknüpfung zu Konzepten - tags: ["gui", "filesystem", "timeline-analysis"] - statusUrl: "https://status.example.com/badge/1/status" # Status-Badge URL (optional) -``` - -### 2. Forensische Methoden - -```yaml - - name: "Live Memory Acquisition Procedure" - icon: "📋" - type: "method" - description: "Standardisiertes Verfahren zur forensisch korrekten Akquisition des Arbeitsspeichers" - domains: ["incident-response", "static-investigations"] - phases: ["data-collection"] - platforms: [] # Methoden haben keine Plattformen - skillLevel: "advanced" - accessType: null - url: "https://www.nist.gov/publications/guide-integrating-forensic-techniques" - projectUrl: null - license: null + - name: Autopsy + type: software # software|method|concept + description: >- + Die führende Open-Source-Alternative zu kommerziellen Forensik-Suiten mit + intuitiver grafischer Oberfläche. Besonders stark in der Timeline-Analyse, + Keyword-Suche und dem Carving gelöschter Dateien. Die modulare + Plugin-Architektur erlaubt Erweiterungen für spezielle + Untersuchungsszenarien. + icon: 📦 + skillLevel: intermediate # novice|beginner|intermediate|advanced|expert + url: https://www.autopsy.com/ + domains: + - incident-response + - static-investigations + - malware-analysis + - mobile-forensics + - cloud-forensics + phases: + - examination + - analysis + platforms: + - Windows + - Linux + related_concepts: + - SQL Query Fundamentals + - Hash Functions & Digital Signatures + accessType: download # download|web|api|cli|service + license: Apache 2.0 + knowledgebase: false # true für erweiterte Dokumentation + tags: + - gui + - filesystem + - timeline-analysis + - carving + - artifact-extraction + - keyword-search + # Optional: Für gehostete Services + projectUrl: https://autopsy.ihre-domain.de + statusUrl: https://status.ihre-domain.de/api/badge/1/status + + # Beispiel Methode + - name: Live Response Methodology + type: method + description: >- + Strukturierte Vorgehensweise zur Sammlung volatiler Daten + von laufenden Systemen ohne Shutdown. + icon: 📋 + skillLevel: advanced + url: https://www.sans.org/white-papers/live-response/ + domains: + - incident-response + phases: + - data-collection + related_concepts: + - Memory Forensics Fundamentals + tags: + - volatile-data + - live-analysis + - methodology + knowledgebase: true + + # Beispiel Konzept + - name: Hash Functions & Digital Signatures + type: concept + description: >- + Kryptographische Grundlagen für Datenintegrität und + Authentifizierung in der digitalen Forensik. + icon: 🔐 + skillLevel: intermediate + url: https://en.wikipedia.org/wiki/Cryptographic_hash_function + domains: + - incident-response + - static-investigations + - malware-analysis + phases: + - data-collection + - examination + tags: + - cryptography + - data-integrity + - evidence-preservation knowledgebase: false - related_concepts: null # Können optional Konzepte verknüpfen - tags: ["memory-acquisition", "volatile-evidence", "procedure"] + +# Konfiguration der Domänen +domains: + - id: incident-response + name: Incident Response & Breach-Untersuchung + - id: static-investigations + name: Datenträgerforensik & Ermittlungen + - id: malware-analysis + name: Malware-Analyse & Reverse Engineering + - id: mobile-forensics + name: Mobile Geräte & App-Forensik + - id: cloud-forensics + name: Cloud & Virtuelle Umgebungen + +# Konfiguration der Phasen (NIST Framework) +phases: + - id: data-collection + name: Datensammlung + description: Imaging, Acquisition, Remote Collection Tools + - id: examination + name: Auswertung + description: Parsing, Extraction, Initial Analysis Tools + - id: analysis + name: Analyse + description: Deep Analysis, Correlation, Visualization Tools + - id: reporting + name: Bericht & Präsentation + description: Documentation, Visualization, Presentation Tools + +# Domänenübergreifende Kategorien +domain-agnostic-software: + - id: collaboration-general + name: Übergreifend & Kollaboration + description: Cross-cutting tools and collaboration platforms + - id: specific-os + name: Betriebssysteme + description: Operating Systems which focus on forensics ``` -### 3. Grundlagenkonzepte (NEU) +## 📦 Updates -```yaml - - name: "Regular Expressions (Regex)" - icon: "🔤" - type: "concept" - description: "Pattern matching language for searching, extracting, and manipulating text" - domains: ["incident-response", "malware-analysis"] - phases: ["examination", "analysis"] - platforms: [] # Konzepte haben keine Plattformen - skillLevel: "intermediate" - accessType: null - url: "https://regexr.com/" - projectUrl: null - license: null - knowledgebase: true # Erweiterte Erklärung in Knowledgebase - related_concepts: null # Konzepte verweisen nicht auf andere Konzepte - tags: ["pattern-matching", "text-processing", "log-analysis"] -``` - -### Verfügbare Kategorien - -**Domänen:** -- `incident-response` - Incident Response & Breach-Untersuchung -- `static-investigations` - Datenträgerforensik & Ermittlungen -- `malware-analysis` - Malware-Analyse & Reverse Engineering -- `fraud-investigation` - Betrugs- & Finanzkriminalität -- `network-forensics` - Netzwerk-Forensik & Traffic-Analyse -- `mobile-forensics` - Mobile Geräte & App-Forensik -- `cloud-forensics` - Cloud & Virtuelle Umgebungen -- `ics-forensics` - Industrielle Kontrollsysteme (ICS/SCADA) - -**Phasen (NIST SP 800-86):** -- `data-collection` - Datensammlung -- `examination` - Auswertung -- `analysis` - Analyse -- `reporting` - Bericht & Präsentation - -**Domain-agnostic Kategorien:** -- `collaboration-general` - Übergreifend & Kollaboration -- `specific-os` - Betriebssysteme - -## 📚 Knowledgebase-System - -### Erweiterte Dokumentation erstellen - -Die Knowledgebase bietet detaillierte Artikel für Tools, Methoden und Konzepte. So erstellen Sie neue Einträge: - -#### 1. Knowledgebase-Flag setzen - -Setzen Sie in `src/data/tools.yaml` das Flag: -```yaml -knowledgebase: true -``` - -#### 2. Artikel-Datei erstellen - -Erstellen Sie eine Markdown-Datei in `src/content/knowledgebase/`: - -**Dateiname-Schema:** `[tool-name-slug].md` - -**Beispiel:** `src/content/knowledgebase/autopsy.md` - -```markdown ---- -title: "Autopsy - Umfassende Forensik-Suite" -tool_name: "Autopsy" -description: "Detaillierte Anleitung und Best Practices für Autopsy" -last_updated: 2024-01-15 -author: "CC24-Team" -difficulty: "intermediate" -categories: ["filesystem-analysis", "timeline-analysis"] -tags: ["gui", "windows", "linux", "open-source"] -sections: - overview: true - installation: true - configuration: true - usage_examples: true - best_practices: true - troubleshooting: true - advanced_topics: false -review_status: "published" ---- - -# Übersicht - -Autopsy ist eine grafische Benutzeroberfläche für The Sleuth Kit (TSK) und bietet... - -## Installation - -### Windows -1. Download der neuesten Version von [autopsy.com](https://www.autopsy.com/) -2. Ausführung des Installers mit Administratorrechten -3. ... - -## Konfiguration - -### Grundeinstellungen -- Arbeitsverzeichnis festlegen -- Hash-Algorithmen auswählen -- ... - -## Verwendungsbeispiele - -### Fall 1: Gelöschte Dateien wiederherstellen -1. Neuen Fall erstellen -2. Image hinzufügen -3. ... - -## Best Practices - -- Immer Hash-Verifikation durchführen -- Regelmäßige Backups der Case-Datenbank -- ... - -## Troubleshooting - -### Problem: Autopsy startet nicht -**Lösung:** Java-Version überprüfen... - -### Problem: Langsame Performance -**Lösung:** RAM-Zuteilung erhöhen... - -## Weiterführende Themen - -- Integration mit externen Tools -- Custom Modules entwickeln -- ... -``` - -#### 3. Schema-Validierung - -Das System validiert automatisch folgende Felder: - -**Pflichtfelder:** -- `title`: Anzeigename des Artikels -- `tool_name`: Exakter Name aus tools.yaml -- `description`: Kurze Beschreibung -- `last_updated`: Datum der letzten Aktualisierung -- `difficulty`: `novice|beginner|intermediate|advanced|expert` - -**Optionale Felder:** -- `author`: Standard "CC24-Team" -- `categories`: Array von Kategorien -- `tags`: Array von Tags -- `sections`: Welche Abschnitte enthalten sind -- `review_status`: `draft|review|published` (Standard: `published`) - -#### 4. Automatische Verlinkung - -- Artikel sind automatisch über `/knowledgebase/[tool-slug]` erreichbar -- Links werden automatisch in Tool-Details angezeigt -- Suchfunktion indiziert Artikel-Inhalte - -### Konzept-Verlinkung - -Tools können mit Grundlagenkonzepten verknüpft werden: - -```yaml -# Tool-Definition -- name: "Autopsy" - related_concepts: ["Hash Functions & Digital Signatures", "SQL Query Fundamentals"] - -# Konzept-Definition -- name: "Hash Functions & Digital Signatures" - type: "concept" - description: "Cryptographic principles for data integrity verification" -``` - -Die KI-Empfehlungen nutzen diese Verlinkungen für Hintergrundwissen-Empfehlungen. - -## 🤖 KI-Integration - -### Workflow-Empfehlungen -Beschreibung forensischer Szenarien für maßgeschneiderte Workflows mit phasenbasierten Tool-Empfehlungen und Prioritätsbewertung. - -### Tool-spezifische Empfehlungen -Konkrete Tool-Vorschläge für spezifische Probleme mit detaillierten Begründungen, Implementierungsansätzen und Vor-/Nachteilen. - -### Konzept-Integration -Die KI berücksichtigt automatisch verknüpfte Grundlagenkonzepte und empfiehlt relevantes Hintergrundwissen. - -**API-Endpunkt:** `/api/ai/query` -- **Rate Limiting**: 10 Anfragen pro Minute pro Benutzer -- **Modi**: `workflow` (Szenario-basiert) oder `tool` (Problem-spezifisch) -- **Authentifizierung**: Optional konfigurierbar via `AUTHENTICATION_NECESSARY` - -## 🔐 Authentifizierung - -OIDC-Integration mit JWT-Sessions: -- **6 Stunden Gültigkeit** -- **HTTP-Only Cookies** mit CSRF-Schutz -- **Nextcloud/Keycloak kompatibel** - -**Relevante Dateien:** -- `src/utils/auth.ts` - Kern-Authentifizierungslogik -- `src/pages/api/auth/` - Auth-API-Endpunkte - -## 📁 Datei-Referenz - -### Wichtige Konfigurationsdateien -- `src/data/tools.yaml` - Hauptdatenbank für Tools, Methoden und Konzepte -- `src/content/config.ts` - Schema für Knowledgebase-Artikel -- `src/utils/dataService.js` - Datenverarbeitungslogik -- `src/styles/global.css` - Zentrale Stylesheet-Definitionen - -### Content-Verzeichnisse -- `src/content/knowledgebase/` - Knowledgebase-Artikel (Markdown) -- `src/components/` - Wiederverwendbare UI-Komponenten -- `src/pages/api/` - Backend-API-Endpunkte - -## 🤝 Beitragen - -### Tool/Methode/Konzept hinzufügen - -**Option 1: Direkte YAML-Bearbeitung** -1. Fork des Repositories erstellen -2. `src/data/tools.yaml` bearbeiten -3. Bei Bedarf Knowledgebase-Artikel erstellen -4. Pull Request mit Beschreibung erstellen - -**Option 2: Web-Editor verwenden** -1. YAML-Editor öffnen (`/dfir_yaml_editor.html`) -2. Eintrag hinzufügen (Tool/Methode/Konzept) -3. YAML exportieren und in Pull Request einreichen - -### Knowledgebase-Artikel erweitern - -1. Tool in `tools.yaml` identifizieren -2. `knowledgebase: true` setzen -3. Artikel in `src/content/knowledgebase/[slug].md` erstellen -4. Schema-Validierung beachten -5. Pull Request einreichen - -### Korrekturen & Verbesserungen - -- Bug Reports und Feature Requests über Issues melden -- Code-Beiträge über Pull Requests willkommen -- Dokumentation und Übersetzungen erwünscht - -## 🐛 Troubleshooting - -**KI-Empfehlungen funktionieren nicht:** -- `.env` Datei korrekt konfiguriert? -- `AUTHENTICATION_NECESSARY=false` für Tests setzen -- API-Endpoint erreichbar? - -**Authentifizierung schlägt fehl:** -- OIDC-Endpoints korrekt? -- Redirect-URIs im OIDC-Provider registriert? -- `AUTH_SECRET` mindestens 32 Zeichen? - -**Knowledgebase-Artikel werden nicht angezeigt:** -- `knowledgebase: true` in tools.yaml gesetzt? -- Markdown-Datei existiert in `src/content/knowledgebase/`? -- Schema-Validierung erfolgreich? - -**Logs prüfen:** ```bash -# Anwendungs-Logs -sudo journalctl -u cc24-hub -f +# Repository aktualisieren +cd /var/www/cc24-hub +sudo git pull -# Development-Modus -npm run dev +# Dependencies aktualisieren +sudo npm install + +# Rebuild +sudo npm run build + +# Service neustarten +sudo systemctl restart cc24-hub ``` + +## 💾 Backup + +Wichtige Dateien für Backup: + +```bash +/var/www/cc24-hub/src/data/tools.yaml +/var/www/cc24-hub/.env +/etc/nginx/sites-available/cc24-hub +/etc/systemd/system/cc24-hub.service +``` + +## 🤝 Beiträge + +Contributions sind willkommen! Bitte: + +1. Issue im Repository erstellen +2. Feature-Branch erstellen +3. Pull Request öffnen +4. Tests durchführen + +## 📞 Support + +Bei Problemen oder Fragen: + +- **Issues:** [Repository Issues](https://git.cc24.dev/mstoeck3/cc24-hub/issues) +- **Dokumentation:** Siehe `/knowledgebase` auf der Website + +## 📄 Lizenz +Dieses Projekt steht unter der BSD-3-Clause Lizenz. \ No newline at end of file diff --git a/src/utils/auth.ts b/src/utils/auth.ts index fbc52ed..44139e0 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -11,7 +11,6 @@ config(); // JWT session constants const SECRET_KEY = new TextEncoder().encode( process.env.AUTH_SECRET || - process.env.OIDC_CLIENT_SECRET || 'cc24-hub-default-secret-key-change-in-production' ); const SESSION_DURATION = 6 * 60 * 60; // 6 hours in seconds