Hardened installer (v2): Sicherheits-Fixes + CI-Tests - #1
Merged
Conversation
Hauptänderungen install.sh (kritische Sicherheits-Fixes + Bugs):
- Authentifizierung: Login-Form, bcrypt-Hash, PHP-Sessions, Rate-Limit
- CSRF-Token-Schutz für alle mutierenden API-Endpunkte
- Caddyfile-Generator: strikte Domain-/IP-/Port-Validierung,
Direktiven-Injection ("additional_config") entfernt, Logpfad escaped
- Sudoers ohne Argumente: Reload-Helper liest fixen Stage-Pfad
- Echtes Let's Encrypt via globaler email-Direktive (kein "tls internal")
- CURLOPT_SSL_VERIFYPEER aktiviert
- flock() für domains.json gegen Race Conditions
- PHP-Version nach Installation aus Binary statt apt-cache
- Stack vereinfacht: Caddy + PHP-FPM nativ (Apache/Nginx-Doppelstack entfernt)
- Login-Credentials und Konfiguration interaktiv abgefragt
Neue Test-Infrastruktur:
- .github/workflows/ci.yml: shell-lint, php-lint, bats, php-validators,
caddyfile-validation
- tests/install.bats: 25 Bats-Unit-Tests für Bash-Validierungsfunktionen
- tests/test-validators.php: 43 PHP-Unit-Tests für api.php-Validatoren
- tests/extract-php.sh: extrahiert eingebettete PHP-Heredocs für php -l
- tests/sample-caddyfile: repräsentatives Caddyfile für caddy validate
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
caddy validate öffnet die in der Konfig referenzierten Log-Files real, nicht nur Syntax-Check. Ohne sudo mkdir + chmod fail der Step mit "permission denied" auf /var/log/caddy/<domain>.log. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CallMeTechie
added a commit
that referenced
this pull request
May 6, 2026
Hardened installer (v2): Sicherheits-Fixes + CI-Tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Diese PR ersetzt den ursprünglichen
install.shdurch eine gehärtete Variante und fügt eine vollständige CI-Test-Suite hinzu.Kritische Sicherheits-Fixes (
install.sh)Secure/HttpOnly/SameSite=Strict, Idle-Timeout, Session-Regeneration nach LoginX-CSRF-Token-Header für jede mutierende AnfrageAccess-Control-Allow-Origin: *mehr; plusX-Content-Type-Options,X-Frame-Options: DENY,Referrer-Policyadditional_config(Direktiven-Injection-Vektor) entfernt; Logfile-Name escaped (Path-Traversal blockiert)visudo -cvalidiert vor Aktivierungemail-Direktive (statttls internal)CURLOPT_SSL_VERIFYPEERin Reachability-Checks aktiviertflock()aufdomains.jsonund Rate-Limit-DateiBug-Fixes
$PHP_VERSIONwird nach Installation aus dem PHP-Binary gelesen (nicht ausapt-cache)php_fastcgi>/dev/null 2>&1-Maskierung kritischer Schritte zurückgenommenInteraktive Eingaben (während der Installation)
Domain · E-Mail · SSL ja/nein · Port (1024–65535) · Admin-Username · Admin-Passwort (mit Bestätigung, mind. 12 Zeichen, sofort als bcrypt-Hash gespeichert, Klartext geleert) · Firewall ja/nein · Bestätigung der Zusammenfassung
Neue Test-Infrastruktur
shell-lintbash -n install.sh+shellcheck -S errorphp-lintphp -lgelintetbats-testsis_valid_domain/is_valid_email/ Pfad-Konstantenphp-validatorsvalidate_domain/_ip/_port/_protocol+safe_log_name(inkl. Caddyfile-Injection, Path-Traversal, Shell-Injection)caddyfile-validationcaddy validateauf einem repräsentativen Sample-Caddyfileinstall.shwurde am Ende mit einemBASH_SOURCE-Guard versehen, sodass Bats die Funktionen importieren kann ohnemain()zu starten.Test plan
bash -n install.sh✓shellcheck -S error install.sh✓bats tests/install.bats→ 25/25 ✓php tests/test-validators.php→ 43/43 ✓caddy validate tests/sample-caddyfile→ "Valid configuration" ✓hardened-v2: alle 5 Jobs grün (Run #25452674812)