docs: clarify docker-compose dollar sign escaping for bcrypt hashes
This commit is contained in:
16
README.md
16
README.md
@@ -71,7 +71,8 @@ Das Projekt ist für den Betrieb mit Docker optimiert.
|
|||||||
Passe die Umgebungsvariablen in der `docker-compose.yml` an:
|
Passe die Umgebungsvariablen in der `docker-compose.yml` an:
|
||||||
- `ADMIN_PASSWORD`: Admin-Passwort als Bcrypt-Hash.
|
- `ADMIN_PASSWORD`: Admin-Passwort als Bcrypt-Hash.
|
||||||
Erstelle den Hash mit: `node scripts/hash-password.js <dein-passwort>`
|
Erstelle den Hash mit: `node scripts/hash-password.js <dein-passwort>`
|
||||||
Standard (admin123): `$2b$10$SHOt9G1qUNIvHoWre7499.eEtp5PtOII0daOQGNV.dhDEuPmOUdsq`
|
**Wichtig:** In `docker-compose.yml` müssen alle `$` Zeichen im Hash verdoppelt werden (`$$`), damit sie nicht als Variablen interpretiert werden!
|
||||||
|
Beispiel: `$$2b$$10$$...`
|
||||||
- `TZ`: Zeitzone für täglichen Puzzle-Wechsel (Standard: `Europe/Berlin`)
|
- `TZ`: Zeitzone für täglichen Puzzle-Wechsel (Standard: `Europe/Berlin`)
|
||||||
- `GOTIFY_URL`: URL deines Gotify Servers (z.B. `https://gotify.example.com`)
|
- `GOTIFY_URL`: URL deines Gotify Servers (z.B. `https://gotify.example.com`)
|
||||||
- `GOTIFY_APP_TOKEN`: App Token für Gotify (z.B. `A...`)
|
- `GOTIFY_APP_TOKEN`: App Token für Gotify (z.B. `A...`)
|
||||||
@@ -142,6 +143,19 @@ Eine vollständige Beispiel-Konfiguration findest du in `nginx.conf.example`.
|
|||||||
- `proxy_buffering off;` - Deaktiviert Buffering für große Dateien
|
- `proxy_buffering off;` - Deaktiviert Buffering für große Dateien
|
||||||
- `client_max_body_size 50M;` - Erlaubt große Uploads
|
- `client_max_body_size 50M;` - Erlaubt große Uploads
|
||||||
|
|
||||||
|
### Admin Login schlägt fehl (Docker)
|
||||||
|
|
||||||
|
**Problem:** "Wrong password" trotz korrekt generiertem Hash.
|
||||||
|
|
||||||
|
**Ursache:** Docker Compose interpretiert `$` Zeichen im Hash als Variablen.
|
||||||
|
|
||||||
|
**Lösung:**
|
||||||
|
In der `docker-compose.yml` müssen alle `$` Zeichen im Hash verdoppelt werden (`$$`).
|
||||||
|
Falsch: `$2b$10$...`
|
||||||
|
Richtig: `$$2b$$10$$...`
|
||||||
|
|
||||||
|
Das Skript `node scripts/hash-password.js <pw>` gibt nun auch direkt den passenden String für Docker Compose aus.
|
||||||
|
|
||||||
## Lizenz
|
## Lizenz
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ services:
|
|||||||
- "3010:3000"
|
- "3010:3000"
|
||||||
environment:
|
environment:
|
||||||
- DATABASE_URL=file:/app/data/prod.db
|
- DATABASE_URL=file:/app/data/prod.db
|
||||||
- ADMIN_PASSWORD=$2b$10$SHOt9G1qUNIvHoWre7499.eEtp5PtOII0daOQGNV.dhDEuPmOUdsq # Change this! Must be a bcrypt hash. Use scripts/hash-password.js to generate.
|
- ADMIN_PASSWORD=$$2b$$10$$SHOt9G1qUNIvHoWre7499.eEtp5PtOII0daOQGNV.dhDEuPmOUdsq # Change this! Must be a bcrypt hash. Escape $ as $$ in docker-compose!
|
||||||
- TZ=Europe/Berlin # Timezone for daily puzzle rotation
|
- TZ=Europe/Berlin # Timezone for daily puzzle rotation
|
||||||
- GOTIFY_URL=https://gotify.example.com
|
- GOTIFY_URL=https://gotify.example.com
|
||||||
- GOTIFY_APP_TOKEN=your_gotify_token
|
- GOTIFY_APP_TOKEN=your_gotify_token
|
||||||
|
|||||||
@@ -17,5 +17,8 @@ bcrypt.hash(password, saltRounds, (err, hash) => {
|
|||||||
}
|
}
|
||||||
console.log('Plaintext:', password);
|
console.log('Plaintext:', password);
|
||||||
console.log('Bcrypt Hash:', hash);
|
console.log('Bcrypt Hash:', hash);
|
||||||
|
console.log('\n⚠️ IMPORTANT FOR DOCKER COMPOSE:');
|
||||||
|
console.log('If you use this hash directly in docker-compose.yml, you MUST escape the $ signs:');
|
||||||
|
console.log('Docker Hash:', hash.replace(/\$/g, '$$$$'));
|
||||||
console.log('\nSet this hash as your ADMIN_PASSWORD environment variable.');
|
console.log('\nSet this hash as your ADMIN_PASSWORD environment variable.');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user