docs: Add manual password hash and JWT token generation instructions

- Added multiple methods for generating bcrypt password hashes
- Added multiple methods for generating secure JWT secrets
- Included Node.js, Python, Docker, and shell-based approaches
- Added security notes and best practices
- Provided example .env configuration with generated values
This commit is contained in:
2025-07-22 16:33:28 +02:00
parent cfd24b297d
commit a6ee4346be
+82
View File
@@ -112,6 +112,88 @@ MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
```
### Manual Password Hash Generation
If you need to generate the password hash manually (instead of using the setup script):
#### Method 1: Using Node.js
```bash
# Install bcrypt globally
npm install -g bcrypt-cli
# Generate hash (will prompt for password)
bcrypt-cli hash
# Or with inline password (be careful with shell history)
node -e "const bcrypt = require('bcrypt'); bcrypt.hash('YOUR_PASSWORD', 12).then(console.log)"
```
#### Method 2: Using Python
```bash
# Install bcrypt
pip install bcrypt
# Generate hash
python3 -c "import bcrypt; password = b'YOUR_PASSWORD'; print(bcrypt.hashpw(password, bcrypt.gensalt(rounds=12)).decode())"
```
#### Method 3: Using Docker
```bash
# One-liner using Node.js in Docker
docker run --rm -it node:alpine sh -c "npm install bcrypt && node -e \"require('bcrypt').hash('YOUR_PASSWORD', 12).then(console.log)\""
```
### JWT Secret Generation
Generate a secure JWT secret:
#### Method 1: Using OpenSSL
```bash
# Generate 64-character random string
openssl rand -base64 64 | tr -d '\n'
```
#### Method 2: Using Node.js
```bash
# Generate crypto-random string
node -e "console.log(require('crypto').randomBytes(64).toString('base64'))"
```
#### Method 3: Using Python
```bash
# Generate secure random string
python3 -c "import secrets; print(secrets.token_urlsafe(64))"
```
#### Method 4: Using /dev/urandom
```bash
# Generate from random device
head -c 64 /dev/urandom | base64 | tr -d '\n'
```
### Example .env Configuration
After generating your password hash and JWT secret:
```env
# Example with generated values
ADMIN_PASSWORD_HASH=$2b$12$YKkb7VCztpTQ5eRQwfBfKuP0kziOlLXdH8kKDP3ZbQfCPwF.EAYmS
JWT_SECRET=Km5F2p9kXx7Nw3Qr8vBz4Ht6Lj9Mn2Sf5Yd8Gc3Vb7Nx4Wq9Rt6Yh3Kp8Zx2Cv5
```
**Security Notes:**
- Never commit actual passwords or secrets to version control
- Use at least 12 rounds for bcrypt (default in examples above)
- JWT secrets should be at least 256 bits (32 bytes) of entropy
- Store the `.env` file securely with restricted permissions: `chmod 600 .env`
### Security Settings
```env