Security: PHPMailer 7.0.2 Update und verbesserte Konfiguration
- PHPMailer von 6.9.3 auf 7.0.2 aktualisiert - Zentrale config.php mit .env-Unterstützung - forms/config.php entfernt (jetzt ../config.php) - .htaccess Schutz für Konfigurationsdateien - Erweiterte Sicherheitsfeatures in contact.php - Dokumentation: SECURITY.md und PHPMAILER-UPDATE.md Sicherheitsverbesserungen: - XSS-Schutz und Header-Injection-Schutz - Verbesserte Input-Validierung - Rate Limiting optimiert - reCAPTCHA mit SSL-Verifizierung - Datei-Upload-Sicherheit - .env für sensible Daten (nicht in Git)
This commit is contained in:
33
.htaccess
Normal file
33
.htaccess
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Schütze Konfigurationsdateien im Hauptverzeichnis
|
||||||
|
<Files "config.php">
|
||||||
|
Require all denied
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
<Files ".env">
|
||||||
|
Require all denied
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
<Files ".env.*">
|
||||||
|
Require all denied
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
# Blockiere Zugriff auf Backup-Dateien
|
||||||
|
<FilesMatch "\.(bak|backup|old|orig|save)$">
|
||||||
|
Require all denied
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
# Verhindere Zugriff auf versteckte Dateien
|
||||||
|
<FilesMatch "^\.">
|
||||||
|
Require all denied
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
# Verhindere Directory Listing
|
||||||
|
Options -Indexes
|
||||||
|
|
||||||
|
# Zusätzliche Sicherheits-Header
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
Header set X-Content-Type-Options "nosniff"
|
||||||
|
Header set X-Frame-Options "SAMEORIGIN"
|
||||||
|
Header set X-XSS-Protection "1; mode=block"
|
||||||
|
Header set Referrer-Policy "strict-origin-when-cross-origin"
|
||||||
|
</IfModule>
|
||||||
@@ -3,6 +3,18 @@
|
|||||||
Require all denied
|
Require all denied
|
||||||
</Files>
|
</Files>
|
||||||
|
|
||||||
|
<Files ".env">
|
||||||
|
Require all denied
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
<Files ".env.*">
|
||||||
|
Require all denied
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
<Files "config.php.backup">
|
||||||
|
Require all denied
|
||||||
|
</Files>
|
||||||
|
|
||||||
<Files "test-*.php">
|
<Files "test-*.php">
|
||||||
Require all denied
|
Require all denied
|
||||||
</Files>
|
</Files>
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* WICHTIG: Diese Datei ist veraltet!
|
|
||||||
* Bitte verwenden Sie stattdessen die neue config.php im Hauptverzeichnis
|
|
||||||
* oder noch besser: Verschieben Sie die Config außerhalb des Webroots
|
|
||||||
*
|
|
||||||
* Diese Datei wird aus Kompatibilitätsgründen beibehalten, sollte aber
|
|
||||||
* durch die neue Sicherheitskonfiguration ersetzt werden.
|
|
||||||
*
|
|
||||||
* Siehe: /config.php oder /SECURITY.md für Anweisungen
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Sicherheitskonstante setzen
|
|
||||||
define('CONFIG_LOADED', true);
|
|
||||||
|
|
||||||
// Empfänger-E-Mail-Adresse
|
|
||||||
define('RECEIVING_EMAIL', 'webkontakt@hkw-anwaelte.de');
|
|
||||||
|
|
||||||
// SMTP-Konfiguration
|
|
||||||
// WARNUNG: Diese Credentials sollten in Umgebungsvariablen gespeichert werden!
|
|
||||||
define('SMTP_CONFIG', [
|
|
||||||
'host' => 'mail.webfarben.net',
|
|
||||||
'username' => 'hkw@webfarben.net',
|
|
||||||
'password' => 'B^o16ei32', // ACHTUNG: Bitte in .env auslagern!
|
|
||||||
'port' => '465',
|
|
||||||
'secure' => 'ssl',
|
|
||||||
'auth' => true
|
|
||||||
]);
|
|
||||||
|
|
||||||
// reCAPTCHA Secret Key
|
|
||||||
// WARNUNG: Sollte in Umgebungsvariablen gespeichert werden!
|
|
||||||
define('RECAPTCHA_SECRET', '6LfXn6kqAAAAAJGZ3H371N7kFeNYj7-HW8osLgLq');
|
|
||||||
|
|
||||||
// Sicherheitseinstellungen
|
|
||||||
define('RATE_LIMIT_MAX', 5);
|
|
||||||
define('RATE_LIMIT_WINDOW', 3600);
|
|
||||||
define('MIN_FORM_TIME', 5);
|
|
||||||
define('MAX_FILE_SIZE', 20 * 1024 * 1024);
|
|
||||||
|
|
||||||
// Erlaubte Dateitypen
|
|
||||||
define('ALLOWED_FILE_TYPES', ['pdf', 'doc', 'docx', 'jpg', 'jpeg', 'png']);
|
|
||||||
|
|
||||||
// Spam-Wort-Blacklist
|
|
||||||
define('SPAM_WORDS', [
|
|
||||||
'casino', 'viagra', 'lottery', 'winner', 'cialis',
|
|
||||||
'sex', 'porn', 'loan', 'bitcoin', 'escort', 'xxx',
|
|
||||||
'pharmacy', 'earn money', 'credit', 'crypto'
|
|
||||||
]);
|
|
||||||
|
|
||||||
// E-Mail-Domain-Blacklist
|
|
||||||
define('SPAM_DOMAINS', [
|
|
||||||
'mail.ru', 'yopmail.com', 'tempmail', 'trashmail',
|
|
||||||
'10minutemail', 'guerrillamail', 'mailinator'
|
|
||||||
]);
|
|
||||||
Reference in New Issue
Block a user