Files
minio-webui/scripts/generate-password-docker.sh
T
paul 2ee293244c feat: Add password generation and testing scripts
- Add generate-password.js for Node.js password hash generation
- Add generate-password-docker.sh for Docker-based generation
- Add test-password.sh to verify password against current hash

These scripts help users generate correct bcrypt hashes for the
ADMIN_PASSWORD_HASH environment variable.

Usage:
- Generate new hash: ./scripts/generate-password-docker.sh
- Test current password: ./scripts/test-password.sh

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-23 15:11:48 +02:00

37 lines
926 B
Bash
Executable File

#!/bin/bash
echo "================================="
echo "MinIO WebUI Password Generator"
echo "================================="
echo ""
read -s -p "Enter password: " PASSWORD
echo ""
if [ -z "$PASSWORD" ] || [ ${#PASSWORD} -lt 8 ]; then
echo "Error: Password must be at least 8 characters long."
exit 1
fi
echo ""
echo "Generating password hash..."
# Use the backend container to generate the hash
HASH=$(docker run --rm -it node:20-alpine sh -c "
npm install bcrypt >/dev/null 2>&1 && \
node -e \"
const bcrypt = require('bcrypt');
bcrypt.hash('$PASSWORD', 12).then(hash => console.log(hash));
\"
" | tr -d '\r')
echo ""
echo "================================="
echo "Password Hash Generated:"
echo "================================="
echo ""
echo "$HASH"
echo ""
echo "Add this to your .env file:"
echo "ADMIN_PASSWORD_HASH=$HASH"
echo ""
echo "================================="