Files
picpeak/scripts/generate-jwt-secret.sh
T
paul 1cfd6a44d6
Test Gitea Actions / test (push) Successful in 15s
continuous-integration/drone/push Build is passing
feat(security): implement secure JWT secrets for all environments
- Replace short dev secrets with secure 64-character (256-bit) secrets
- Update docker-compose.yml with secure development secret
- Update docker-compose.local.yml with unique secure secret
- Improve .env.example with clear security instructions
- Add comprehensive security best practices documentation
- Create helper script to generate secure JWT secrets

Security improvements:
- All environments now use cryptographically secure 64-character secrets
- Clear warnings and instructions prevent use of weak secrets
- Documentation guides proper secret management
- Helper script makes it easy to generate new secrets

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 23:40:43 +02:00

34 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Generate a secure JWT secret for PicPeak
echo "==================================="
echo "JWT Secret Generator for PicPeak"
echo "==================================="
echo ""
# Generate the secret
SECRET=$(openssl rand -hex 32)
echo "Your new JWT secret (64 characters):"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "$SECRET"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "To use this secret:"
echo ""
echo "1. For Docker Compose (.env file):"
echo " JWT_SECRET=$SECRET"
echo ""
echo "2. For environment variable:"
echo " export JWT_SECRET=$SECRET"
echo ""
echo "3. For systemd service:"
echo " Environment=\"JWT_SECRET=$SECRET\""
echo ""
echo "⚠️ IMPORTANT:"
echo " - Keep this secret secure and never commit it to version control"
echo " - Use different secrets for different environments"
echo " - Store production secrets in a secure secret management system"
echo " - Rotate secrets regularly (every 90 days recommended)"
echo ""