浏览代码

improoving security, adding readme

Medowar 1 月之前
父节点
当前提交
5a5209c139
共有 3 个文件被更改,包括 88 次插入2 次删除
  1. 49 0
      README.md
  2. 7 2
      data/default.htaccess
  3. 32 0
      default.htaccess

+ 49 - 0
README.md

@@ -0,0 +1,49 @@
+# Feuerwehr Vereinsshop - Setup
+
+## Voraussetzungen
+
+- PHP 8.x
+- Webserver
+- Schreibrechte auf `data/`
+
+## 1) `.htaccess` aktivieren
+
+Im Projektordner liegt eine Vorlage unter `data/default.htaccess`.
+
+Benenne sie um in:
+
+- `data/.htaccess`
+
+Beispiel:
+
+```bash
+mv data/default.htaccess data/.htaccess
+```
+
+## 2) Globale Config und Admins im `config.php` einrichten
+
+In `config.php` mindestens diese Werte anpassen:
+
+- `SITE_NAME`
+- `SITE_URL`
+- `ADMIN_EMAIL`
+- `FROM_EMAIL`
+- `FROM_NAME`
+- Optional: `ORDER_PREFIX`, `RESERVATION_EXPIRY_DAYS`
+
+Passe `ADMIN_USERS` an:
+
+- Für jeden Admin einen Eintrag mit Benutzername und Passwort-Hash hinzufügen
+- Standard-Accounts/Hashes nach dem ersten Setup ersetzen
+
+Beispielstruktur:
+
+```php
+define('ADMIN_USERS', [
+    'admin' => '...bcrypt-hash...',
+    'manager' => '...bcrypt-hash...'
+]);
+```
+
+Generate the password: 
+https://www.onlinewebtoolkit.com/hash-generator using the crypt functionality.

+ 7 - 2
data/default.htaccess

@@ -1,3 +1,8 @@
 # Protect data directory from direct access
-Order Deny,Allow
-Deny from all
+<IfModule mod_authz_core.c>
+    Require all denied
+</IfModule>
+<IfModule !mod_authz_core.c>
+    Order deny,allow
+    Deny from all
+</IfModule>

+ 32 - 0
default.htaccess

@@ -0,0 +1,32 @@
+Options -Indexes
+
+<IfModule mod_headers.c>
+    Header always set X-Content-Type-Options "nosniff"
+    Header always set X-Frame-Options "SAMEORIGIN"
+    Header always set Referrer-Policy "strict-origin-when-cross-origin"
+    Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
+    Header always set Cross-Origin-Resource-Policy "same-origin"
+</IfModule>
+
+<IfModule mod_rewrite.c>
+    RewriteEngine On
+
+    # Block hidden files/folders except ACME challenge path.
+    RewriteRule "(^|/)\.(?!well-known/)" - [F]
+
+    # Deny direct access to writable data files.
+    RewriteRule ^data/ - [F,L]
+</IfModule>
+
+<IfModule mod_authz_core.c>
+    <FilesMatch "^(config\.php|.*\.(json|md))$">
+        Require all denied
+    </FilesMatch>
+</IfModule>
+
+<IfModule !mod_authz_core.c>
+    <FilesMatch "^(config\.php|.*\.(json|md))$">
+        Order allow,deny
+        Deny from all
+    </FilesMatch>
+</IfModule>